From 6442017c545a2a5ad076697b8695cd64bd32b542 Mon Sep 17 00:00:00 2001 From: dormando Date: Fri, 13 Jan 2023 15:22:26 -0800 Subject: proxy: allow workers to run IO optionally `mcp.pool(p, { dist = etc, iothread = true }` By default the IO thread is not used; instead a backend connection is created for each worker thread. This can be overridden by setting `iothread = true` when creating a pool. `mcp.pool(p, { dist = etc, beprefix = "etc" }` If a `beprefix` is added to pool arguments, it will create unique backend connections for this pool. This allows you to create multiple sockets per backend by making multiple pools with unique prefixes. There are legitimate use cases for sharing backend connections across different pools, which is why that is the default behavior. --- memcached.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'memcached.h') diff --git a/memcached.h b/memcached.h index 4790c75..79b9a81 100644 --- a/memcached.h +++ b/memcached.h @@ -703,6 +703,7 @@ typedef struct { int notify_send_fd; /* sending end of notify pipe */ #endif int cur_sfd; /* client fd for logging commands */ + int thread_baseid; /* which "number" thread this is for data offsets */ struct thread_stats stats; /* Stats generated by this thread */ io_queue_cb_t io_queues[IO_QUEUE_COUNT]; struct conn_queue *ev_queue; /* Worker/conn event queue */ @@ -723,6 +724,7 @@ typedef struct { void *proxy_hooks; void *proxy_user_stats; void *proxy_int_stats; + void *proxy_event_thread; // worker threads can also be proxy IO threads uint32_t proxy_rng[4]; // fast per-thread rng for lua. // TODO: add ctx object so we can attach to queue. #endif -- cgit v1.2.1