summaryrefslogtreecommitdiff
path: root/proxy_lua.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2023-02-21 12:54:07 -0800
committerdormando <dormando@rydia.net>2023-02-22 11:12:51 -0800
commit833a7234bbaed264a9973141850a23df4eb1b939 (patch)
tree2b3c49440e923cef1f157085031387b86c51e7f0 /proxy_lua.c
parentaf037c38cda6d9a07e82d0386202aa3c9d08faea (diff)
downloadmemcached-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_lua.c')
-rw-r--r--proxy_lua.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/proxy_lua.c b/proxy_lua.c
index 2d38b8e..e6b50ae 100644
--- a/proxy_lua.c
+++ b/proxy_lua.c
@@ -337,7 +337,9 @@ static mcp_backend_wrap_t *_mcplib_make_backendconn(lua_State *L, mcp_backend_la
}
// initialize libevent.
- memset(&be->event, 0, sizeof(be->event));
+ memset(&be->main_event, 0, sizeof(be->main_event));
+ memset(&be->write_event, 0, sizeof(be->write_event));
+ memset(&be->timeout_event, 0, sizeof(be->timeout_event));
// initialize the client
be->client = malloc(mcmc_size(MCMC_OPTION_BLANK));