今天帮朋友查询wordpress执行超级慢的原因,特此记录
开启fpm的慢日志,记录执行超过30秒的脚本
request_slowlog_timeout = 30 slowlog = var/log/slow.log
查看日志
[23-May-2019 17:14:14] [pool www] pid 27993 script_filename = /www/wwwroot/www.yingxiaoshi.com/wp-admin/admin-ajax.php [0x00007fbc9c832ef8] curl_exec() /www/wwwroot/www.yingxiaoshi.com/wp-content/plugins/wp-autopost-pro/wp-autopost-function.php:2352 [0x00007fbc9c832bd0] curl_get_encoding_contents_ap() /www/wwwroot/www.yingxiaoshi.com/wp-content/plugins/wp-autopost-pro/wp-autopost-function.php:2447 [0x00007fbc9c8329b8] curl_get_contents_ap() /www/wwwroot/www.yingxiaoshi.com/wp-content/plugins/wp-autopost-pro/wp-autopost-function.php:2536 [0x00007fbc9c831f80] get_html_string_ap() /www/wwwroot/www.yingxiaoshi.com/wp-content/plugins/wp-autopost-pro/wp-autopost-function.php:5440 [0x00007fbc9c831e30] +++ dump failed
发现是wp-autopost-pro采集插件问题
通过http推送消息给socket,socket服务再向客户端推送<?php /* * Socket推送 * 请用守护进程方式启动php msgservice.php & (socket只...
项目中使用服务来执行webservice,由于对方系统api不稳定,经常导致服务崩溃,只能重启,一个月差不多要重启一次。初期的解决办法是捕获异常,然后continue掉。<?php try { $url = 'http...
在编写多进程的实例中我在每个进程中使用如下代码://调用等待信号的处理器 while (true) { pcntl_signal_dispatch(); }开启5个进程,cpu直接100%修正之后的代码://调用等待信号的处理器 while&...
php7.1引入了PHP异步信号处理函数pcntl_async_signals() 来处理阻塞问题。在php7之前信号处理方式有2种,第一种是基于ticks来每执行一行代码来触发执行信号监听,第二种是直接while(true){ //监听信号 }第一种方式如果某行的代码阻塞时间较长会影响...
经常我们下载国外资源容易被墙,可以通过php脚本获取远程文件流然后输出给我们的浏览器来下载。<?php //设置下载文件的url $url = 'https://mirrors.huaweicloud.com/ubuntukylin/ubuntukylin-19....
概念请参考w3school文章: redis watch ,redis exec (看完基本秒懂)(1)基本事务://连接本地的 Redis 服务 $redis = new Redis(); $redis->con...