[mod_python] uneven speed results

Graham Dumpleton graham.dumpleton at gmail.com
Thu Apr 26 17:52:28 EDT 2007


The main problem with Python web frameworks is that they are usually
quite huge in comparison to PHP pages. Take for example TurboGears,
just to load it up the basic set of features into memory takes up
15MB. That is even before any requests arrive.

Now, if you run Apache in prefork mode and have up to 25 processes the
amount of memory starts to add up. In a memory constrained box this
may mean having to swap memory back in from disk in the worse case.

Worse is that if you have the idle state of Apache setup to only run a
few processes and create the rest on demand, creating those extra
processes when there is a peak in traffic will result in the slow
startup of loading that 15MB of modules into memory in order to handle
the request.

Further, once the peaks is gone Apache will kill off what it sees and
extra processes to its requirements, so the next time there is a peak
it happens all over again.

Thus, suggested that if running prefork that one set the idle number
of processes to perhaps be larger than normal so no need to create
additional processes when small peaks in demand. Alternative is to use
worker MPM whereby one can make use of multiple threads in a smaller
number of processes.

Graham

On 27/04/07, ml <ml at dasir.net> wrote:
> For a large count of requests it gives some constant reply time. But
> rarely visited sites have a long "warm up" (sometimes over 2 seconds)
> and that is too much. I'm just curious what makes the difference between
> e.g. 150ms and 1500ms respond times.
>
> D
>
>
> Graham Dumpleton napsal(a):
> > Using 'ab' with such small numbers of requests always yields
> > unreliable results. What do you get if you use 5000-10000 requests?
> >
> > Also note that using -k isn't a realistic measure of real world
> > performance as no single client is going to trigger large numbers of
> > requests over the same connection, so don't use -k when using the
> > large number of requests I suggest.
> >
> > Graham
> >
> > On 26/04/07, ml <ml at dasir.net> wrote:
> >> Hi!
> >>
> >> I was wondering why mod_python (3.2.8) has so uneven speed results, e.g.:
> >>
> >> # ab -k -c1 -n15 some_python_site
> >> ...
> >> Percentage of the requests served within a certain time (ms)
> >>   50%    158
> >>   66%    161
> >>   75%    165
> >>   80%    166
> >>   90%   1173
> >>   95%   1209
> >>   98%   1209
> >>   99%   1209
> >>  100%   1209 (longest request)
> >>
> >> When I compare it to a PHP it has constant response time on each request.
> >> I know that the startup can take some more time but sometimes it takes a
> >> longer time when I do refreshing the page in a browser so the startup
> >> can't affect the response (I think :-).
> >>
> >> What all does affect the mod_python runtime?
> >>
> >> David
> >> _______________________________________________
> >> Mod_python mailing list
> >> Mod_python at modpython.org
> >> http://mailman.modpython.org/mailman/listinfo/mod_python
> >>
> >
>


More information about the Mod_python mailing list