set profiling
Enable or disable profiling.
Description
Enable (on) or disable (off) profiling.
This operation is equivalent to setting or clearing the profiling
settings in the global section of the configuration file.
This command enables or disables per-task CPU profiling.
CPU profiling per task reveals where CPU execution time is spent and how requests affect each other. Enabling profiling typically affects overall performance by less than 1%. This feature requires a system supporting the clock_gettime(2)
system call with clock identifiers CLOCK_MONOTONIC
and CLOCK_THREAD_CPUTIME_ID
. Otherwise, the reported time is zero.
Enabling task profiling manually resets scheduler statistics, providing a convenient way to check activity over a given interval.
When per-task CPU profiling is set to auto, profiling automatically initiates a thread when it starts to suffer from an average latency of 1000 microseconds or higher as reported in the avg_loop_us activity field. Profiling automatically turns off when the latency returns below 990 microseconds. This value is an average over the last 1024 loops so it does not vary quickly and tends to significantly smooth short spikes. Profiling may also spontaneously trigger from time to time on overloaded systems, containers, virtual machines, or when the system swaps (which must absolutely never happen on a load balancer).
In general, it is recommended to leave profiling set to the default auto value so that it only operates when a problem is identified.
Examples
Enable per-task CPU profiling:
$ echo "set profiling on" | \
sudo socat stdio unix-connect:/var/run/hapee-2.0/hapee-lb.sock
Enable automatic mode for per-task CPU profiling:
$ echo "set profiling tasks auto" | \
sudo socat stdio unix-connect:/var/run/hapee-2.0/hapee-lb.sock
See also
Next up
set rate-limit connections global