[mod_python] Concurrent requests

Nicolas Lehuen nicolas.lehuen at gmail.com
Sat Dec 10 03:59:44 EST 2005


Hi Lars,

I cannot reproduce your problem. Here is what I've done :

E:\Documents and Settings\Nico>ab -c 10 -n 10 http://shuttle/test.psp
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking shuttle (be patient).....done


Server Software:        Apache
Server Hostname:        shuttle
Server Port:            80

Document Path:          /test.psp
Document Length:        5 bytes

Concurrency Level:      10
Time taken for tests:   10.34429 seconds
Complete requests:      10
Failed requests:        0
Write errors:           0
Total transferred:      1410 bytes
HTML transferred:       50 bytes
Requests per second:    1.00 [#/sec] (mean)
Time per request:       10034.429 [ms] (mean)
Time per request:       1003.443 [ms] (mean, across all concurrent requests)
Transfer rate:          0.10 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   3.2      0      10
Processing: 10014 10019   7.1  10014   10034
Waiting:    10004 10018   8.4  10014   10034
Total:      10014 10020   7.0  10024   10034

Percentage of the requests served within a certain time (ms)
  50%  10024
  66%  10024
  75%  10024
  80%  10024
  90%  10034
  95%  10034
  98%  10034
  99%  10034
 100%  10034 (longest request)

Clearly the 10 requests are handled concurrently. I've also done tests
with raw handlers and mod_python.publisher, and everything looks fine.
I have exactly the same configuration, running under Windows XP.

Please try doing the same tests using ab and tell us what you get.

Regards;
Nicolas

2005/12/9, Lars Eriksen <downgrade at gmx.org>:
> I posted my httpd.conf setup earlier. I am just experimenting, yes. Here is
> the content of the .psp file I use:
>
> <%
> import time
> time.sleep(10)
> req.write('Done.')
> %>
>
> As I've mentioned, I access the script concurrently using two browser
> instances.
>
>
> ----- Original Message -----
> From: "Graham Dumpleton" <grahamd at dscpl.com.au>
> To: "Jim Gallacher" <jpg at jgassociates.ca>
> Cc: "Lars Eriksen" <downgrade at gmx.org>; <mod_python at modpython.org>
> Sent: Friday, December 09, 2005 9:26 PM
> Subject: Re: [mod_python] Concurrent requests
>
>
> > The lock would only be a problem if the sleep() call were being  executed
> > as
> > part of a module import.
> >
> > Can OP post simplified code demonstrating problem?
> >
> > BTW, why do you want to call sleep(), or is this just experimenting?
> >
> > Graham
> >
> > On 10/12/2005, at 4:00 AM, Jim Gallacher wrote:
> >
> >> I wonder if it's related to the page cache mechanism acquring a  global
> >> lock? Niclolas is more familiar with that code in psp.py and  may be able
> >> to comment.
> >>
> >> Jim
> >>
> >> Lars Eriksen wrote:
> >>
> >>>> Are you using sessions?
> >>>>
> >>> No.
> >>>
> >>>> Which mod_python version?
> >>>>
> >>> Apache/2.0.55 (Win32) mod_python/3.2.5b Python/2.4.2
> >>>
> >>>> Apache mpm prefork, worker or threaded?
> >>>>
> >>> Default Apache NT installation, which uses the MPM in threaded mode.
> >>> I only added the following to my main directory configuration:
> >>> AddHandler mod_python .htm
> >>> PythonHandler mod_python.psp
> >>> PythonDebug On
> >>> Thanks in advance!
> >>> ----- Original Message ----- From: "Jim Gallacher"
> >>> <jpg at jgassociates.ca>
> >>> To: "Lars Eriksen" <downgrade at gmx.org>
> >>> Cc: <mod_python at modpython.org>
> >>> Sent: Friday, December 09, 2005 5:03 PM
> >>> Subject: Re: [mod_python] Concurrent requests
> >>>
> >>>> Are you using sessions?
> >>>> Which mod_python version?
> >>>> Apache mpm prefork, worker or threaded?
> >>>>
> >>>> Jim
> >>>>
> >>>>
> >>>> Lars Eriksen wrote:
> >>>>
> >>>>
> >>>>> I have created a simple .psp script that simply calls sleep(...)  and
> >>>>> blocks execution for a certain amount of time (x seconds).
> >>>>>
> >>>>> If I access the .psp script in two instances of my browser at  the
> >>>>> same time, request one waits x seconds, then it finishes,  then
> >>>>> request two is processed and finishes after x * 2 seconds.
> >>>>>
> >>>>> Requests are obviously queued and not several Python  interpreters
> >>>>> spawned to handle them concurrently.
> >>>>>
> >>>>> Is there any setting that allows you to specify the number of  Python
> >>>>> interpreters that should be used?
> >>>>>
> >>>>> Thanks,
> >>>>>
> >>>>> -Lars
> >>>>> _______________________________________________
> >>>>> Mod_python mailing list
> >>>>> Mod_python at modpython.org
> >>>>> http://mailman.modpython.org/mailman/listinfo/mod_python
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>>
> >>> _______________________________________________
> >>> Mod_python mailing list
> >>> Mod_python at modpython.org
> >>> http://mailman.modpython.org/mailman/listinfo/mod_python
> >>>
> >>
> >> _______________________________________________
> >> Mod_python mailing list
> >> Mod_python at modpython.org
> >> http://mailman.modpython.org/mailman/listinfo/mod_python
> >>
> >
> >
>
> _______________________________________________
> 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