From ecb4a208fb70e850a811398edbf0f11d1e81ce4e Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 28 Oct 2015 23:26:41 +0900 Subject: [PATCH] nghttpx: Use ev_feed_event to signal write for HTTP backend It seems that using ev_feed_event to signal write operation is much faster than starting watcher. This is probably due to the fact that we don't need to wait in event loop. The same thing cannot be done in HTTP/2 frontend, since this will raise write operation for each stream HEADER/DATA write, which leads to very small packets, hurting performance. Interestingly, HTTP/1 frontend also suffers the same performance hit. --- src/shrpx_http_downstream_connection.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/shrpx_http_downstream_connection.cc b/src/shrpx_http_downstream_connection.cc index b6e76907..720f5a34 100644 --- a/src/shrpx_http_downstream_connection.cc +++ b/src/shrpx_http_downstream_connection.cc @@ -850,7 +850,9 @@ int HttpDownstreamConnection::on_connect() { void HttpDownstreamConnection::on_upstream_change(Upstream *upstream) {} -void HttpDownstreamConnection::signal_write() { conn_.wlimit.startw(); } +void HttpDownstreamConnection::signal_write() { + ev_feed_event(conn_.loop, &conn_.wev, EV_WRITE); +} size_t HttpDownstreamConnection::get_group() const { return group_; }