httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luca Toscano <>
Subject Re: Timers and mpm-event
Date Sat, 14 May 2016 09:49:22 GMT
Hi Eric,

Other trivial questions from non experts like me:

2016-05-13 15:29 GMT+02:00 Eric Covener <>:

> On Fri, May 13, 2016 at 4:33 AM, Luca Toscano <>
> 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 :)

> It was written to allow mod_proxy_wstunnel to not tie up a thread when
> both ends of the connection
> are idle.
> Note that it is still trunk-only.

Got that, 2.4.x looks simpler, I'll check it.

> > - 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.
> It is via the insert in event_get_timer_event()
> PT_USER uses the timer part to implement a timeout callback on waiting for
> the
> sockets to become usable.    it was added as a proof of concept, IIUC,
> for mod_dialup to
> help demonstrate async handlers (give the thread back by returning
> SUSPENDED and run again later
> by being called back after some time

> > 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
> > documentation.
> It might be good to separate design details from the reference manual
> so users are not overwhelmed

+1, my idea is only to add a little section to inform the users about this
behavior, then to explain it in detail in other separate docs. Don't want
to overwhelm but at the same time it is good to have quick references for
the admins that are curious about internals (without forcing them to read
the code that is a bit hard for whoever is not used to it).

> > 3) Complete
> There is a PR or other kind of complaint about the hard-coded 100ms
> sleep time even when no timers may be in use.  Since timers
> are not used by common modules, it should be possible to improve this.

This one right?

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).

Any idea about how to tune the 100ms sleep time? It might be a good
improvement for event!

Thanks for the patience, eventually I'll stop making these kind of
questions! Takes a bit of time to grasp the http's core and I am too
curious :)



Ps: Thanks Stefan for hijacking the thread, really useful and interesting
stuff! (hope that I'll fully understand them after this email thread)

View raw message