diff options
author | dormando <dormando@rydia.net> | 2023-03-04 21:50:28 -0800 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2023-03-26 16:48:37 -0700 |
commit | 6c80728209acdb46629db8db3868d59d627ec33e (patch) | |
tree | 1628e77e962c0b0037ab225a444828d99ae3b8a5 /memcached.h | |
parent | e0fa1fe46aeb9e405cb58234f6016b2c48a10777 (diff) | |
download | memcached-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 'memcached.h')
-rw-r--r-- | memcached.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/memcached.h b/memcached.h index 68d0ab0..ba3544d 100644 --- a/memcached.h +++ b/memcached.h @@ -725,6 +725,10 @@ typedef struct { void *proxy_user_stats; void *proxy_int_stats; void *proxy_event_thread; // worker threads can also be proxy IO threads + pthread_mutex_t proxy_limit_lock; + uint64_t proxy_active_req_limit; + uint64_t proxy_buffer_memory_limit; // protected by limit_lock + uint64_t proxy_buffer_memory_used; // protected by limit_lock uint32_t proxy_rng[4]; // fast per-thread rng for lua. // TODO: add ctx object so we can attach to queue. #endif |