http_dyn_workers.pl -- Dynamically schedule HTTP workers.
Most code doesn't need to use this directly; instead use library(http/http_server), which combines this library with the typical HTTP libraries that most servers need.
This module defines hooks into the HTTP framework to dynamically schedule worker threads. Dynamic scheduling relieves us from finding a good value for the size of the HTTP worker pool.
The decision to add a worker follows these rules:
- If the load average caused by the worker threads exceeds http:max_load, no worker is added.
- Wait for some time, depending on how close we are to the
- If the worker is still needed, add it.
The policy depends on three settings:
- The maximum number of workers that will be created. Default is 100.
- The number of seconds a dynamic worker waits for a new job. If no job arrives in time it terminates. Default is 10 seconds.
- Max load average created by the HTTP server, i.e. the amount of CPU time consumed per second. Default is 10.
- Called if there is no immediately free worker to handle the
incomming request. The request is forwarded to the thread
__http_scheduleras the hook is called in time critical code.