What is an Accumulator?

An accumulator is a value collector (Tieable) for a given intervalproducerstat and value.

Accumulators collect and store data, and that's what differentiates them from producers. Producers only display data for the last measurement period, while accumulators store values since application launch.

Also, accumulators may present the accumulated data as charts, which is helpful for estimating your app's performance within a long period.

For example

Let's say we're still watching our app's SessionCount.

The accumulator, tied to this producer, will collect the info about the number of sessions, taking measurement on the basis of time interval you've selected (like every 5 minutes).
More to that, all session info will be stored since the moment the accumulator has been created.

Why We Created Accumulators?

The MoSKito architecture differentiates between stats collected in the VM where they 'happen' and stats that are collected elsewhere. Now, the stats that are collected in the VM usually have multiple values, one for currently measured value, and one for each of the intervals. This amount can grow easily to huge numbers in a mature system. For example one of the installation runs with 1056 producers with 27067 statvalues and 216536 value holders. Each of those value holders holds one value for each interval and one current value. This makes 9 values in a default installation and almost 2 millions of values stored in the system. 

People often complain about not having the timeline for values in the MoSKito WebUI, the embedded UI. The above calculation makes clear that adding even 10 past values to the history would bloat the number easily to 20.000.000. And with 10 past values you can have a history of 50 minutes for the 5 minute interval, which is virtually nothing. To have at least week history would mean to have 2016 values for each 5m interval values - I think you get the point now. 

However it makes sense to have at least some historical values. This is where MoSKito Accumulators come into play. 

Adding an Accumulator 

Accumulators can be added or defined either:

  • programmatically by code, 
  • programmatically by annotations,
  • by configuration or 
  • via WebUI.

Via WebUI

There are currently two ways to add an accumulator via WebUI, so to say for the end user; however, one of them is being under development right now, so we concentrate on the working one. 

To add an accumulator via WebUI:

First of all, you should know what you are going to accumulate. Let's say we want to accumulate the amount of newly created sessions for a 5-minute interval (SessionCount producer).

  1. Go to Producers tab. 
  2. Find and click the needed producer (SessionCount in our case)

  3. On the appearing producer page, click the Add Accumulator button (upper-right corner).

  4. In the appearing New Accumulator box:

      1. name the new accumulator (Name box)
        (info) Read more about Naming Convention

      2. select the monitoring interval (Interval menu)

      3. choose the measurement units (Unit menu).
        (info) The time unit should only be picked on time-based values. AVG request duration is time based, but request count is not.

  5. In the Stats and Values table (below the New Accumulator box), choose the value to monitor (New in our case) and click the corresponding ADD link.

    The row defines the stat name that you want to accumulate. In this case Sessions, but our producer has only one stat. 

    The column defines the value name that you want to accumulate. In this case New.

Congratulations, a new accumulator has been added! 
You will be redirected to the Accumulators tab, where you can admire your new shiny accumulator.


The easiest way to add an accumulator is to use the MoSKito Configuration:

MoSKito-Essential Configuration Guide#Accumulators



To add accumulators programmatically you will need to create an AccumulatorDefinition. Here is an example of accumulator creation in code:

AccumulatorDefinition definition = new AccumulatorDefinition();
Accumulator acc = AccumulatorRepository.getInstance().createAccumulator(definition);


We provide a convenience class (utility) net.anotheria.moskito.core.accumulation.Accumulators with some common methods for accumulator creation.

Modifier and TypeMethod and Description
static AccumulatorcreateAccumulator(java.lang.String name, java.lang.String producerName, java.lang.String statName, java.lang.String valueName, java.lang.String intervalName)
Creates a new accumulator.
static AccumulatorcreateMemoryAccumulator(java.lang.String name, java.lang.String producerName, java.lang.String valueName, java.lang.String interval)
Create a new memory pool value accumulator.
static AccumulatorcreateMemoryAccumulator1m(java.lang.String name, java.lang.String producerName, java.lang.String valueName)
Create a new memory pool value accumulator for 1m interval.
static AccumulatorcreateMemoryAccumulator5m(java.lang.String name, java.lang.String producerName, java.lang.String valueName)
Create a new memory pool value accumulator for 5m interval.
static voidcreateServiceAVGAccumulator(java.lang.String name, java.lang.String producerName)
Creates a new accumulator for service average response time measurement.
static voidcreateServiceAVGAccumulator(java.lang.String name, java.lang.String producerName, java.lang.String interval)
Creates a new accumulator for service average response time measurement.
static voidcreateServiceREQAccumulator(java.lang.String name, java.lang.String producerName)
Creates a new accumulator for service req count.
static voidcreateServiceREQAccumulator(java.lang.String name, java.lang.String producerName, java.lang.String interval)
Creates a new accumulator for service req count.
static voidcreateUrlAVGAccumulator(java.lang.String name, java.lang.String url)
Creates a new accumulator for avg response time of the url.
static voidcreateUrlAVGAccumulator(java.lang.String name, java.lang.String url, java.lang.String interval)
Creates a new accumulator for avg response time of the url.
static voidcreateUrlREQAccumulator(java.lang.String name, java.lang.String url)
Creates a new accumulator for request count of the url.
static voidcreateUrlREQAccumulator(java.lang.String name, java.lang.String url, java.lang.String interval)
Creates a new accumulator for request count of the url.


