Skip to content

Commit

Permalink
mpm_event: Periodic linger queue shrink (500ms).
Browse files Browse the repository at this point in the history
  • Loading branch information
ylavic committed Jun 27, 2023
1 parent 6202827 commit 690365d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions server/mpm/event/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -2545,7 +2545,7 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy)
proc_info *ti = dummy;
int process_slot = ti->pslot;
process_score *ps = ap_get_scoreboard_process(process_slot);
apr_time_t next_stats_time = 0;
apr_time_t next_stats_time = 0, next_shrink_time = 0;
apr_interval_time_t min_poll_timeout = -1;

free(ti);
Expand Down Expand Up @@ -2944,6 +2944,7 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy)
/* The linger_q can be shrinked any time under pressure */
if (workers_were_busy || apr_atomic_read32(&dying)) {
shrink_timeout_queue(linger_q, now);
next_shrink_time = now + QUEUES_SHRINK_TIMEOUT;
}
else {
process_timeout_queue(linger_q, now);
Expand All @@ -2965,11 +2966,13 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy)
"queues maintained: next timeout=%" APR_TIME_T_FMT,
next_expiry ? next_expiry - now : -1);
}
else if ((workers_were_busy || apr_atomic_read32(&dying))
&& apr_atomic_read32(keepalive_q->total)) {
else if (next_shrink_time <= now
&& (workers_were_busy || apr_atomic_read32(&dying))
&& apr_atomic_read32(linger_q->total)) {
apr_thread_mutex_lock(timeout_mutex);
shrink_timeout_queue(keepalive_q, now);
shrink_timeout_queue(linger_q, now);
apr_thread_mutex_unlock(timeout_mutex);
next_shrink_time = now + QUEUES_SHRINK_TIMEOUT;
}
} /* listener main loop */

Expand Down

0 comments on commit 690365d

Please sign in to comment.