diff options
author | dormando <dormando@rydia.net> | 2023-02-21 12:54:07 -0800 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2023-02-22 11:12:51 -0800 |
commit | 833a7234bbaed264a9973141850a23df4eb1b939 (patch) | |
tree | 2b3c49440e923cef1f157085031387b86c51e7f0 /proxy.h | |
parent | af037c38cda6d9a07e82d0386202aa3c9d08faea (diff) | |
download | memcached-833a7234bbaed264a9973141850a23df4eb1b939.tar.gz |
proxy: redo libevent handling code
The event handling code was unoptimized and temporary; it was slated for
a rewrite for performance and non-critical bugs alone. However the old
code may be causing critical bugs so it's being rewritten now.
Fixes:
- backend disconnects are detected immediately instead of on the next
time they are used.
- backend reconnects happen _after_ the retry timeout, not before
- use a persistent read handler and a temporary write handler to avoid
constantly calling epoll_ctl syscalls for potential performance boost.
Updated some tests for proxyconfig.t as it was picking up the
disconnects immediately.
Unrelated to a timing issue I resolved to the benchmark.
Diffstat (limited to 'proxy.h')
-rw-r--r-- | proxy.h | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -323,7 +323,8 @@ struct mcp_backend_wrap_s { // FIXME: inline the mcmc client data. // TODO: event_thread -> something? union of owner type? struct mcp_backend_s { - int depth; + int depth; // total number of requests in queue + int pending_read; // number of requests written to socket, pending read. int failed_count; // number of fails (timeouts) in a row proxy_event_thread_t *event_thread; // event thread owning this backend. void *client; // mcmc client @@ -333,7 +334,9 @@ struct mcp_backend_s { io_pending_proxy_t *io_next; // next request to write. char *rbuf; // statically allocated read buffer. size_t rbufused; // currently active bytes in the buffer - struct event event; // libevent + struct event main_event; // libevent: changes role, mostly for main read events + struct event write_event; // libevent: only used when socket wbuf full + struct event timeout_event; // libevent: alarm for pending reads struct proxy_tunables tunables; #ifdef HAVE_LIBURING proxy_event_t ur_rd_ev; // liburing. |