[core] improve accuracy of bandwidth write limits

reset counters at the beginning of the second, and then include in the
counters (for current second) any new data written
This commit is contained in:
Glenn Strauss 2017-01-21 01:48:25 -05:00
parent e2c19c3680
commit 65a6740fe2
1 changed files with 6 additions and 2 deletions

View File

@ -1564,6 +1564,10 @@ int main (int argc, char **argv) {
/* cleanup stat-cache */
stat_cache_trigger_cleanup(srv);
/* reset global/aggregate rate limit counters */
for (i = 0; i < srv->config_context->used; ++i) {
srv->config_storage[i]->global_bytes_per_second_cnt = 0;
}
/**
* check all connections for timeouts
*
@ -1649,11 +1653,11 @@ int main (int argc, char **argv) {
changed = 1;
}
con->bytes_written_cur_second = 0;
if (changed) {
connection_state_machine(srv, con);
}
con->bytes_written_cur_second = 0;
*(con->conf.global_bytes_per_second_cnt_ptr) = 0;
#if DEBUG_CONNECTION_STATES
if (cs == 0) {