Does Python scale for heavy web loads?

Alex Martelli aleaxit at yahoo.com
Thu Sep 7 15:09:55 EDT 2000


<markhaliday at my-deja.com> wrote in message
news:8p85rh$hmi$1 at nnrp1.deja.com...
> Question: Using Python as a CGI and running it under Apache, would
> Python realistically be able to handle 5,000 hits an hour and not
> degrade performance?

Depends on the hardware, and even more on the OS, but 1.5 process
starts per second can be a noticeable load on certain machines and
OS's.  You might want to use FastCGI -- that's the closest you can
get to CGI while handling many hits from within the same process
(depending on what your CGI-like scripts are doing, you could keep
a few processes around, all serving Python on FastCGI, and share
the load between them).  Or, of course, there are more 'advanced'
options (but the programming model can get farther from simple
CGI...).


> With Python's threading, (ex: using a Default.py
> script as an example) I call Default.py to render some information,
> only one thread runs Default.py right?  No other people can hit

No, any number of threads can be running 'concurrently' unless
explicitly locked -- that's independent of what modules they're
executing (Python has a lock around the whole interpreter, but
that only affects interactions with extension code written in C).

> Default.py until Default.py finishes with its original request and
> serving the information back...Correct?

Not by default, but you can use an explicit lock to achieve
the same effect if that is what you desire.


Alex






More information about the Python-list mailing list