httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luca Toscano <>
Subject Timers and mpm-event
Date Fri, 13 May 2016 11:33:03 GMT
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
(maybe adding a definitive answer to
2) Create infographics (or even simple images) about prefork/worker/event
(and motorz?) to compare them in a "under the hood" section of the
3) Complete

Thanks in advance!



View raw message