Am 05.03.2008 um 23:47 schrieb Peter Edwards:
On Wed, Mar 5, 2008 at 11:48 AM, Moritz Onken
I'm combining ajax with push. So it's a real push service, the
website is not pulling the data on a constant time rate.
A process per client is really bad. I'll need to serve hundreds of
client at the same time. Seems like push is not an option...
Take a look at cometd: http://cometd.com/
Moritz, I've done something similar before using POE to handle many
connections more cheaply than Apache (thanks to Matt Trout for the
suggestion). It was to serve XML formatted requests though you could
return JSON formatted data just as easilyhttp://search.cpan.org/perldoc?POE::Component::Server::TCP
But I still need a lot of code which is run by catalyst, like
authentication and of course the whole dbic schema.
What about Catalyst::Engine::HTTP::POE?
cometd.com is not very informative ...
In the article http://www.irishdev.com/NewsArticle.aspx?id!66
see that diagram of an SOA style architecture?http://alex.dojotoolkit.org/wp-content/Comet.png
talks persistent TCP to
Comet event bus = proxy server, e.g. perlbal or nginx or POE TCP daemon
talks HTTP or XML-RPC to
Server-side processing = your Catalyst app
You need to split the management of the many persistent TCP connections from
the generation of content.
In a typical web server setup you achieve this by using a scalable caching
proxy front end to do the TCP socket handling and a Catalyst backend for the
In your case you might need something a bit smarter in the front end, hence
my mention of a custom POE daemon. Or you could write a plugin for perlbalhttp://search.cpan.org/dist/Perlbal/.
You could make an XML-RPC or HTTP request from the front end to Catalyst to
authenticate, and thereafter run periodic front to backend GETs and cache
them (in the "comet event bus" part) ready to serve to the comet client via
That way you don't need to tie up a 30MB Catalyst process just to hold open
a socket, are spreading the request load evenly across time and can write it
all in Perl.
Alternatively, if you have an enormous load the for the proxy you could use
nginx and write a C module to call out to your backendhttp://www.riceonfire.org/emiller/nginx-modules-guide.html