Exception raising, and performance implications.

jepler at unpythonic.net jepler at unpythonic.net
Mon Oct 3 20:06:12 EDT 2005


On Mon, Oct 03, 2005 at 02:34:40PM -0700, leo wrote:
> I come from a java background, where Exceptions are a big Avoid Me, but
> are the performance implications the same in Python? We're expecting a
> big load on our app (100,000 users/hour) , so we'd like to be as tuned
> as possible.

I don't know what you do for each user, but here's a data point:  My 1.8GHz
Sempron (firmly in the "budget" category) uses a fairly unoptimized piece of
software called aether[1] to serve my blog and a few other things.  It uses
Apache and good old fashioned cgi-bin one-process-per-request to serve up most
pages.  It parses a substantial amount of Python code each time with execfile
(not using byte-compiled files).  It still does this in 87ms on average (albeit
for a simple page), or about 41k requests per hour.

By simply buying a faster CPU, or by avoiding execfile, or by using a
higher-performance technology than CGI, or with judicious use of caching, I'm
sure I could reach 100,000 requests per hour, and by using several of the
techniques together I might be able to reach 400k requests per hour.  Probably
it would be after these fairly obvious, high-level optimization ideas were
exhausted that I would look at the code at a microscopic level for optimization
ideas.

But because my website is stuck on the slow end of a DSL line, there's not much
point to any of this.

Jeff
[1] http://www.logarithmic.net/pfh/aether (not my site)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20051003/292832bd/attachment.sig>


More information about the Python-list mailing list