mirror of
https://github.com/KumoCorp/kumomta.git
synced 2026-09-09 00:01:01 +00:00
As much as I'd love for tokio to be magic and figure everything out, it doesn't and cannot do that. In any complex system it is important to be able to control and provision the various stages so that a certain QoS is met. This commit expands the use of the various thread pools, and adjusts them from always spawning num-cpus to a more balanced set of sizes, so that not everything is competing with everything. These sizes are configurable via env vars, but a preferably configured during the `init` event via a handful of new lua functions that must be called very early on. More docs on these will appear in a later commit. The default pool sizes are a function of the number of cores, and are intended to balance receiving and sending functions such that a throughput test should run without any significant build up of the scheduled queue. This commit also exposes the sizes of the thread pools and the number of parked (idle) threads via prometheus.