mod_python: the long story - Grisha Trubetskoy

Mod_python: The Long Story

Oct 25th, 2013 | Comments

This story started back in 1996. I was in my early twenties, working as a programmer at a small company specializing in on-line reporting of certain pharmaceutical data.

There was a web-based application (which was extremely cool considering how long ago this was), but unfortunately it was written in Visual Basic by a contractor and I was determined to do something about it. As was very fashionable at the time, I was very pro Open Source, had Linux running on my home 386 and had recently heard Guido’s talk at the DC Linux user group presenting his new language he called Python. Python seemed like a perfect alternative to the VB monstrosity.

I spent a few weeks quietly in my cubicle learning Python and rewriting the whole app in it. (Back in those days this is how programmers worked, there was no “agile” and “daily stand ups”, everyone understood that things take time. I miss those days very much). Python was fantastic, and soon the app was completely re-written.

Then I realized that explaining what I’ve been working on to my bosses might be a bit of a challenge. You see, for a while there nobody knew that the web app they’ve been using had been re-written in Python, but sooner or later I would have to reveal the truth and, more importantly, justify my decision. I needed a good reason, and stuff about object-oriented programming, clean code, open source, etc would have fallen on deaf ears.

Just around that time the Internet Programming with Python book came out, and in it there was a chapter on how to embed the Python interpreter in the Netscape Enterprise web server. The idea seemed very intriguing to me and it might have contained exactly the justification I was looking for - it would make the app faster. (“Faster” is nearly as good as “cheaper” when it comes to selling to the management). I can’t say that I knew much C back then, but with enough tinkering around I was able to make something work, and lo and behold it was quite noticeably faster.

And so a few days later I held a presentation in the big conference room regarding this new tool we’ve started using called Python which can crunch yall’s numbers an order of magnitude faster than the Microsoft product we’ve been using. And oh, by the way, I quickly hacked something together last night - let’s do a live demo, look how fast this is! They were delighted.

Little did they know, the app had been running in Python for months, and the reason for the speed up had little to do with the language itself. It was all because I was able to embed the interpreter within the web server. Then I thought that to make it all complete I would make my little tool open source and put it on my website free for everyone to use. I called it NSAPy as a combination of the Netscape Server API and Python.

But I didn’t stop there, and soon I was able to replicate this on an Apache web server, which was taking the Internet by storm back then. The name mod_python came naturally since there already was a mod_perl.

Things were going very well back then. These were the late nineties, the dawn of e-commerce on the World Wide Web. I started working for a tiny ISP which soon transformed into a humongous Web Hosting company, we ran millions of sites, built new data centers with thousands of servers pushing gigabits of traffic and (in short) were taking over the world (or so it seemed). With the rise of our company’s stock price, me and my colleagues were on our way to becoming millionaires. Mod_python was doing very well too. It had a busy website, a large and very active mailing list and an ever growing number of devoted users. I went to various Open Source conferences to present about it (and couldn’t really believe that without exception everyone knew what mod_python was).

Then came 2001. We just bought a house and our second son was not even a year old when one beautiful sunny summer day I was summoned to a mandatory meeting. In that meeting about two thirds of our office was let go. Even though we all felt it was coming, it was still a shock. I remember coming home that morning and having to explain my wife that I’d just been fired. This after constant all-nighters, neglect for family life under the excuse of having the most important job doing the most important thing and changing the world and rants about how we’d be all set financially in just a year or two. In my personally opinion the 2007 financial crash was nothing compared to the dot-com bust. Everyone was getting laid off everywhere, the Internet became a dirty word, software development was being outsourced to India.

For the next couple of years I made a living doing contracting work here and there. Needless to say, mod_python wasn’t exactly at the top of my priority list. But it was getting ever more popular, the mailing list busier, though it didn’t make any money (for me at least). I tried my best to keep everything running in whatever spare time I had, answering emails and releasing new versions periodically. Finding time for it was increasingly difficult, especially given that most of the work I was doing had nothing to do with mod_python or Python.

One day I had this thought that donating mod_python to the Apache Software Foundation would ensure its survival, even if I can no longer contribute. And so it was done. Initially things went very well - the donation did affiliate mod_python with the solid reputation of Apache and that was great. Mod_python gained a multitude more users and most importantly contributors.

