Tech & Engineering

Shift from mod_wsgi to uwsgi

The last couple weeks we have been thinking to shift from our current web serving platform which was powered by nginx + Apache + mod\ wsgi to nginx + uwsgi. The...

Sumit Datta··2 min read

The last couple weeks we have been thinking to shift from our current web serving platform which was powered by nginx + Apache + mod_wsgi to nginx + uwsgi. The reasons were that Apache was part of the plan for about a year and a half, but its main reason to be there was that Apache + mod_wsgi was stable. We of course wanted to keep nginx, but right now we had no reason to run the Apache + uwsgi.

I had the task to figure out what are people saying in general about nginx + uwsgi. So yesterday and day before I scouted the Internet for blogs or discussions regarding the same. And it turns out, as I hoped, that nginx + uwsgi is a leaner approach to the application serving platform. Also uwsgi seemed very well documented, managed and commercially supported as some folks mentioned. And there were quite a few articles detailing benchmarks comparing many platform choices for a Python based application. nginx + uwsgi fared better than the Apache alternative and almost everywhere I looked people mentioned nginx + uwsgi to be production grade. There are options which are better, but we preferred one which seems to have a larger following or community.

So we decided to take the plunge. Well the transition was smooth, or at least not troublesome at all. Most of the documentation is available here, here and here. Installation for us for very straightforward. We are on Ubuntu 10.04 LTS. We wanted to upgrade to the new 1.0 series. So we downloaded that, compiled and installed. Please remember you may need to change the config paths. We had to do some of that since our deploy + app reload scripts were dealing with the default Ubuntu install paths. After that just get uwsgi and again compile. That is it, you are done with the software part of it!

After that just follow the examples and docs I pointed out above. For us, we just had to change the proxy_ settings to corresponding uwsgi_ settings. Other than that, we needed to create ini files for uwsgi to run the apps properly. I could not figure out how to run a single instance of uwsgi that will read all stanzas from an ini file and run them all. Well so we are running two uwsgi daemons. Good enough for now, we will come back to the issue later on. Thus we have an updated AMI and we are actually flipping our application servers today. We do not expect any noticeable downtime. Well now lets get back to work :)

Share
Written by
Sumit Datta

Software engineer and entrepreneur, 16+ years at fast-paced startups across the US, Canada, Germany and India.

Comments

Hook this up to your favourite commenting platform — Giscus, Disqus, or your own.

Continue reading

Tech & Engineering·

Frontend Driven Development

I have primarily been a backend web developer, started out with PHP around 2005 and then moving to Python in 2011. I have worked with a lot of JavaScript, mostl...

Sumit Datta · 5 min
Tech & Engineering·

My laptop: my local web server

Well two months back I bought my first laptop. A Compaq V3155AU with following configuration: AMD Turion64 (single core) 2.0Ghz Hyper Threading support 512MB DD...

Sumit Datta · 2 min

A quieter inbox.

One thoughtful letter every other Sunday — new essays, things worth reading, and the occasional photograph.

Free. Unsubscribe in one click.