The Mostly Requited Love for Python

Python is the best infrastructure language there is, hand's down.  It is the best.  It reaches out and gives your entire architecture a great big pythonny hug.  Need to describe up your deployment in a pinch?  Fabric.  Ansible is all python.  AWS API has huge python support.  And you can just use boto for all your automated AWS needs.

Python does threads okay but it does event handling better.  There's twisted and tornado for all backend web services needs.  Back in the day we wrote custom high-performance web services on Python using a fork of AsynCore.   It talks to every infrastructure component -- queuing, messaging, caching, etc -- there is.  No sweat.  Hell, if you want to go crazy, you can now do coroutines in Python.  It will now do messaging in itself.

But writing a front end in Python?  Go ahead and try it.  I'll be waiting right here.

Suffering?  Here's mako.  It's a templating library for Python. Well, it powers Reddit...

I can hear the screaming.  

And a bit of weeping sadly in the corner.  

A little gnashing of teeth.

You can put the chainsaw down, now.

Yeah, okay, Python on the front end is kind of hilarious.

I have seen a machine (8 cores, 8G RAM) with an array of Python web server processes behind an nginx*  reverse proxy do 25K tps and a bare metal Solaris server do up to 40K.  It is not Java and it's true a Python server will not get the performance of a Java backend server doing JAX-RS REST calls but then again, if Python gets good enough performance for Reddit/YouTube/Google it's good enough for most people.

I love Python.  It does all the things* -- easily, quickly, reliably, with solid core libraries.  My original gut feeling, despite it being an absolutely awful front end language, was to carry through Project Butterfly on it.  But first it's important to look at all the alternatives first.

It would be fair to quickly mention Django.  It powers Pinterest.  It's a good tool.  Much like all of these web framework stacks, I end up gutting it to make it a distributed system in the end.  It's simpler to just go into a project with distributed systems in mind instead of having to re-architect halfway through.   

  • Grammar question -- since it's pronounced "Engenix" but it starts with an "n" is the particle "a" or "an?"  Or is this something the descriptivists who hover over the OED will just throw on the floor screaming "Nein! Nein! Nein!"  I need to know.
  • Python does all the things except convert tabs into spaces.  HA!  I kill myself.