« Who Cares What Version Number Perl Is? | Main | Pumpkin Perl, Version 20. »

02/10/2013

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a0128764b0ec7970c017c36c1809d970b

Listed below are links to weblogs that reference Help With My AnyEvent + Plack Tutorial:

Comments

Feed You can follow this conversation by subscribing to the comment feed for this post.

Michael Alan Dorman

Sorry, I don't have time to write significant text, etc., right now, but you mentioned having a hard time coming up with "real-world" reasons for doing this, and I thought of two real-world scenarios where doing the AnyEvent dance with Plack might make sense.

First, if you're mostly just doing code that is a thin shim (marshalling+auth) over a bunch of database calls, and you are using a database layer that has good AnyEvent support---Redis being the only one that comes to mind, though it is possible to do it with PostgreSQL without too much hassle---then you could perhaps get by with a single-process server, which would lower the resource requirements, etc., for serving your application. If you're running on memory-constrained VM images, that could be a nontrivial cost-savings.

A generalization of that would be if you were pushing all processing off on some set of back-end machines, via ZeroMQ or RabbitMQ or Gearman or something---again, you have the light-weight front-end that controls access and frobs data, and then it hands off to other boxes for actual processing.

Both of those notions are somewhat artificial, but not toy usages just to prove a point.

dams

Not sure if it'll help, but you can use this talk as a real life example description. It has all the code at the end. It's using twiggie + Dancer, but you can probably addapt it easily.

http://slideshare.net/dkrotkine/dancing-with-websocket

Darin

I added AnyEvent::HTTPD to my app so that another application could monitor me asynchronously. Just by pinging me on my port, any number of questions could be asked about how my main process is going (it's something that will take 4+ hours to perform, and the monitoring app is written in JS/Java). Makes for a reasonably language-independent "chat" whereby most of the heavy lifting (HTTP requests/responses) are handled by Someone Else's Code.

My main app will be using Coro/AnyEvent to co-ordinate itself already, so slapping this on top should be fairly cheap.

The comments to this entry are closed.