\page backpressure Queue Back-Pressure Controls
The global asynchronous task executor backs loggers that use the default
executor and can be tuned to handle high-load bursts. Some backends are
synchronous, while configured dedicated executors and OTLP maintain their own
queues. Use the following helpers from
<logit.hpp> when preparing stress tests or long-running services:
LOGIT_SET_MAX_QUEUE(size)sets the maximum number of queued tasks. Use a smallsizeto emulate a constrained environment or0to remove the bound completely.LOGIT_SET_QUEUE_POLICY(mode)switches the overflow strategy. Available options areLOGIT_QUEUE_BLOCK,LOGIT_QUEUE_DROP_NEWEST, andLOGIT_QUEUE_DROP_OLDEST.LOGIT_GET_DROPPED_TASKS()returns the number of tasks that were discarded under the current configuration. The value is safe to read concurrently with producers.LOGIT_RESET_DROPPED_TASKS()clears the drop counter. Call it between scenarios so each run measures its own losses.
The drop counter is maintained inside the executor and is updated every time a
publishing policy decides to discard work. Combining the counter with
TaskExecutor::wait() makes it easy to assert the expected throughput for each
policy without inspecting private state.
These global controls affect the shared TaskExecutor only. A backend with
Config::use_dedicated_executor=true has its own capacity and policy, and
OTLP uses its exporter queue settings. After finishing a burst test remember
to restore the shared capacity or shut down the logging subsystem with
LOGIT_WAIT() and LOGIT_SHUTDOWN() to avoid interfering with other scenarios.