I don't see anything inherently wrong with what you are doing on the server side. I can only suggest that you add some debug into the test application that outputs to Apache error log to see how things progress on server side. See below for that and other comments.
2009/7/21 yashhappy <[email protected]>: > 1. prefork MPM is configured with. Unless having to run mod_php as well, you are better off using worker MPM. > 2. MPM configuration is like the following, contained by > conf/extra/httpd-mpm.conf > <IfModule mpm_prefork_module> > StartServers 5 > MinSpareServers 5 > MaxSpareServers 10 > MaxClients 150 > MaxRequestsPerChild 9 Any particular reason you are recycling Apache server child processes after 9 requests. > </IfModule> > > 3. Apache configuration file httpd.conf: > ServerRoot "/home/joshuawang/software/apache" > Listen 10087 > LoadModule wsgi_module modules/mod_wsgi.so > Include conf/extra/httpd-mpm.conf > > NameVirtualHost *:10087 > WSGIDaemonProcess www.site1.com processes=3 threads=3 display-name=%{GROUP} > <VirtualHost *:10087> > WSGIScriptAlias /wsgi/script "/home/joshuawang/wsgi/script/" Normally you would have trailing slash on left hand side as well. Ie., WSGIScriptAlias /wsgi/script/ /home/joshuawang/wsgi/script/ > <Directory "/home/joshuawang/wsgi/script/"> > WSGIProcessGroup www.site1.com > Allow from all > </Directory> > </VirtualHost> > > 4. The following is the test script I am using, time_consumed.py > import time > def application(env, start): Add: import threading print >> env['wsgi.errors'], 'START %s %s' % (threading.currentThread(), env) > status ='200 OK' > headers = [('Content-Type', 'text/plain')] > write = start(status, headers) > for i in xrange(10): Add: print >> env['wsgi.errors'], 'STEP %s' % threading.currentThread() > write(str(i)+',') > time.sleep(1) Add: print >> env['wsgi.errors'], 'END %s' % threading.currentThread() Fix any obvious errors in my suggested debug code as necessary. Graham > content = 'Time up, response finished.' > > return [content] > > I start two requests from the browser(firefox3.5.1) to the test script > time_consumed.py. The first request was handled immediately, and I saw the > counting number generated by the script. But the second request was blocked > until the first request was finished after 10 seconds. Is it something wrong > with my configuration? > > > 2009-07-21 > ________________________________ > Joshua Wang > ex-GDNTer > > ________________________________ > 发件人: Graham Dumpleton > 发送时间: 2009-07-21 11:53:32 > 收件人: modwsgi > 抄送: > 主题: [modwsgi] Re: How mod_wsgi handle concurrent wsgi request? > 2009/7/21 yashhappy <[email protected]>: >> Hi Graham: >> >> For a busy server, it's very normal that hundreds of rquests are arrived at >> the same time. Supposed that all the requests targetting to a same wsgi >> script, how mod_wsgi handle all the requests? I did some tests for this >> case. The result is all the requests were served one by one, no matter how >> many processes or threads the daemon processs group contains. >> That would be a serious bottleneck, if some of the wsgi scripts are very >> time-consumeing. Is there any way to dispatch the requests to different >> processes to handle it concurrently or how to improve the situation? > Apache/mod_wsgi has no issues with concurrency. It sounds like your > configuration is wrong and requests weren't actually being delegated > to daemon process as expected, that or you have poor Apache MPM > configuration. Other possibility is that whatever performance testing > tool you used, you didn't use it properly and weren't actually > generating concurrent requests. > Please provide the following: > 1. What MPM Apache is configured with? Worker or prefork MPM if on UNIX. > > 2. What the MPM settings are in Apache configuration? How many > processes/threads, started servers, maximum etc. This is different to > mod_wsgi daemon mode configuration. > 3. The mod_wsgi configuration you are using to setup daemon mode, map > your application and delegate to daemon process group. > 4. Details of testing tool you are using and the command line options > you are running it with. > Graham > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en -~----------~----~----~----~------~----~------~--~---
