[Answering to myself after a bit of research, it might be useful for newcomers like me]
2016-05-14 11:49 GMT+02:00 Luca Toscano <toscano.l...@gmail.com>: > Hi Eric, > > Other trivial questions from non experts like me: > > 2016-05-13 15:29 GMT+02:00 Eric Covener <cove...@gmail.com>: > >> On Fri, May 13, 2016 at 4:33 AM, Luca Toscano <toscano.l...@gmail.com> >> wrote: >> > - What does PT_USER represents and how it is used? >> >> PT_USER is what event tracks when you call >> event_register_poll_callback(). This callback >> allows a module to run some code when either of a pair of sockets >> becomes readable or writable. >> > > It is still a bit unclear to me who calls this callback, that should be > executed when ap_run_mpm_register_poll_callback is run, but I can't find > it anywhere (as I can do for other hooks). I know that event is the only > one supporting it reading from the code's comments, but I can't really > figure out why. Probably this is a trivial question due to my doubts with > httpd's core :) > I was approaching the problem from the wrong angle, a better one might be starting from mod_dialup.c in the 2.4.x branch; precisely all the invocations of ap_mpm_register_timed_callback. The function is declared in mpm_common and does a very basic thing, namely calling ap_run_mpm_register_timed_callback that executes the hook's machinery. Who is registered to the hook? Check the following in event.c: ap_hook_mpm_register_timed_callback(event_register_timed_callback, NULL, NULL, APR_HOOK_MIDDLE); And the callback, event_register_timed_callback, inserts a timer in the skiplist. So the hook is basically executed by the modules interested in adding a custom timer to event, and it works only with this MPM since it is the only one that registers a callback for the hook. Eric I know that you tried to explain the same thing to me but I was missing some steps and I didn't get it straight away :) > > Other trivial question: is the skiplist used only for events/timers > related to modules hooking to mpm_register_timed_callback? If so my > original understanding of it is wrong, because I thought that it was used > also to peek/pop/insert timers for the timeout queues (keep alives, > lingering closes and write completion). > IIUC the answer to the skiplist question is yes, since keep alives / lingering closes / write completion are all handled by separate (non skiplist) queues (timeout_queue and the function process_timeout_queue). > > Any idea about how to tune the 100ms sleep time? It might be a good > improvement for event! > > This is still an open question for me. Again, IIUC all the listener threads wait (most of the time) 100ms during their apr_pollset_poll, to be able to check frequently all the various timers that need to be honored (the ones in the timeout_queue(s) and skiplist). While I don't see a huge waste in resources in the listener behavior, https://bz.apache.org/bugzilla/show_bug.cgi?id=57399 shows a good point: event could be a bit more efficient. I really hope that Stefan's parallel thread will re-gain a bit of traction, the idea of dropping mod_http2's thread pools to leverage completely event looks very promising. Sorry again for the extra email, hope that this will help people with too many questions like me :) Luca