diff options
author | Yann Ylavic <ylavic@apache.org> | 2024-05-28 16:10:43 +0200 |
---|---|---|
committer | Yann Ylavic <ylavic@apache.org> | 2024-05-28 16:10:43 +0200 |
commit | c0a30141cad8ee5541a8c73b4b19f7a6a78f979b (patch) | |
tree | 4fdd4c2dbe9fc63874e6c3ebe7d2b775092c0e9b /include | |
parent | Steal an APLONGO for PR 448. (diff) | |
download | apache2-c0a30141cad8ee5541a8c73b4b19f7a6a78f979b.tar.xz apache2-c0a30141cad8ee5541a8c73b4b19f7a6a78f979b.zip |
mpm_event,core: Handle async POLLIN/POLLOUT in CONN_STATE_PROCESS state.
* include/httpd.h:
Rename CONN_STATE_CHECK_REQUEST_LINE_READABLE to CONN_STATE_KEEPALIVE
and CONN_STATE_READ_REQUEST_LINE to CONN_STATE_PROCESS, keeping the
old enums as aliases. Rework comments about each state.
* server/mpm/event/event.c:
Use the new states names.
Let the process_connection hooks return CONN_STATE_PROCESS for mpm_event
to POLLIN or POLLOUT depending on c->cs->sense being CONN_SENSE_WANT_READ
or CONN_SENSE_WANT_WRITE respectively.
Remove (ab)use of CONN_STATE_WRITE_COMPLETION with CONN_SENSE_WANT_READ to
mean poll() for read (and the need for the obscure c->clogging_input_filters
to make it work as expected). This is what CONN_STATE_PROCESS is for now.
Update the comment about the states that can be returned by process_connection
hooks (and their usage).
Use the same queue (process_q renamed from write_completion_q) for polling
connections in both CONN_STATE_PROCESS and CONN_STATE_WRITE_COMPLETION
states since they both use the same (server_rec's) Timeout. This implies
that both states are accounted as "write-completion" in mod_status for now.
* server/mpm/motorz/motorz.c, server/mpm/simple/simple_io.c, modules/http/http_core.c:
Use the new states names (only).
* include/scoreboard.h:
Change comment about process_score->write_completion to note that the
counter refers to CONN_STATE_PROCESS connections returned to the MPM
too.
* modules/http2/h2_c1.c:
Return the c1 connection with the CONN_STATE_PROCESS state rather than
CONN_STATE_WRITE_COMPLETION when waiting for a window update (i.e. ask
the MPM to poll for read directly). This avoids the transition to
CONN_STATE_KEEPALIVE which could kill the connection under high load.
Github: closes #448
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1918022 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include')
-rw-r--r-- | include/httpd.h | 25 | ||||
-rw-r--r-- | include/scoreboard.h | 2 |
2 files changed, 16 insertions, 11 deletions
diff --git a/include/httpd.h b/include/httpd.h index ccbe417328..c547c30ea4 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -1318,16 +1318,21 @@ struct conn_slave_rec { * only be set by the MPM. Use CONN_STATE_LINGER outside of the MPM. */ typedef enum { - CONN_STATE_CHECK_REQUEST_LINE_READABLE, - CONN_STATE_READ_REQUEST_LINE, - CONN_STATE_HANDLER, - CONN_STATE_WRITE_COMPLETION, - CONN_STATE_SUSPENDED, - CONN_STATE_LINGER, /* connection may be closed with lingering */ - CONN_STATE_LINGER_NORMAL, /* MPM has started lingering close with normal timeout */ - CONN_STATE_LINGER_SHORT, /* MPM has started lingering close with short timeout */ - - CONN_STATE_NUM /* Number of states (keep/kept last) */ + CONN_STATE_KEEPALIVE, /* Kept alive in the MPM (using KeepAliveTimeout) */ + CONN_STATE_PROCESS, /* Handled by process_connection() hooks, may be returned + to the MPM for POLLIN/POLLOUT (using Timeout) */ + CONN_STATE_HANDLER, /* Processed by the modules handlers */ + CONN_STATE_WRITE_COMPLETION, /* Flushed by the MPM before entering CONN_STATE_KEEPALIVE */ + CONN_STATE_SUSPENDED, /* Suspended in the MPM until ap_run_resume_suspended() */ + CONN_STATE_LINGER, /* MPM flushes then closes the connection with lingering */ + CONN_STATE_LINGER_NORMAL, /* MPM has started lingering close with normal timeout */ + CONN_STATE_LINGER_SHORT, /* MPM has started lingering close with short timeout */ + + CONN_STATE_NUM, /* Number of states (keep here before aliases) */ + + /* Aliases (legacy) */ + CONN_STATE_CHECK_REQUEST_LINE_READABLE = CONN_STATE_KEEPALIVE, + CONN_STATE_READ_REQUEST_LINE = CONN_STATE_PROCESS, } conn_state_e; typedef enum { diff --git a/include/scoreboard.h b/include/scoreboard.h index 7cf92e405a..7542999b83 100644 --- a/include/scoreboard.h +++ b/include/scoreboard.h @@ -144,7 +144,7 @@ struct process_score { * connections (for async MPMs) */ apr_uint32_t connections; /* total connections (for async MPMs) */ - apr_uint32_t write_completion; /* async connections doing write completion */ + apr_uint32_t write_completion; /* async connections in write completion or POLLIN/POLLOUT */ apr_uint32_t lingering_close; /* async connections in lingering close */ apr_uint32_t keep_alive; /* async connections in keep alive */ apr_uint32_t suspended; /* connections suspended by some module */ |