comparison src/http/ngx_http_write_filter_module.c @ 7946:61e9c078ee3d

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 29 Oct 2021 20:21:43 +0300
parents c19ca381b2e6
children 51a260276425
comparison
equal deleted inserted replaced
7945:f17ba8ecaaf0 7946:61e9c078ee3d
329 329
330 if (limit 330 if (limit
331 && c->write->ready 331 && c->write->ready
332 && c->sent - sent >= limit - (off_t) (2 * ngx_pagesize)) 332 && c->sent - sent >= limit - (off_t) (2 * ngx_pagesize))
333 { 333 {
334 c->write->delayed = 1; 334 ngx_post_event(c->write, &ngx_posted_next_events);
335 ngx_add_timer(c->write, 1);
336 } 335 }
337 336
338 for (cl = r->out; cl && cl != chain; /* void */) { 337 for (cl = r->out; cl && cl != chain; /* void */) {
339 ln = cl; 338 ln = cl;
340 cl = cl->next; 339 cl = cl->next;