perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Gifford <>
Subject Re: AJAX pseudo-push
Date Fri, 13 Nov 2009 07:19:50 GMT
Nicolas George <> writes:

> Hi.
> There is an increasingly popular technique to emulate server-initiated push
> over HTTP. I'm sure everyone here knows it well, but for the sake of
> completeness: the clients sends a XMLHttpRequest to the server in the
> background; the server does not answer it immediately, but keeps it for
> later when there is actually something to say to the client; if the request
> timeouts, the client re-sends it.
> I am wondering if this technique is usable with Apache in general and
> mod_perl in particular.
> The obvious solution is to have the request handler sleep until it has
> something to answer does not work, since it requires a worker thread and a
> perl interpreter for each waiting client, and perl interpreters are few and
> expensive.

You could use Apache in the front to handle static content and proxy
to another server for mod_perl and/or a custom notification server you
write.  Apache works very well in this type of setup.

If you haven't yet, you could also try this out and see if you hit
real performance problems.  mod_perl interpreters can be heavyweight,
but there is a lot of shared data between them, so if most of your
interpreters are not doing much performance may be fine.  Or maybe
not of course.

> The ideal solution would be if some part of the request handler could put
> the current request (A) "on hold". Later, the handler for another request
> (B) could retrieve the request A and generate an answer for it, or at least
> wake it up.

This is a very interesting idea, it might be possible to implement it
with a custom Apache module, or maybe even with mod_perl if you found
the right hooks.


View raw message