seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers)

一:系统环境

[machao@aiye log]$ cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[machao@aiye log]$ uname -i
x86_64 内存:64G

二:php-error.log路径

[machao@zhangwan22222222 log]$ cat /usr/local/php-7.0.22/etc/php-fpm.conf
[global]
error_log = /usr/local/php-7.0.22/var/log/php-fpm.log

三:检查php的errorlog日志

最近看监控,发现php-fpm,mysql的cpu过高,服务器压力过大,就想着优化下php-fpm和mysql的参数

这里:检查php-fpm的errorlog

[machao@aiye log]$ sudo tail -100 /usr/local/php-7.1.10/var/log/php-fpm.log
[29-May-2018 08:55:30] WARNING: [pool www11] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 27 idle, and 89 total children注释:好像很忙碌,你需要增加pm.start_servers 或pm.min/max_spare_servers 

四:php-fpm进程池优化

php-fpm进程池开启进程有两种方式:
一种是:static (静态的), 直接开启指定数量的php-fpm进程,不再增加或者减少
一种是:dynamic (动态的), 开始时开启一定数量的php-fpm进程, 当请求量变大时,动态的增加php-fpm进程数达到上限, 当空闲时自动释放空闲的进程数到一个下限。
(生产环境中,根据服务器实际需求来进行调整)

要用到的一些参数 ,分别是 pm,pm.max_children,pm.start_servers,pm.min_spare_servers,pm.max_spare_servers

pm表示使用哪种方式,有两个值可以选择。staic或者dynamic
例:pm = dynamic

pm.max_children:静态方式下指开启的php-fpm进程数量, 在动态方式下限定php-fpm的最大进程数。

pm.start_servers:动态方式下的起始php-fpm进程数量。

pm.min_spare_servers:动态方式空闲状态下的最小php-fpm进程数量。ps:spare(空闲的)

pm.max_spare_servers:动态方式下空闲状态的最大php-fpm进程数量。

如果pm设置为staic,那么只有pm.max_childern这个参数生效

如果pm设置为dynamic,4个参数都生效。系统会在php-fpm运行开始时启动pm.start_servers个php-fpm进程,然后根据系统的需求动态在pm.min_spare_servers和pm.max_spare_servers之间调整php-fpm进程数。

PS:要求pm.start_servers的值在pm.min_spare_servers和pm.max_spare_servers之间

五:php-fpm优化后的参数

[machao@zhangwan22222222 log]$ sudo cat  /usr/local/php-7.1.10/etc/php-fpm.conf
[global]
pid = /usr/local/php-7.1.10/var/run/php-fpm.pid
error_log = /usr/local/php-7.1.10/var/log/php-fpm.log
 
[www]
listen = /tmp/php-fcgi.sock
user = php-fpm
group = php-fpm
pm = dynamic
pm.max_children = 100
pm.start_servers = 40
pm.min_spare_servers = 30
pm.max_spare_servers = 60
pm.max_requests = 5000
rlimit_files = 60000
listen.owner= nobody
listen.group= nobody
listen.mode = 0666

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
找出sql错误SELECT * FROM ( SELECT a.id, a.CODE AS 'sourceBillCode', a.type AS 'originalOrderType', a.unit_of_origin, a.unit_of_origin_type, a.time AS 'orderOriginCreationTime', a.warehouse, a.receiving_storage_space, b.type_of_material, b.quality_control_number, b.good_products_number, b.defective_products_number, b.yield, b.quantity_of_returns, b.as_received_condition, b.quantity_of_order, b.quantity_not_received, b.quantity_of_goods_received, b.number_of_spare_parts, b.quantity_of_returns_actual, b.special_production_quantity, b.quantity_in_storage, b.receipt_quantity AS 'inqty', b.quantity_not_in_storage FROM wareh_source_order a LEFT JOIN statistics_receiving_order b ON a.id = b.order_id UNION ALL SELECT a.id, a.CODE AS 'sourceBillCode', a.type AS 'originalOrderType', a.unit_of_origin, a.source_of_delivery_note, a.time AS 'orderOriginCreationTime', a.warehouse, a.receiving_storage_space, b.type_of_material, b.quality_control_number, b.good_products_number, b.defective_products_number, b.yield, b.quantity_of_returns, b.as_received_condition, b.quantity_of_order, b.quantity_not_received, b.quantity_of_goods_received, b.number_of_spare_parts, b.quantity_of_returns_actual, b.special_production_quantity, b.quantity_in_storage, b.receipt_quantity AS 'inqty', b.quantity_not_in_storage FROM wareh_source_order a LEFT JOIN statistics_purchase_order b ON a.id = b.order_id ) tab WHERE originalOrderType IN ( 'PurchaseOrder', 'ReceiptRecord' ) AND warehouse = 'string' AND receiving_storage_space = 'string' AND date_format( orderOriginCreationTime, '%y%m%d' ) >= date_format( '2023-07-07 00:00:00.0', '%y%m%d' ) AND date_format( orderOriginCreationTime, '%y%m%d' ) <= date_format( '2023-07-07 00:00:00.0', '%y%m%d' ) AND ( EXISTS ( SELECT material_no FROM wareh_source_order_list c WHERE c.order_id = id AND ( c.material_name REGEXP 'string' OR c.material_full REGEXP 'string' OR c.material_lot REGEXP 'string' ) ) OR source_of_delivery_note REGEXP 'string' OR CONVERT ( source_bill_code USING utf8mb4 ) REGEXP 'string' )
最新发布
07-08

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值