Speeding up CGIHTTPServer (Tim Roberts)

Steve Nordby smnordby at yahoo.com
Tue Mar 8 08:55:50 EST 2005


"Diez B. Roggisch" wrote:

> > If there is no way to improve performance, could anyone tell my _why_ it's
> > running so slowly?  Presumably spawning a process takes some time.  The
> > code I'm running as CGI is not hectic at all.
>
> Just an educated guess: Maybe some timeouts or slowly answered requests are
> the problem - e.g. DNS is often a candidate than can slow down network
> experience a lot. So maybe thats causing your trouble?
>

I also got very slow responses using Python's HTTP server library.  I found that
changing the address_string(self) method in
BaseHTTPServer.BaseHTTPRequestHandler to return self.client_address[0] instead
of doing a hostname lookup cured the problem.  The doc string says the method is
only used for logging, and so far I've experienced no ill side effects.

--
Steve






More information about the Python-list mailing list