Apache worker: long-polling?


Well-known member
In the official "What's Next/XF2.0" thread, Kier wrote,
I'd love to do this, but how many XenForo customers do you suppose have access to the necessary long-polling webserver? Trying to achieve it with Apache or similar would have apocalyptically bad consequences.
He was responding to the following quote:
* An option for a twitter style auto-updating reverse date posting layout where posting is expected to thick and fast (eg whilst following a sports contest)
By long-polling webserver does he simply mean one where there is a keep-alive connection left open arbitrarily long?

If so, I'm curious whether it might be feasible for people on a VPS (or better) using the worker MPM within Apache. I'm just a lowly WHM/cPanel VPS user, with a board with only 30,000 posts. However, I just used EasyApache within WHM to switch from prefork MPM to the worker MPM, which is now considered stable in Apache 2.4. It's much faster and handles TCP connections that are open for a very long time much better.

My point being that if it can be done within WHM, today, then it might not be so unthinkable for a significant proportion of users in a couple of years.

mpm_event is very similar to worker, structurally; it's just been moved from 'experimental' to 'stable' status in Apache 2.4. The big difference is that it uses a dedicated thread to deal with the kept-alive connections, and hands requests down to child threads only when a request has actually been made (allowing those threads to free back up immediately after the request is completed). This is great for concurrency of clients that aren't necessarily all active at a time, but make occasional requests, and when the clients might have a long keep-alive timeout.

The exception here is with SSL connections; in that case, it behaves identically to worker (gluing a given connection to a given thread until the connection closes).

Use if: You're on Apache 2.4 and like threads, but you don't like having threads waiting for idle connections. Everyone likes threads!

Don't use if: You're not on Apache 2.4, or you need prefork for compatibility.

In today's world of slowloris, AJAX, and browsers that like to multiplex 6 TCP connections (with keep-alive, of course) to your server, concurrency is an important factor in making your server scale and scale well. Apache's history has tied it down in this regard, and while it's really still not up to par with the likes of nginx or lighttpd in terms of resource usage or scale, it's clear that the development team is working toward building a web server that's still relevant in today's high-request-concurrency world.

Source: http://serverfault.com/a/383634

I don't much care about the feature that Kier was responding to, to be honest. Having a good tagging system in the core is the one thing that I care about more than anything else, as, after extensive research, I believe that it is very helpful for long term SEO.

But I'm curious as to whether Apache MPM Worker would cut the mustard for something like what was being discussed earlier. Upgrading to worker within cPanel/WHM on my VPS was really quite simple.

I'm not saying it necessarily will. I'm just saying that I'm curious what people have to say. I mostly just want to learn more about the limits of MPM worker, which is why I'm posting in this subforum.