With this utility your code to create some accumulators will look pretty straight forward: 

Accumulators.createAccumulator("SessionCount CurAbsolute", "SessionCount", "Sessions", "cur", "default");
Accumulators.createAccumulator("SessionCount Cur1h", "SessionCount", "Sessions", "cur", "1h");
Accumulators.createAccumulator("SessionCount New1h", "SessionCount", "Sessions", "new", "1h");
Accumulators.createAccumulator("SessionCount Del1h", "SessionCount", "Sessions", "del", "1h");




Accumulators.createMemoryAccumulator5m("PermGenFree 5m", "MemoryPool-PS Perm Gen-NonHeap", "Free"); 
Accumulators.createMemoryAccumulator5m("PermGenFree MB 5m", "MemoryPool-PS Perm Gen-NonHeap", "Free MB"); 
Accumulators.createMemoryAccumulator5m("OldGenFree 5m", "MemoryPool-PS Old Gen-Heap", "Free");
Accumulators.createMemoryAccumulator5m("OldGenFree MB 5m", "MemoryPool-PS Old Gen-Heap", "Free MB");
Accumulators.createMemoryAccumulator5m("OldGenUsed 5m", "MemoryPool-PS Old Gen-Heap", "Used");
Accumulators.createMemoryAccumulator5m("OldGenUsed MB 5m", "MemoryPool-PS Old Gen-Heap", "Used MB");


The best way to add your accumulator is to use some upon-the-start facility of your application or container. For webapp its the ServletContextListener.

Here are some examples from MoSKito itself: WebUI and MoSKito Demo.

Accumulators tab

To view all available accumulators with their essential info: click the Accumulators tab.

Accumulators tab is probably the simplest of all MoSKito tabs, solely presenting the list of accumulators.

The accumulator list has 4 columns:

Nameaccumulator name

accumulator description, used in internal MoSKito data exchange configuration files.

The description uses the following format: 

For example: SessionCount.Sessions.new/1h/MILLISECONDS

Valuesaccumulator value (within the last interval)
Last Timestampdate and time of the last measurement

As with all other tabs, you may set auto-reloadingexport threshold data or view help.

Displaying Accumulator Data as Charts

To display only the accumulator chart with the list of other available accumulators: 
In accumulator list, click the name link of the needed accumulator
choose the accumulator by selecting its check box and click the Submit button (bottom of the list).

To display accumulator chart with detailed info: click  icon, located on the same line with the needed accumulator.
Below the chart, you will see the following info sections:

  • Data section: all the accumulated values with their corresponding timestamps,
  • JSON section: JSON file with all available accumulator info.

Moving cursor along the curve on a chart shows the callout menu with the following info:

  • Timestamp,
  • Accumulator name,
  • Accumulator value.

To hide the charts and get back to accumulator list: refresh the Accumulators tab by clicking its header.

Displaying Multiple Charts

One of advantages with MoSKito accumulators is that you can view several charts at a time, which is convenient for comparing purposes.

To view multiple accumulator charts:

  1. In accumulator list, choose the accumulators by selecting their check boxes (leftmost column).
  2. Click the Submit button (bottom of accumulator list).
When displayed simultaneously, multiple charts may coincide or simply hide each other.
We recommend using Combine and normalize Display Mode (see Display Modes and Chart Types paragraph).

Display Modes 

When viewing accumulator charts, you may select different Display Modes  for your convenience. The controls are located at the bottom of accumulator list.

To change Display Mode: check the needed Mode radio button (bottom of accumulator list)

Display ModeDisplays...Example
Combinemultiple curves within one chart (axis), with no additional graphical rendering
Combine and normalizemultiple curves within one chart (axis), compacted for viewing convenience
Multiple Graphsevery curve as a separate chart (within different axis)




  • No labels