So Many Choices:

Web App Deployment
with Perl, Python, and Ruby

Jon Jensen
End Point Corporation

Utah Open Source Conference 2010

Who am I?

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.

The renaissance

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.

Why should you care?

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.

The original web app interface: CGI

CGI (Common Gateway Interface) is the oldest dynamic server-side web technology. It's a simple shim between a web server and a program.

CGI benefits

CGI drawbacks


FastCGI is a way to start up persistent CGI-like processes to mitigate many of the downsides of CGI.

FastCGI benefits

FastCGI drawbacks

Application inside web server

Apache mod_perl, mod_python, mod_ruby

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.

mod_perl advantages

mod_perl drawbacks


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.

HTTP reverse proxying

Good idea! Benefits include:

What can turn my app into a standalone webserver?



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).

Widely used. Probably close to "the standard" for deploying Python web apps right now.

Framework/server combinations

More Python web servers

Many other Python WSGI servers:

Many other Python web frameworks: Django, Pylons, TurboGears, and more at



In the early day of Rails, FastCGI was really the only production-quality deployment option. Along came Mongrel, a high-performance web server to run Ruby apps.

For a few years all was quiet, but others wanted to try their hand at it too.


Also known as mod_rails aka mod_rack.

% ps u   # trimmed
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 ...

A nice microframework for web apps using Rack on Ruby is Sinatra:



Unicorn logo win

"This isn't really the official Unicorn mascot, but it should be."


Plack + PSGI

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:


An aside: Names with personality matter.
HTML::Mason vs. Mason
Starman vs. HTTP::Server::PSGI::Net::Server::PreFork

Port of Unicorn to Perl.


Port of Thin to Perl.


Runs PSGI apps in Apache mod_perl.

What can do general web service and proxying?

Wealth of free software options

  • nginx
  • lighttpd
  • Varnish
  • HAproxy
  • and others


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.

nginx benefits

nginx gotchas



Varnish gotchas

Reverse proxy considerations

Reverse proxy caching

Handling https

Operating system considerations

Other deployment considerations

Multi-tenant cloud

  • Heroku
  • Google App Engine

The benefits are amply noted by marketing folks on the web.

By all means, give them a try!

Multi-tenant cloud drawbacks

In summary

Great options

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.

Think at the system level

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, an easy way to test real-world performance in Internet Explorer and share results.

Here are some reports of a test:

Try something new!

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.