Message::Passing::PSGI - ALPHA QUALITY PSGI adaptor for Message::Passing
# Run the server - note that the -e has to all be on one line! plackup -E production -s Twiggy -MPlack::App::Message::Passing -e'Plack::App::Message::Passing->new(return_address => "tcp://127.0.0.1:5555", send_address => "tcp://127.0.0.1:5556")->to_app' # Run your app with the handler plackup -E production -s Message::Passing testapp.psgi --host 127.0.0.1 --port 5556 # Browse to: http://localhost:5000/
ALPHA QUALITY EXPERIMENT - YOU HAVE BEEN WARNED!
This module implements a mongrel2 like strategy for web handlers, using Message::Passing::ZeroMQ.
Because I could! It's a useful experiment to prove that Message::Passing can be used for things entirely unlike my initial goals.
Theoretically, this is quite an interesting model - as you've totally split the front end connection acceptance and the back end request handling, you can do things which are harder in other server environments trivially.
Examples of things that 'just work' include:
- Adding more handler processes
Totally dynamic, run as many as you want
- Adding handler processes on other servers
As long as your send/return sockets are bound to a host that's network accessible, you can spin up handlers wherever you want.
- Upgrade the application in production
You can spin up a new version, verify it appears to be working correctly etc before shutting down the old version
- Profile the application in production
Just run a handler with NYTProf..
NOTE: The properties above _do not_ exist in the current code - you will drop requests in-flight if you shut handlers down!! (Patches to fix this should not be that hard, and would be welcome if anyone is interested)
If you're actually interested in using this in production, I'd recommend you look at the real mongrel2, and Plack::Handler::Mongrel2.
Many, and varied. Please do not try to run this in production ;_)
- Large responses will use SEVERAL times the response length in RAM
- Requests never timeout
- App Handler crashes / restarts will lost in-flight requests.
- Quite probably leaks RAM.
This has not been tested, which means I quite probably got it wrong somewhere ;)
Tomas Doran (t0m)
Copyright the above author.
GNU Affero General Public License, Version 3
If you feel this is too restrictive to be able to use this software, please talk to us as we'd be willing to consider re-licensing under less restrictive terms.