From f6f45246807e110b43c2bc2733a87a3a474c175e Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 2 Jan 2014 18:42:50 +0100 Subject: OPTIM: try to start sending the response before polling This completely eliminates the need for epoll_ctl() on short responses, increasing the overall performance by about 1%. --- httpterm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/httpterm.c b/httpterm.c index ceade7f..f13d615 100644 --- a/httpterm.c +++ b/httpterm.c @@ -2222,6 +2222,9 @@ static inline void srv_return_page(struct session *t) { t->rep->r += hlen; } t->req->l = 0; + + if (event_cli_write(t->cli_fd) < 0) + FD_SET(t->cli_fd, StaticWriteEvent); } @@ -2468,7 +2471,6 @@ int process_cli(struct session *t) { tv_eternity(&t->cnexpire); /* Note: we also want to drain data */ - FD_SET(t->cli_fd, StaticWriteEvent); FD_SET(t->cli_fd, StaticReadEvent); req->lr = req->r = req->data; req->l = 0; -- 1.7.12.1