So Many Choices:
Web App Deployment
with Perl, Python, and Ruby
CTO at End Point, a consultancy focused on open source in the ecommerce and database arenas.
We deploy and support web applications for our clients, so new happenings in that field are always of interest to us.
In recent years the web app deployment options have gotten much more diverse for Perl, Python, and Ruby.
There are several excellent open source options for scaling up websites.
In general, website performance and scalability have become hot topics.
If you already have a working website that is reliable, handles its peak traffic times with ease, and you're on the current versions of all your software, you probably don't need to change anything.
Google said a year or two ago that they would start considering site performance in their search rankings.
Some research has shown that even tenths of a second speedups increase ecommerce sales.
So it's good to squeeze out more performance, or maybe use less hardware, and deliver a better experience to users.
In this model the entire application lives directly inside the web server.
For a long time, mod_perl was the standard way to do this, with mod_python having some popularity and mod_ruby never really catching on.
HTTP is already designed to pass requests from one machine to another.
Why not just use HTTP to connect the web server to the app?
Because most web app frameworks didn't have a built-in web server.
The renaissance started with Python's WSGI (Web Server Gateway Interface), a "standardized interface between Web servers and Python Web frameworks/applications".
Now various HTTP servers implemented in Python had a uniform way to communicate with web frameworks.
Having a standard allowed many new compatible alternatives to bloom.
Runs WSGI apps in Apache in either embedded mode (like mod_python) or daemon mode (where work is done in separate child processes).
http://code.google.com/p/modwsgi/
Widely used. Probably close to "the standard" for deploying Python web apps right now.
Many other Python WSGI servers: http://wsgi.org/wsgi/Servers
Many other Python web frameworks: Django, Pylons, TurboGears, and more at http://wiki.python.org/moin/WebFrameworks
Ruby
% ps u # trimmed PID VSZ RSS COMMAND 14889 153360 47356 Passenger ApplicationSpawner: /path/to/app 14897 182588 70924 Rails: /path/to/app
Essentially a port of WSGI to Ruby. A very nice interface.
Enabled a lot of new HTTP servers in Ruby. For example ...
The new ideas come full circle back to Perl, with WSGI -> PSGI, and Rack -> Plack.
Use it with Dancer, the nice port of Sinatra to Perl: http://perldancer.org/
An aside: Names with personality matter.
HTML::Mason vs. Mason
Starman vs. HTTP::Server::PSGI::Net::Server::PreFork
Port of Unicorn to Perl.
Runs 5-6% of all websites, and is 4th most popular web server.
Very efficient with large number of clients -- not many processes or threads like Apache.
Easy to set up.
Lots of features.
Benefits:
/etc/sysconfig/nginx
or /etc/sysconfig/varnish
to increase number of file descriptors./etc/sysctl.conf
or go statelessThe benefits are amply noted by marketing folks on the web.
By all means, give them a try!
We have an embarrassment of riches in the open source web application world:
Perl, Python, and Ruby all have very nice modern frameworks for developing web applications.
They also have several equivalent solid options for deploying web applications.
There are several excellent web servers and reverse proxies.
There are a lot of pieces that make up a web application. Consider the whole stack:
If you're at least somewhat familiar with each component, you'll be better able to spend your energy wisely. Benchmark and test several candidates in your own environment before committing to one.
Check out webpagetest.org, an easy way to test real-world performance in Internet Explorer and share results.
Here are some reports of a utosc.com test:
A challenge: Try out one of the following microframeworks that you haven't used before. Install it on your local machine and put together a little test application.
Then set up nginx or Varnish to proxy it and serve the static content.
Contact me:
These slides presented in Slippy, an HTML presentation library.