MINOR: h2: expose tune.h2.max-concurrent-streams to limit the number of streams

This will be advertised in the settings frame.
This commit is contained in:
Willy Tarreau 2017-07-27 11:47:28 +02:00
parent e6baec0e23
commit 5242ef8095
2 changed files with 28 additions and 0 deletions

View File

@ -601,6 +601,7 @@ The following keywords are supported in the "global" section :
- tune.comp.maxlevel
- tune.h2.header-table-size
- tune.h2.initial-window-size
- tune.h2.max-concurrent-streams
- tune.http.cookielen
- tune.http.logurilen
- tune.http.maxhdr
@ -1386,6 +1387,15 @@ tune.h2.initial-window-size <number>
faster uploads, or to reduce it to increase fairness when dealing with many
clients. It doesn't affect resource usage.
tune.h2.max-concurrent-streams <number>
Sets the HTTP/2 maximum number of concurrent streams per connection (ie the
number of outstanding requests on a single connection). The default value is
100. A larger one may slightly improve page load time for complex sites when
visited over high latency networks, but increases the amount of resources a
single client may allocate. A value of zero disables the limit so a single
client may create as many streams as allocatable by haproxy. It is highly
recommended not to change this value.
tune.http.cookielen <number>
Sets the maximum length of captured cookies. This is the maximum value that
the "capture cookie xxx len yyy" will be allowed to take, and any upper value

View File

@ -19,6 +19,7 @@
/* a few settings from the global section */
static int h2_settings_header_table_size = 4096; /* initial value */
static int h2_settings_initial_window_size = 65535; /* initial value */
static int h2_settings_max_concurrent_streams = 100;
/*****************************************************************/
@ -163,6 +164,22 @@ static int h2_parse_initial_window_size(char **args, int section_type, struct pr
return 0;
}
/* config parser for global "tune.h2.max-concurrent-streams" */
static int h2_parse_max_concurrent_streams(char **args, int section_type, struct proxy *curpx,
struct proxy *defpx, const char *file, int line,
char **err)
{
if (too_many_args(1, args, err, NULL))
return -1;
h2_settings_max_concurrent_streams = atoi(args[1]);
if (h2_settings_max_concurrent_streams < 0) {
memprintf(err, "'%s' expects a positive numeric value.", args[0]);
return -1;
}
return 0;
}
/****************************************/
/* MUX initialization and instanciation */
@ -193,6 +210,7 @@ static struct alpn_mux_list alpn_mux_h2 =
static struct cfg_kw_list cfg_kws = {ILH, {
{ CFG_GLOBAL, "tune.h2.header-table-size", h2_parse_header_table_size },
{ CFG_GLOBAL, "tune.h2.initial-window-size", h2_parse_initial_window_size },
{ CFG_GLOBAL, "tune.h2.max-concurrent-streams", h2_parse_max_concurrent_streams },
{ 0, NULL, NULL }
}};