开发者

mod_wsgi + apache not multithreaded, why?

WSGI application


# coding: utf-8

import time

def application(environ, start_response):
    status = '200 OK'
    output = str(time.time())
    time.sleep(5)
    output += ' -> ' + str(time.time())

    response_headers = [('Content-type', 'text/html; charset=utf-8'),
                        ('Content-Length', str(len(output)))]
    start_response(stat开发者_JAVA技巧us, response_headers)

    return [output]

Apache VirtualHost



    ServerName localhost

    WSGIDaemonProcess main user=www-data group=www-data processes=1 threads=5
    WSGIScriptAlias / /var/www/main/main.wsgi

    
        WSGIProcessGroup main
        WSGIApplicationGroup %{GLOBAL}
        Order deny,allow
        Allow from all
    

    ErrorLog /var/log/apache2/main_error_log
    CustomLog /var/log/apache2/main_log common

Сonnecting multiple clients, they are processed sequentially, there is no multithreading. Why?


This is being dealt with on mod_wsgi mailing list. See:

http://groups.google.com/group/modwsgi/browse_frm/thread/b8aaab6bfc4cca6d


While not exactly an answer, I noticed the serial behavior with a similar setup when testing on a single browser with multiple tabs. ( i tried chrome7 and ff4 )

Wondering if it was the browser enforcing the serial-ness, I tried the same experiment with two separate browsers, and it definitely showed the server to be acting multi-threaded.

My setup was:
mod_wsgi 3.3-1
python 3.1.2-2
apache 2.2.17-1
on archlinux x86_64
tests were run with mod_wsgi in embedded mode.

hope it helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