Skip to content

Commit

Permalink
v1.13.0
Browse files Browse the repository at this point in the history
--------------------------------------------------------------------------------
 * mod_proxy_http2: simplifying implementation and reducing memory use by only
   running a single request at the time on a h2 backend connection. The previous
   implementation was just not good enough regarding flow control on the overall
   server and too complex compared to the performance benefits achieved. The goal
   with this change is to establish a solid base from which to optimize things
   again.
 * Fixes slave connection input filter to use proper return code on speculative read
   encountering an EOF.
 * Starting test_600 for mod_proxy_http2 use on server itself
  • Loading branch information
Stefan Eissing committed Feb 26, 2019
1 parent a66453f commit cef12c7
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 362 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
v1.13.0
--------------------------------------------------------------------------------
* mod_proxy_http2: simplifying implementation and reducing memory use by only
running a single request at the time on a h2 backend connection. The previous
implementation was just not good enough regarding flow control on the overall
server and too complex compared to the performance benefits achieved. The goal
with this change is to establish a solid base from which to optimize things
again.
* Fixes slave connection input filter to use proper return code on speculative read
encountering an EOF.
* Starting test_600 for mod_proxy_http2 use on server itself
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#

AC_PREREQ([2.69])
AC_INIT([mod_http2], [1.12.5], [[email protected]])
AC_INIT([mod_http2], [1.13.0], [[email protected]])

LT_PREREQ([2.2.6])
LT_INIT()
Expand Down
48 changes: 1 addition & 47 deletions mod_http2/h2_ngn_shed.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,6 @@ void h2_ngn_shed_abort(h2_ngn_shed *shed)
shed->aborted = 1;
}

static void ngn_add_task(h2_req_engine *ngn, h2_task *task, request_rec *r)
{
h2_ngn_entry *entry = apr_pcalloc(task->pool, sizeof(*entry));
APR_RING_ELEM_INIT(entry, link);
entry->task = task;
entry->r = r;
H2_REQ_ENTRIES_INSERT_TAIL(&ngn->entries, entry);
ngn->no_assigned++;
}


apr_status_t h2_ngn_shed_push_request(h2_ngn_shed *shed, const char *ngn_type,
request_rec *r,
http2_req_engine_init *einit)
Expand All @@ -167,42 +156,7 @@ apr_status_t h2_ngn_shed_push_request(h2_ngn_shed *shed, const char *ngn_type,
ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, shed->c,
"h2_ngn_shed(%ld): PUSHing request (task=%s)", shed->c->id,
task->id);
if (task->request->serialize) {
/* Max compatibility, deny processing of this */
return APR_EOF;
}

if (task->assigned) {
--task->assigned->no_assigned;
--task->assigned->no_live;
task->assigned = NULL;
}

if (task->engine) {
ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, task->c,
"h2_ngn_shed(%ld): push task(%s) hosting engine %s "
"already with %d tasks",
shed->c->id, task->id, task->engine->id,
task->engine->no_assigned);
task->assigned = task->engine;
ngn_add_task(task->engine, task, r);
return APR_SUCCESS;
}

ngn = apr_hash_get(shed->ngns, ngn_type, APR_HASH_KEY_STRING);
if (ngn && !ngn->shutdown) {
/* this task will be processed in another thread,
* freeze any I/O for the time being. */
ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, task->c,
"h2_ngn_shed(%ld): pushing request %s to %s",
shed->c->id, task->id, ngn->id);
if (!h2_task_has_thawed(task)) {
h2_task_freeze(task);
}
ngn_add_task(ngn, task, r);
return APR_SUCCESS;
}


/* no existing engine or being shut down, start a new one */
if (einit) {
apr_status_t status;
Expand Down
47 changes: 1 addition & 46 deletions mod_http2/h2_proxy_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,12 +429,6 @@ static int stream_response_data(nghttp2_session *ngh2, uint8_t flags,
stream_id, NGHTTP2_STREAM_CLOSED);
return NGHTTP2_ERR_STREAM_CLOSING;
}
if (stream->standalone) {
nghttp2_session_consume(ngh2, stream_id, len);
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, stream->r,
"h2_proxy_session(%s): stream %d, win_update %d bytes",
session->id, stream_id, (int)len);
}
return 0;
}

Expand Down Expand Up @@ -641,7 +635,7 @@ h2_proxy_session *h2_proxy_session_setup(const char *id, proxy_conn_rec *p_conn,

nghttp2_option_new(&option);
nghttp2_option_set_peer_max_concurrent_streams(option, 100);
nghttp2_option_set_no_auto_window_update(option, 1);
nghttp2_option_set_no_auto_window_update(option, 0);

nghttp2_session_client_new2(&session->ngh2, cbs, session, option);

Expand Down Expand Up @@ -1545,42 +1539,3 @@ typedef struct {
int updated;
} win_update_ctx;

static int win_update_iter(void *udata, void *val)
{
win_update_ctx *ctx = udata;
h2_proxy_stream *stream = val;

if (stream->r && stream->r->connection == ctx->c) {
ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, ctx->session->c,
"h2_proxy_session(%s-%d): win_update %ld bytes",
ctx->session->id, (int)stream->id, (long)ctx->bytes);
nghttp2_session_consume(ctx->session->ngh2, stream->id, ctx->bytes);
ctx->updated = 1;
return 0;
}
return 1;
}


void h2_proxy_session_update_window(h2_proxy_session *session,
conn_rec *c, apr_off_t bytes)
{
if (!h2_proxy_ihash_empty(session->streams)) {
win_update_ctx ctx;
ctx.session = session;
ctx.c = c;
ctx.bytes = bytes;
ctx.updated = 0;
h2_proxy_ihash_iter(session->streams, win_update_iter, &ctx);

if (!ctx.updated) {
/* could not find the stream any more, possibly closed, update
* the connection window at least */
ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, session->c,
"h2_proxy_session(%s): win_update conn %ld bytes",
session->id, (long)bytes);
nghttp2_session_consume_connection(session->ngh2, (size_t)bytes);
}
}
}

3 changes: 0 additions & 3 deletions mod_http2/h2_proxy_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ void h2_proxy_session_cancel_all(h2_proxy_session *s);

void h2_proxy_session_cleanup(h2_proxy_session *s, h2_proxy_request_done *done);

void h2_proxy_session_update_window(h2_proxy_session *s,
conn_rec *c, apr_off_t bytes);

#define H2_PROXY_REQ_URL_NOTE "h2-proxy-req-url"

#endif /* h2_proxy_session_h */
4 changes: 2 additions & 2 deletions mod_http2/h2_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
* @macro
* Version number of the http2 module as c string
*/
#define MOD_HTTP2_VERSION "1.12.5-git"
#define MOD_HTTP2_VERSION "1.13.0-git"

/**
* @macro
* Numerical representation of the version number of the http2 module
* release. This is a 24 bit number with 8 bits for major number, 8 bits
* for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
*/
#define MOD_HTTP2_VERSION_NUM 0x010c05
#define MOD_HTTP2_VERSION_NUM 0x010d00


#endif /* mod_h2_h2_version_h */
Loading

0 comments on commit cef12c7

Please sign in to comment.