At the same time my life was becoming ever more stressful. Free time for mod_python hacking was getting more and more scarce until there was none. I also think I was experiencing burnout. Answering questions on the mailing list became an annoyance. I had to read through enormous threads with proposals for various features or how things ought to work and respond to them, and it was just never ending. It wasn’t fun anymore.

I also felt that people didn’t understand what mod_python was and that I’m not able to explain it very well. (For what it’s worth, I still feel this way). In my mind it was primarily an interface to the Apache internals, but since making every structure and API accessible from within Python was impractical, only selected pieces were exposed. Secondly, mod_python provided means to perform certain things that were best done in Apache, e.g. global locking, caching. Lastly, it provided certain common tasks but implemented in Apache-specific ways (using Apache pools, APR, etc.) for maximal performance; things like cookies and sessions fell into that category. Publisher and PSP didn’t strictly belong in mod_python, but were there for the sake of battery-includedness - you could build a rudimentary app without any additional tool.

The rest of the world saw it as a web-development framework. It wasn’t a particularly good one, especially when it came to development, because it required root privileges to run. It also didn’t do a very good job at reloading changed modules very well which complicated development. A very considerable effort was put in by one of the contributors to address the particular issue of module loading and caching, and I never thought it to be important because to me restarting Apache seemed like the answer, I didn’t think that people without root access would ever use mod_python.

As I was growing more disinterested in mod_python it got to a point where I just let it be. I would skim through emails from people I trusted and responded affirmatively to whatever they proposed without giving it much thought. I didn’t see any point in keeping and defending my vision for mod_python. I think that by about 2006 or so I was so disconnected I no longer had a good grasp of what the latest features of mod_python were being worked on. Not sure if it was my lack of interest or that other contributors felt burned out as well, but new commits slowed down to a trickle and stopped eventually, and my quarterly reports to the ASF Board became a cut-and-paste email of “no new activity”.

This is where the negative aspect of the ASF patronage begun to surface. Sadly, the ASF rules are that projects and their community must be active, and soon the project got moved to the attic. And even though I kept telling myself that I couldn’t care less, I must admit it hurt. The attic is a like a one-way trash can - once there, a project cannot go back, other than through the incubation process.

Fast forward to 2013. Why get back to hacking on it? First of all I got tired of “mod_python is dead” plastered all over the web. Every time I see some kid who wasn’t old enough to speak back when I first released it tweet that it is this or that, I can’t help but take it a little personally. It’s an open source project people, it’s only dead if you do not contribute to it.

For the skeptics in the crowd I most certainly disagree that mod_python as a concept is dead, I’d even argue that its time hasn’t come yet. The vision has not changed. Mod_python is still an interface to Apache which lets you take advantage of its versatile architecture to do some very powerful things. It’s not quite a web development framework, and it’s not even a tool for running your favorite web development framework in production (though it can certainly do that quite nicely).

These days there is more demand than ever for high volume servers that do not have a user interface and thus do not need a WSGI framework to power them - I think this is one of the areas where mod_python could be most useful. There are also all kinds of possibilities for using Apache and mod_python for distributed computing and big data stuff taking advantage of the fact that Apache is an excellent job supervisor - anyone up for writing a map/reduce framework in mod_python?

I must also note that hacking on it in the past weeks has been fun once again. I wanted to get up to speed with the latest on Python 3 and Apache internals, especially the event/epoll stuff and this has been a great way to do just that. I also very much enjoy that I can once again do whatever I want without any scrutiny.

If there is one thing I’ve learned it’s that few open source projects can exist without their founders’ continuous involvement. The Little Prince once said - “You become responsible forever for what you have tamed”. It seems like mod_python is my rose and if I don’t water it, no one will.

P.S. Did I mention mod_python now supports Python 3? Please help me test it!

