summaryrefslogtreecommitdiff
path: root/proxy_config.c
Commit message (Collapse)AuthorAgeFilesLines
* proxy: fix config_routes numeric table copydormando2023-05-071-3/+3
| | | | | | | | | | | | | If the table returned from config_pools had numeric keys it would fail to copy them into config_routes properly. Without patch: Failed to execute mcp_config_routes: t/config.lua:9: attempt to concatenate a nil value (field 'integer index') function mcp_config_routes() return { [1] = "val" } end
* proxy: print lua error on reload failuredormando2023-04-031-1/+1
| | | | | | | When failing to run mcp_config_routes on a worker thread, we were eating the lua error message. This is now consistent with the rest of the code.
* proxy: add request and buffer memory limitsdormando2023-03-261-0/+7
| | | | | | | | | | | | | | | | | | 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.
* proxy: allow workers to run IO optionallydormando2023-02-241-6/+42
| | | | | | | | | | | | | | | | | `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.
* proxy: fix lifecycle of backend connectionsdormando2022-12-121-0/+5
| | | | | | | | | | | | | | | | | | A backend's connection object is technically owned by the IO thread after it has been created. An error in how this was done lead to invalid backends being infinitely retried despite the underlying object being collected. This change adds an extra indirection to backend objects: a backend_wrap object, which just turns the backend connection into an arbitrary pointer instead of lua memory owned by the config VM. - When backend connections are created, this pointer is shipped to the IO thread to have its connection instantiated. - When the wrap object is garbage collected (ie; no longer referenced by any pool object), the be conn. pointer is again shipped to the IO thread, which then removes any pending events, closes the sock, and frees data.
* core: give threads unique namesdormando2022-11-011-1/+3
| | | | | allow users to differentiate thread functions externally to memcached. Useful for setting priorities or pinning threads to CPU's.
* proxy: remove most references to settings globaldormando2022-09-151-3/+2
| | | | should make isolation/testing earlier.
* proxy: allow booleans in pool structuredormando2022-08-171-0/+3
| | | | | | the return value passed from mcp_config_pools() is adjusted and copied into the worker VM's so the types are limited. This adds the boolean type to allowable list.
* proxy: pull chunks into individual c filesdormando2022-02-181-0/+421
now's a good time to at least shove functional subsections of code into their own files. Some further work to clearly separate the API's will help but looks not too terrible. Big bonus is getting the backend handling code away from the frontend handling code, which should make it easier to follow.