summaryrefslogtreecommitdiffstats
path: root/server/mpm/event/event.c
diff options
context:
space:
mode:
authorPaul Querna <pquerna@apache.org>2011-11-15 16:50:09 +0100
committerPaul Querna <pquerna@apache.org>2011-11-15 16:50:09 +0100
commit985c6fe29406247728d889129f126ba157ed3b12 (patch)
tree59aa14b60ff7506561974e4e5d8834410eeb6d85 /server/mpm/event/event.c
parentdisable mod_reqtimeout if not configured (diff)
downloadapache2-985c6fe29406247728d889129f126ba157ed3b12.tar.xz
apache2-985c6fe29406247728d889129f126ba157ed3b12.zip
Instead of disabling the listening sockets from the pollset when under load, just stop calling the accept call, but leave the sockets in the pollset.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1202256 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--server/mpm/event/event.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c
index 75af4f4995..8e4f580eea 100644
--- a/server/mpm/event/event.c
+++ b/server/mpm/event/event.c
@@ -1533,35 +1533,35 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy)
}
}
else if (pt->type == PT_ACCEPT) {
+ int skip_accept = 0;
+ int connection_count_local = connection_count;
+
/* A Listener Socket is ready for an accept() */
if (workers_were_busy) {
- if (!listeners_disabled)
- disable_listensocks(process_slot);
- listeners_disabled = 1;
+ skip_accept = 1;
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf,
"All workers busy, not accepting new conns"
"in this process");
}
- else if (apr_atomic_read32(&connection_count) > threads_per_child
+ else if (listeners_disabled) {
+ listeners_disabled = 0;
+ enable_listensocks(process_slot);
+ }
+ else if (connection_count_local > threads_per_child
+ ap_queue_info_get_idlers(worker_queue_info) *
worker_factor / WORKER_FACTOR_SCALE)
{
- if (!listeners_disabled)
- disable_listensocks(process_slot);
+ skip_accept = 1;
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf,
"Too many open connections (%u), "
"not accepting new conns in this process",
- apr_atomic_read32(&connection_count));
+ connection_count_local);
ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, ap_server_conf,
"Idle workers: %u",
ap_queue_info_get_idlers(worker_queue_info));
- listeners_disabled = 1;
}
- else if (listeners_disabled) {
- listeners_disabled = 0;
- enable_listensocks(process_slot);
- }
- if (!listeners_disabled) {
+
+ if (skip_accept == 0) {
lr = (ap_listen_rec *) pt->baton;
ap_pop_pool(&ptrans, worker_queue_info);