mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-11 00:09:42 +00:00
eab777c32e
When a frontend is rate-limited to 1000 connections per second, the effective rate measured from the client is 999/s, and connections experience an average response time of 99.5 ms with a standard deviation of 2 ms. The reason for this inaccuracy is that when computing frequency counters, we use one part of the previous value proportional to the number of milliseconds remaining in the current second. But even the last millisecond still uses a part of the past value, which is wrong : since we have a 1ms resolution, the last millisecond must be dedicated only to filling the current second. So we slightly adjust the algorithm to use 999/1000 of the past value during the first millisecond, and 0/1000 of the past value during the last millisecond. We also slightly improve the computation by computing the remaining time instead of the current time in tv_update_date(), so that we don't have to negate the value in each frequency counter. Now with the fix, the connection rate measured by both the client and haproxy is a steady 1000/s, the average response time measured is 99.2ms and more importantly, the standard deviation has been divided by 3 to 0.6 millisecond. This fix should also be backported to 1.4 which has the same issue. |
||
---|---|---|
.. | ||
common | ||
import | ||
proto | ||
types |