Skip to content

Commit

Permalink
v2.0.0-rc2
Browse files Browse the repository at this point in the history
--------------------------------------------------------------------------------
 * Switching from a thread-safe apr pollset (not supported under Windows) to
   a wakeable pollset implementation.
 * Adding a clear error in the logs if the pollset could not be created.
  • Loading branch information
Stefan Eissing committed Sep 28, 2021
1 parent 16d235c commit 9054273
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 14 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
v2.0.0-rc2
--------------------------------------------------------------------------------
* Switching from a thread-safe apr pollset (not supported under Windows) to
a wakeable pollset implementation.
* Adding a clear error in the logs if the pollset could not be created.

v2.0.0-rc1
--------------------------------------------------------------------------------
* HTTP/2 connections now use pollsets to monitor the status of the
Expand Down
31 changes: 23 additions & 8 deletions mod_http2/h2_mplx.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,12 @@ h2_mplx *h2_mplx_c1_create(h2_stream *stream0, server_rec *s, apr_pool_t *parent
m->mood_update_interval = apr_time_from_msec(100);

status = mplx_pollset_create(m);
if (APR_SUCCESS != status) goto failure;
if (APR_SUCCESS != status) {
ap_log_cerror(APLOG_MARK, APLOG_ERR, status, m->c1, APLOGNO()
"nghttp2: could not create pollset");
goto failure;
}
m->streams_to_poll = apr_array_make(m->pool, 10, sizeof(h2_stream*));
m->streams_ev_in = apr_array_make(m->pool, 10, sizeof(h2_stream*));
m->streams_ev_out = apr_array_make(m->pool, 10, sizeof(h2_stream*));

Expand Down Expand Up @@ -671,7 +676,9 @@ static conn_rec *s_next_c2(h2_mplx *m)

stream->c2 = c2;
++m->processing_count;
mplx_pollset_add(m, conn_ctx);
APR_ARRAY_PUSH(m->streams_to_poll, h2_stream *) = stream;
apr_pollset_wakeup(m->pollset);

return c2;
}

Expand Down Expand Up @@ -890,7 +897,7 @@ static apr_status_t mplx_pollset_create(h2_mplx *m)
/* stream0 output, pdf_out+pfd_in_consume per active streams */
max_pdfs = 1 + 2 * H2MIN(m->processing_max, m->max_streams);
return apr_pollset_create(&m->pollset, max_pdfs, m->pool,
APR_POLLSET_THREADSAFE);
APR_POLLSET_WAKEABLE);
}

static apr_status_t mplx_pollset_add(h2_mplx *m, h2_conn_ctx_t *conn_ctx)
Expand Down Expand Up @@ -963,11 +970,22 @@ static apr_status_t mplx_pollset_poll(h2_mplx *m, apr_interval_time_t timeout,
ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, m->c1,
"h2_mplx(%ld): enter polling timeout=%d",
m->id, (int)apr_time_sec(timeout));
H2_MPLX_LEAVE(m);
do {
/* add streams we started processing in the meantime */
if (m->streams_to_poll->nelts) {
for (i = 0; i < m->streams_to_poll->nelts; ++i) {
stream = APR_ARRAY_IDX(m->streams_to_poll, i, h2_stream*);
if (stream->c2 && (conn_ctx = h2_conn_ctx_get(stream->c2))) {
mplx_pollset_add(m, conn_ctx);
}
}
apr_array_clear(m->streams_to_poll);
}

H2_MPLX_LEAVE(m);
rv = apr_pollset_poll(m->pollset, timeout >= 0? timeout : -1, &nresults, &results);
H2_MPLX_ENTER(m);
} while (APR_STATUS_IS_EINTR(rv));
H2_MPLX_ENTER(m);

