mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-03-31 23:58:16 +00:00
MINOR: raw_sock: make sure to disable polling once everything is sent
Analysing traces revealed a rare but surprizing pattern : connect() = -1 EAGAIN send() = success epoll_ctl(ADD, EPOLLOUT) epoll_wait() recvfrom() = success close() What happens is that the failed connect() creates an FD update for pollout, but the successful synchronous send() doesn't disable it because polling was only disabled in the FD handler. But a successful synchronous connect() cancellation is a good opportunity to disable polling before it's effectively enabled in the next loop, so better disable it when reaching the end. The cost is very low if it was already disabled anyway (one atomic op). This only affects local connections but with this the typical number of epoll_ctl() calls per connection dropped from ~4.2 to ~3.8 for plain TCP and 10k transfers.
This commit is contained in:
parent
0eae6323bf
commit
08fa16e397
@ -378,6 +378,8 @@ static size_t raw_sock_from_buf(struct connection *conn, void *xprt_ctx, const s
|
||||
/* if the system buffer is full, don't insist */
|
||||
if (ret < try)
|
||||
break;
|
||||
if (!count)
|
||||
fd_stop_send(conn->handle.fd);
|
||||
}
|
||||
else if (ret == 0 || errno == EAGAIN || errno == ENOTCONN || errno == EINPROGRESS) {
|
||||
/* nothing written, we need to poll for write first */
|
||||
|
Loading…
Reference in New Issue
Block a user