[nginx] Switched to using posted next events after sendfile_max_chunk.
Maxim Dounin
mdounin at mdounin.ru
Fri Oct 29 20:20:16 UTC 2021
details: https://hg.nginx.org/nginx/rev/61e9c078ee3d
branches:
changeset: 7946:61e9c078ee3d
user: Maxim Dounin <mdounin at mdounin.ru>
date: Fri Oct 29 20:21:43 2021 +0300
description:
Switched to using posted next events after sendfile_max_chunk.
Previously, 1 millisecond delay was used instead. In certain edge cases
this might result in noticeable performance degradation though, notably on
Linux with typical CONFIG_HZ=250 (so 1ms delay becomes 4ms),
sendfile_max_chunk 2m, and link speed above 2.5 Gbps.
Using posted next events removes the artificial delay and makes processing
fast in all cases.
diffstat:
src/http/ngx_http_write_filter_module.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diffs (13 lines):
diff -r f17ba8ecaaf0 -r 61e9c078ee3d src/http/ngx_http_write_filter_module.c
--- a/src/http/ngx_http_write_filter_module.c Thu Oct 28 14:14:25 2021 +0300
+++ b/src/http/ngx_http_write_filter_module.c Fri Oct 29 20:21:43 2021 +0300
@@ -331,8 +331,7 @@ ngx_http_write_filter(ngx_http_request_t
&& c->write->ready
&& c->sent - sent >= limit - (off_t) (2 * ngx_pagesize))
{
- c->write->delayed = 1;
- ngx_add_timer(c->write, 1);
+ ngx_post_event(c->write, &ngx_posted_next_events);
}
for (cl = r->out; cl && cl != chain; /* void */) {
More information about the nginx-devel
mailing list