PHP请求“排队”(PHP requests “queueing”)

编程入门 行业动态 更新时间:2024-10-27 12:31:16
PHP请求“排队”(PHP requests “queueing”)

我有以下问题:执行非常简单的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 100000

to 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.

更多推荐

本文发布于:2023-07-24 13:24:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1246291.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:PHP   requests   queueing

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!