我有以下问题:执行非常简单的PHP脚本时,例如:
<?php echo "1"; sleep(10); echo "2"; ?>并同时在多个标签中打开它,第一个标签在10秒内完成,但秒数等待20秒而不是10秒,所以我猜测请求会以某种方式“排队”。 任何想法如何让他们并行执行?
配置如下:LAMP堆栈,Ubuntu 10.10 64bit; Apache / 2.2.14(Unix)DAV / 2 mod_ssl / 2.2.14 OpenSSL / 0.9.8l PHP / 5.3.1 mod_apreq2-20090110 / 2.7.1 mod_perl / 2.0.4 Perl / v5.10.1
我已经添加了
KeepAlive On MaxKeepAliveRequests 0 MaxClients 512 MaxRequestsPerChild 100000到httpd.conf,但除此之外,它是lampp自带的默认httpd.conf
I have the following problem: when executing very simple PHP scripts, e.g. this one:
<?php echo "1"; sleep(10); echo "2"; ?>and open it in multiple tabs simultaneously, the first tab finishes in 10 seconds, however the seconds waits 20 seconds instead of 10, so I'm guessing the requests are "queued" somehow. Any ideas how to make them execute in parallel?
Configuration is as follows: LAMP stack, Ubuntu 10.10 64bit; Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1
I have added
KeepAlive On MaxKeepAliveRequests 0 MaxClients 512 MaxRequestsPerChild 100000to httpd.conf, but besides that, it's the default httpd.conf that comes with lampp
最满意答案
它很可能是一个浏览器问题。 有些浏览器对同一台服务器的多个连接数量有限制。 排队等待2个选项卡似乎似乎很低,所以也许它的另一个原因,但它值得检查浏览器的高级设置。
此外,您可能希望在echo函数之后添加输出刷新,并输出可为您提供更多线索的内容 - 例如服务器时间。
有一个终端窗口打开并拖曳访问日志也可以让你更好地了解发生的事情。
Most likely its a browser issue. Some browsers have a limit on the number of multiple connections to the same server. Having queued connections with 2 tabs seems seems to low, so maybe its another reason but its worth checking out the advanced settings for your browsers.
Also, you may want to add output flushing after your echo functions and to output something which could give you more clues to whats happening - for example the server time.
Having a terminal window open and tailing the access log will also give you a better picture to whats happening.
更多推荐
发布评论