Hi Apache devs, I have some questions about how mpm-event uses timers. If I understood correctly the code, there are two main things that the listener thread cares about:
- timeout_queue(s), that represents connections waiting for completion, keep alive or in lingering close. - timer_skiplist, that sorts timers for the above queues in an efficient way (this is of course a very inaccurate and simplistic description). My understanding is that the listener thread, using apr_pollset_poll, will react on new connection requests plus all events related to the timeout_queues. It also sleeps a maximum of 0.1s anyway to be able to check the skiplist and update sockets that have an expired timeout (for example, when a connection doesn't send any new data for more than KeepAliveTimeout). Now the questions (if what I've said is vaguely true): - What does PT_USER represents and how it is used? - How is a new timer inserted in the skiplist? I followed the code and the only "insert" actions that I can see are triggered by event_get_timer_event, that is used for PT_USER events and by the function hooked to mpm_register_timed_callback (I can see it declared in mpm_common but no idea about how/when it runs). There are also some peek/pop actions executed before apr_pollset_poll but no trace of inserts. I know that those are very generic questions so even some hints would be really appreciated. I have some goals in mind: 1) Add an overview in https://httpd.apache.org/docs/current/mod/event.html (maybe adding a definitive answer to https://bz.apache.org/bugzilla/show_bug.cgi?id=57399) 2) Create infographics (or even simple images) about prefork/worker/event (and motorz?) to compare them in a "under the hood" section of the documentation. 3) Complete http://httpd.apache.org/docs/current/misc/perf-tuning.html. Thanks in advance! Regards, Luca