summaryrefslogtreecommitdiff
path: root/proxy_await.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2023-03-04 21:50:28 -0800
committerdormando <dormando@rydia.net>2023-03-26 16:48:37 -0700
commit6c80728209acdb46629db8db3868d59d627ec33e (patch)
tree1628e77e962c0b0037ab225a444828d99ae3b8a5 /proxy_await.c
parente0fa1fe46aeb9e405cb58234f6016b2c48a10777 (diff)
downloadmemcached-6c80728209acdb46629db8db3868d59d627ec33e.tar.gz
proxy: add request and buffer memory limits
Adds: mcp.active_req_limit(count) mcp.buffer_memory_limit(kilobytes) Divides by the number of worker threads and creates a per-worker-thread limit for the number of concurrent proxy requests, and how many bytes used specifically for value bytes. This does not represent total memory usage but will be close. Buffer memory for inbound set requests is not accounted for until after the object has been read from the socket; to be improved in a future update. This should be fine unless clients send just the SET request and then hang without sending further data. Limits should be live-adjustable via configuration reloads.
Diffstat (limited to 'proxy_await.c')
-rw-r--r--proxy_await.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/proxy_await.c b/proxy_await.c
index d5e40d3..12a8546 100644
--- a/proxy_await.c
+++ b/proxy_await.c
@@ -121,6 +121,8 @@ static void mcp_queue_await_io(conn *c, lua_State *Lc, mcp_request_t *rq, int aw
// reserve one uservalue for a lua-supplied response.
mcp_resp_t *r = lua_newuserdatauv(Lc, sizeof(mcp_resp_t), 1);
memset(r, 0, sizeof(mcp_resp_t));
+ r->thread = c->thread;
+ assert(r->thread != NULL);
gettimeofday(&r->start, NULL);
// Set noreply mode.
// TODO (v2): the response "inherits" the request's noreply mode, which isn't