Projects tigase _server server-core Issues #1489
Average Processing Time Statistic Calculation (#1489)
Closed
Unknown opened 2 years ago

Average processing time calculation does not present actual average time.

tigase.stats.StatisticsInvocationHandler.Statistics#updateExecutionTime

public void updateExecutionTime(long executionTime) {
	executions_counter++;
	avgProcessingTime = (avgProcessingTime + executionTime) / 2;
}

Suppose that, there are 3 executions with 3, 5 and 10ms. Expected average processing time : (3 + 5 + 10) / 3 = 18 / 3 = 6ms Actual average processing time : ( (3 + 5) / 2 + 10 ) / 2 = 7ms

Over time gap between actual and expected times increases. Actual average processing time closer to the last value.

  • Tigase version: 8.3.0
Unknown commented 2 years ago

I think the confusion stems from the fact, that we are using "moving average" (with very small window). While it may seem "incorrect" in the whole execution period, it gives better indication if there was a spike in the processing time. See the example below: Processing Time | (moving) Average processing time | (Total) Average processing time -- | -- | -- 2 |   |   4 | 3 | 3 6 | 5 | 4 3 | 4 | 4 3 | 3 | 4 3 | 3 | 4 6 | 5 | 4 7 | 6 | 4 8 | 7 | 5 3 | 5 | 5 6 | 5 | 5 7 | 6 | 5 33 | 20 | 7 6333 | 3176 | 459 6 | 1591 | 429 3 | 797 | 402 2 | 400 | 379 2 | 201 | 358 77 | 139 | 343 8 | 73 | 326 4 | 39 | 311 7 | 23 | 297 2 | 12 | 284 444 | 228 | 291 6 | 117 | 279 3 | 60 | 269 3 | 32 | 259 3 | 17 | 250 3 | 10 | 241 3 | 7 | 233

issue 1 of 1
Type
Bug
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/server-core#1489
Please wait...
Page is in error, reload to recover