Python for CGI is dead?

David Garamond davegaramond at icqmail.com
Mon Jan 13 13:30:15 EST 2003


Michael Urban wrote:
> I would argue that CGI itself is dead. 

No, CGI is very much alive.

> Or at least it should be. It's
> an outdated technology 

"Outdated" as it is, there's still no replacement for it. No, mod_python 
cannot replace CGI. mod_python only runs on Apache, it cannot be wrapped 
so it cannot be safely deployed in a multiuser environment (like in a 
shared hosting server). FastCGI comes closest to being a replacement for 
CGI, but how many shared hosting servers out there offers FastCGI (or 
mod_python, for that matter)?

> that is a huge performance hit on the server.

You cannot blame this solely on the CGI protocol. The CGI protocol is a 
mainly geared for non-persistent processes, i.e.: a request comes and a 
separate program is launched just for that process. The performance hit 
varies and most of the time it doesn't matter. Also, most of the 
slowdown is caused by the interpreter, not by the process spawning 
(fork+exec). For compiled binaries, I can easily serve 100-200 reqs/sec 
with CGI. However, with Python scripts the number falls down to 10-50 
reqs/sec. Ruby is even slower because of the higher startup overhead (I 
reckon 5-25 reqs/sec in today's common machines).

> However, mod_python is very much alive (embed Python interpretor ...

-- 
dave






More information about the Python-list mailing list