Mercurial > hg > nginx
comparison src/http/v2/ngx_http_v2_module.c @ 7772:f790816a0e87
HTTP/2: removed http2_idle_timeout and http2_max_requests.
Instead, keepalive_timeout and keepalive_requests are now used. This
is expected to simplify HTTP/2 code and usage. This also matches
directives used by upstream module for all protocols.
In case of default settings, this effectively changes maximum number
of requests per connection from 1000 to 100. This looks acceptable,
especially given that HTTP/2 code now properly supports lingering close.
Further, this changes default keepalive timeout in HTTP/2 from 300 seconds
to 75 seconds. This also looks acceptable, and larger than PING interval
used by Firefox (network.http.spdy.ping-threshold defaults to 58s),
the only browser to use PINGs.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 11 Feb 2021 21:52:23 +0300 |
parents | 02be1baed382 |
children | 827202ca1269 |
comparison
equal
deleted
inserted
replaced
7771:02be1baed382 | 7772:f790816a0e87 |
---|---|
40 void *conf); | 40 void *conf); |
41 | 41 |
42 | 42 |
43 static ngx_conf_deprecated_t ngx_http_v2_recv_timeout_deprecated = { | 43 static ngx_conf_deprecated_t ngx_http_v2_recv_timeout_deprecated = { |
44 ngx_conf_deprecated, "http2_recv_timeout", "client_header_timeout" | 44 ngx_conf_deprecated, "http2_recv_timeout", "client_header_timeout" |
45 }; | |
46 | |
47 static ngx_conf_deprecated_t ngx_http_v2_idle_timeout_deprecated = { | |
48 ngx_conf_deprecated, "http2_idle_timeout", "keepalive_timeout" | |
49 }; | |
50 | |
51 static ngx_conf_deprecated_t ngx_http_v2_max_requests_deprecated = { | |
52 ngx_conf_deprecated, "http2_max_requests", "keepalive_requests" | |
45 }; | 53 }; |
46 | 54 |
47 | 55 |
48 static ngx_conf_post_t ngx_http_v2_recv_buffer_size_post = | 56 static ngx_conf_post_t ngx_http_v2_recv_buffer_size_post = |
49 { ngx_http_v2_recv_buffer_size }; | 57 { ngx_http_v2_recv_buffer_size }; |
87 offsetof(ngx_http_v2_srv_conf_t, concurrent_pushes), | 95 offsetof(ngx_http_v2_srv_conf_t, concurrent_pushes), |
88 NULL }, | 96 NULL }, |
89 | 97 |
90 { ngx_string("http2_max_requests"), | 98 { ngx_string("http2_max_requests"), |
91 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, | 99 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, |
92 ngx_conf_set_num_slot, | 100 ngx_http_v2_obsolete, |
93 NGX_HTTP_SRV_CONF_OFFSET, | 101 0, |
94 offsetof(ngx_http_v2_srv_conf_t, max_requests), | 102 0, |
95 NULL }, | 103 &ngx_http_v2_max_requests_deprecated }, |
96 | 104 |
97 { ngx_string("http2_max_field_size"), | 105 { ngx_string("http2_max_field_size"), |
98 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, | 106 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, |
99 ngx_conf_set_size_slot, | 107 ngx_conf_set_size_slot, |
100 NGX_HTTP_SRV_CONF_OFFSET, | 108 NGX_HTTP_SRV_CONF_OFFSET, |
129 0, | 137 0, |
130 &ngx_http_v2_recv_timeout_deprecated }, | 138 &ngx_http_v2_recv_timeout_deprecated }, |
131 | 139 |
132 { ngx_string("http2_idle_timeout"), | 140 { ngx_string("http2_idle_timeout"), |
133 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, | 141 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, |
134 ngx_conf_set_msec_slot, | 142 ngx_http_v2_obsolete, |
135 NGX_HTTP_SRV_CONF_OFFSET, | 143 0, |
136 offsetof(ngx_http_v2_srv_conf_t, idle_timeout), | 144 0, |
137 NULL }, | 145 &ngx_http_v2_idle_timeout_deprecated }, |
138 | 146 |
139 { ngx_string("http2_chunk_size"), | 147 { ngx_string("http2_chunk_size"), |
140 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | 148 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
141 ngx_conf_set_size_slot, | 149 ngx_conf_set_size_slot, |
142 NGX_HTTP_LOC_CONF_OFFSET, | 150 NGX_HTTP_LOC_CONF_OFFSET, |
300 | 308 |
301 h2scf->pool_size = NGX_CONF_UNSET_SIZE; | 309 h2scf->pool_size = NGX_CONF_UNSET_SIZE; |
302 | 310 |
303 h2scf->concurrent_streams = NGX_CONF_UNSET_UINT; | 311 h2scf->concurrent_streams = NGX_CONF_UNSET_UINT; |
304 h2scf->concurrent_pushes = NGX_CONF_UNSET_UINT; | 312 h2scf->concurrent_pushes = NGX_CONF_UNSET_UINT; |
305 h2scf->max_requests = NGX_CONF_UNSET_UINT; | |
306 | 313 |
307 h2scf->max_field_size = NGX_CONF_UNSET_SIZE; | 314 h2scf->max_field_size = NGX_CONF_UNSET_SIZE; |
308 h2scf->max_header_size = NGX_CONF_UNSET_SIZE; | 315 h2scf->max_header_size = NGX_CONF_UNSET_SIZE; |
309 | 316 |
310 h2scf->preread_size = NGX_CONF_UNSET_SIZE; | 317 h2scf->preread_size = NGX_CONF_UNSET_SIZE; |
311 | 318 |
312 h2scf->streams_index_mask = NGX_CONF_UNSET_UINT; | 319 h2scf->streams_index_mask = NGX_CONF_UNSET_UINT; |
313 | |
314 h2scf->idle_timeout = NGX_CONF_UNSET_MSEC; | |
315 | 320 |
316 return h2scf; | 321 return h2scf; |
317 } | 322 } |
318 | 323 |
319 | 324 |
327 | 332 |
328 ngx_conf_merge_uint_value(conf->concurrent_streams, | 333 ngx_conf_merge_uint_value(conf->concurrent_streams, |
329 prev->concurrent_streams, 128); | 334 prev->concurrent_streams, 128); |
330 ngx_conf_merge_uint_value(conf->concurrent_pushes, | 335 ngx_conf_merge_uint_value(conf->concurrent_pushes, |
331 prev->concurrent_pushes, 10); | 336 prev->concurrent_pushes, 10); |
332 ngx_conf_merge_uint_value(conf->max_requests, prev->max_requests, 1000); | |
333 | 337 |
334 ngx_conf_merge_size_value(conf->max_field_size, prev->max_field_size, | 338 ngx_conf_merge_size_value(conf->max_field_size, prev->max_field_size, |
335 4096); | 339 4096); |
336 ngx_conf_merge_size_value(conf->max_header_size, prev->max_header_size, | 340 ngx_conf_merge_size_value(conf->max_header_size, prev->max_header_size, |
337 16384); | 341 16384); |
338 | 342 |
339 ngx_conf_merge_size_value(conf->preread_size, prev->preread_size, 65536); | 343 ngx_conf_merge_size_value(conf->preread_size, prev->preread_size, 65536); |
340 | 344 |
341 ngx_conf_merge_uint_value(conf->streams_index_mask, | 345 ngx_conf_merge_uint_value(conf->streams_index_mask, |
342 prev->streams_index_mask, 32 - 1); | 346 prev->streams_index_mask, 32 - 1); |
343 | |
344 ngx_conf_merge_msec_value(conf->idle_timeout, | |
345 prev->idle_timeout, 180000); | |
346 | 347 |
347 return NGX_CONF_OK; | 348 return NGX_CONF_OK; |
348 } | 349 } |
349 | 350 |
350 | 351 |