【问题标题】:multithreading windows apache server多线程 windows apache 服务器
【发布时间】:2013-07-20 09:06:41
【问题描述】:

我正在使用 apache 2.2,我曾尝试运行 2 个线程(并行),但我似乎无法让两个线程按顺序运行。

如何强制它同时(并行)运行??

test.wsgi::

import time

def application(environ, start_response):

    status = '200 OK'

    output = str(time.time())
    time.sleep(5)
    output += '<br/>' + str(time.time())
    response_headers = [('Content-type', 'text/html; charset=utf-8'),
                        ('Content-Length', str(len(output)))]
    start_response(status, response_headers)
    return [output]

我在 httpd.conf 的末尾插入了以下内容:

Include conf/extra/httpd-mpm.conf

<IfModule mpm_winnt_module>
        ThreadsPerChild   253
        MaxRequestsPerChild     0
</IfModule>

<VirtualHost *>
        ServerName localhost    
        WSGIScriptAlias / C:\test\test.wsgi
        <Directory C:\test>
                Order deny,allow
                Allow from all
        </Directory>
</VirtualHost>

我得到了这样的作品,但不是并行的,

第一个线程: 1374420108.56 1374420113.56

第二个线程: 1374420113.57 1374420118.57

谢谢

【问题讨论】:

    标签: python windows multithreading apache flask


    【解决方案1】:

    问题已解决,似乎是“测试滥用”,我在同一个浏览器的多个选项卡上进行了测试,但不知何故浏览器无法处理这些多个并发请求,所以我尝试了不同的浏览器和它正在工作!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多