if (APR_SUCCESS != rv) {
if (APR_STATUS_IS_TIMEUP(rv)) {
Expand Down Expand Up @@ -1062,9 +1080,6 @@ static apr_status_t mplx_pollset_poll(h2_mplx *m, apr_interval_time_t timeout,
pfd->rtnevents);
if (on_stream_input) {
APR_ARRAY_PUSH(m->streams_ev_in, h2_stream*) = stream;
H2_MPLX_LEAVE(m);
on_stream_input(on_ctx, stream);
H2_MPLX_ENTER(m);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions mod_http2/h2_mplx.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
*/

struct apr_pool_t;
struct apr_array_header_t;
struct apr_thread_mutex_t;
struct apr_thread_cond_t;
struct h2_bucket_beam;
Expand Down Expand Up @@ -60,7 +59,7 @@ struct h2_mplx {

struct h2_ihash_t *streams; /* all streams active */
struct h2_ihash_t *shold; /* all streams done with c2 processing ongoing */
struct apr_array_header_t *spurge; /* all streams done, ready for destroy */
apr_array_header_t *spurge; /* all streams done, ready for destroy */

struct h2_iqueue *q; /* all stream ids that need to be started */

Expand All @@ -80,6 +79,7 @@ struct h2_mplx {
struct apr_thread_cond_t *join_wait;

apr_pollset_t *pollset; /* pollset for c1/c2 IO events */
apr_array_header_t *streams_to_poll; /* streams to add to the pollset */
apr_array_header_t *streams_ev_in;
apr_array_header_t *streams_ev_out;

Expand Down
6 changes: 5 additions & 1 deletion mod_http2/h2_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,11 @@ apr_status_t h2_session_create(h2_session **psession, conn_rec *c, request_rec *
stream0 = h2_stream_create(0, session->pool, session, NULL, 0);
stream0->c2 = session->c1; /* stream0's connection is the main connection */
session->mplx = h2_mplx_c1_create(stream0, s, session->pool, workers);

if (!session->mplx) {
apr_pool_destroy(pool);
return APR_ENOTIMPL;
}

h2_c1_io_init(&session->io, c, s);
session->padding_max = h2_config_sgeti(s, H2_CONF_PADDING_BITS);
if (session->padding_max) {
Expand Down
2 changes: 1 addition & 1 deletion mod_http2/h2_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* @macro
* Version number of the http2 module as c string
*/
#define MOD_HTTP2_VERSION "2.0.0-rc1-git"
#define MOD_HTTP2_VERSION "2.0.0-rc2-git"

/**
* @macro
Expand Down
2 changes: 1 addition & 1 deletion mod_http2/h2_version.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* @macro
* Version number of the http2 module as c string
*/
#define MOD_HTTP2_VERSION "@PACKAGE_VERSION@-rc1-git"
#define MOD_HTTP2_VERSION "@PACKAGE_VERSION@-rc2-git"

/**
* @macro
Expand Down
33 changes: 32 additions & 1 deletion test/load_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,38 @@ def main(cls):
{"run": 19},
{"run": 20},
],
}
},
"m6": {
"title": "1k files, 1k-10MB, *conn, 10k req ({measure})",
"class": UrlsLoadTest,
"location": "/",
"file_count": 1024,
"file_sizes": [1, 2, 3, 4, 5, 10, 20, 30, 40, 50, 100, 10000],
"requests": 5000,
"warmup": True,
"measure": "req/s",
"protocol": 'h2',
"max_parallel": 6,
"row0_title": "protocol max",
"row_title": "{protocol} {max_parallel:3d}",
"rows": [
{"protocol": 'h2', "max_parallel": 6},
{"protocol": 'h2', "max_parallel": 6},
{"protocol": 'h2', "max_parallel": 6},
{"protocol": 'h2', "max_parallel": 6},
{"protocol": 'h2', "max_parallel": 6},
{"protocol": 'h2', "max_parallel": 6},
],
"col_title": "{clients}c",
"clients": 1,
"columns": [
{"clients": 1, "requests": 1000},
{"clients": 32, "requests": 16000},
{"clients": 64, "requests": 32000},
{"clients": 128, "requests": 64000},
{"clients": 192, "requests": 96000},
],
},
}

env = H2TestEnv()
Expand Down

0 comments on commit 9054273

Please sign in to comment.