加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

yii – 函数fastcgi_finish_request花费了大部分执行时间

发布时间:2020-12-13 22:44:14 所属栏目:PHP教程 来源:网络整理
导读:我用yii php-fpm nginx建立了一个网站.然后我试图找到xhprof的瓶颈. xhprof的结果表明,在某些请求(并非所有请求)中,函数fastcgi_finish_request花费了超过所有执行时间的80%.这很奇怪. Click to view the full graph output from xhprof Click to view the
我用yii php-fpm nginx建立了一个网站.然后我试图找到xhprof的瓶颈. xhprof的结果表明,在某些请求(并非所有请求)中,函数fastcgi_finish_request花费了超过所有执行时间的80%.这很奇怪.

Click to view the full graph output from xhprof

Click to view the form output from xhprof

我使用的版本是:

php:5.3.8

nginx:1.0.10

xhprof:从它的github源构建

为什么函数fastcgi_finish_request需要这么多时间?我该如何避免这种情况?

解决方法

从php-fpm.org页面:

fastcgi_finish_request() is a php feature,that stops the response
output. Web server immediately starts to transfer response “slowly and
sadly” to the client,and php at the same time can do a lot of useful
things in the context of a query,such as saving the session,
converting the downloaded video,handling all kinds of statistics,
etc.

我自己还没有使用过fastcgi_finish_request(),但是如果时间,服务器需要发回到目前为止所做的响应输出,则在PHP脚本中计为此方法的“执行时间”;看起来很清楚,为什么这个功能“消耗”这么多时间,因为它取决于你的服务器和客户端网络连接(例如ping).

使用本地开发环境时执行时间是否有所不同?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读