Mod_python: The Long Story的更多相关文章

  1. Ubuntu下安装mod_python报错(GIT错误)

    Ubuntu下安装mod_python3.4.1版本报出如下错误: writing byte-compilation script '/tmp/tmpE91VXZ.py' /usr/bin/pytho ...

  2. Apache+Mod_Python配置

    我其实不是个适合做编程的人,因为喜欢折腾,不喜欢日复一日的重复同样的事情.感觉挺适合做网管(运维)的. 经常在摆弄一些小众的程序员不怎么会关心的东西,不走寻常路.有时也挺纠结的,折腾这些东西的过程中, ...

  3. Ajax前台与Mod_python后台应用示例

    Ajax的好处就是可以实现无刷新动态更新.后台配合Mod_python程序,使后台处理变得非常高效简洁.[index.html] <HTML> <head> <meta ...

  4. Ubuntu12.04配置mod_python

    安装: sudo apt-get install libapache2-mod-python python-mysqldb 然后编辑配置文件/etc/apache2/sites-enabled/000 ...

  5. Windows下Apache+mod_python+Django配置

    Windows下Apache+mod_python+Django配置 Apache 首先要安装Apache,我安装的版本是2.2.*: Python python肯定是要安装的,我安装的版本是2.5的 ...

  6. windows上安装apache python mod_python

    综述:   windows上安装apache python mod_python的例子.教程甚至图解都不少:但作为新手还是会出错,而且一时无法快速排解. 在此笔者将根据自己的实践经验,给出几个需要注意 ...

  7. Ubuntu 安装mod_python配置Apache2

    在Ubuntu上搭建Python运行环境,mod_python是不可少的(据说mod_swgi也是可以的,没有亲测).使用命令安装mod_python. 安装: apt-get install lib ...

  8. 关于 mod_python

    首先声明 本文 翻译 别人的文章,文章的作者是 mod_python 项目的负责人,目前 mod_python已由 Apache维护.原文地址: http://www.onlamp.com/pub/a ...

  9. Mod_Python中文文档

    Mod_Python中文文档 mod_python中文文档

  10. Difference Between Mod_Python & Mod_Wsgi | eHow

    Difference Between Mod_Python & Mod_Wsgi | eHow     x    YES    NO    Why not?     Thanks for he ...

随机推荐

  1. hdu 4585 Shaolin_set用法

    题目链接 题意:有n个人想成为少林,但是成为少林必须跟少林的大师大一场,当然要选择战斗力很近的,有两大师战斗力跟那人相近程度一样就选战斗力小的那个,按输入顺序,先输入的人先成为少林大师,后面输入的人, ...

  2. Java虚拟机体系结构深入研究总结

    工作以来,代码越写越多,程序也越来越臃肿,效率越来越低,对于我这样一个追求完美的程序员来说,这是绝对不被允许的,于是除了不断优化程序结构外,内存优化和性能调优就成了我惯用的“伎俩”. 要对Java程序 ...

  3. HHKB Professional 2

    今天买了一副号称程序员专用的静电容键盘 HHBK Pro2无刻版,简单上手了一下,确实名不虚传,打起字来酣畅淋漓,毫不拖泥带水,感觉自己的技术提高了不少呢!!!! 由于是无刻版,需要一些时间来适应,尤 ...

  4. HDU 1813 Escape from Tetris (IDA*)

    传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1813 题意:给你一个n*n的迷宫,其中0代表有一个人在这个位置,1代表墙,现在要求一个路线,使所有的人通 ...

  5. ACM-简单题之Ignatius and the Princess II——hdu1027

    转载请注明出处:http://blog.csdn.net/lttree Ignatius and the Princess II Time Limit: 2000/1000 MS (Java/Othe ...

  6. 关于找工作(二 Cover Letter)

    准备好了简历,下一个文档就是cover letter了.其实对衡量你是否是一个好的候选人来说,cover letter的作用几乎是零(很多情况下主管技术工作的人或者雇人经理根本见不到cover let ...

  7. SSH连接LINUX乱码解决方法

    1.vi /etc/sysconfig/i18n 将内容改为 LANG="zh_CN.GB18030" LANGUAGE="zh_CN.GB18030:zh_CN.GB2 ...

  8. Sigmoid function in NN

    X = [ones(m, ) X]; temp = X * Theta1'; t = size(temp, ); temp = [ones(t, ) temp]; h = temp * Theta2' ...

  9. imadjust函数分析一

    声明:本文涉及到的行数皆指本文提供的附件imadjust.m的代码中行数 本文只讨论imadjust函数是一种用法,即 J = IMADJUST(I,[LOW_IN; HIGH_IN],[LOW_OU ...

  10. js 日期天数相加减,格式化yyyy-MM-dd

    参数格式: date :2016-03-02 days:-3(2)当为负数的时候日期往前推,为正数,日期往后推 function addDate(date, days) { var d = new D ...