php-fpm如何配置max_children参数

前言

php-fpm 资源耗尽

php-fpm 的子进程耗尽的时:

  1. 会导致 502 出现
  2. nginx 出现错误日志
2024/07/18 20:19:10 [crit] 36390#0: *1402471 connect() to unix:/tmp/php-cgi-81.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.0.162, server: xxx, request: "POST /api.html HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi-81.sock:", host: "xxx", referrer: "https://xxx/"

如何解决

合理配置max_children参数。

宝塔推荐值:

  • 8G内存时,pm.max_children = 120
  • 16G内存时,pm.max_children = 200
  • 32G内存时,pm.max_children = 300

使用宝塔设置

在这里插入图片描述

参考

https://blog.csdn.net/solmyr_biti/article/details/53955141
https://www.jb51.net/article/157900.htm
https://blog.csdn.net/weixin_33701251/article/details/92332376

相关推荐

  1. 配置php-fpm服务

    2024-07-21 06:22:04       18 阅读
  2. PHP-FPM 的主要作用和功能:

    2024-07-21 06:22:04       55 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-21 06:22:04       52 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-21 06:22:04       54 阅读
  3. 在Django里面运行非项目文件

    2024-07-21 06:22:04       45 阅读
  4. Python语言-面向对象

    2024-07-21 06:22:04       55 阅读

热门阅读

  1. 【电子数据取证】如何配置好虚拟机

    2024-07-21 06:22:04       18 阅读
  2. Codeforces Round 959(Div. 1 + Div. 2)A~C

    2024-07-21 06:22:04       19 阅读
  3. linux 安装c语言编辑器

    2024-07-21 06:22:04       15 阅读
  4. pytorch学习(十三)torch维度变换

    2024-07-21 06:22:04       15 阅读
  5. Linux知识点汇总

    2024-07-21 06:22:04       17 阅读
  6. Leetcode 146. LRU 缓存

    2024-07-21 06:22:04       15 阅读
  7. 代码扫描常见问题盘点-并发处理类/异常类

    2024-07-21 06:22:04       16 阅读
  8. GESP C++ 二级真题(2023年12月)T1 小杨做题

    2024-07-21 06:22:04       12 阅读
  9. Python网络编程:socket模块的入门与实践

    2024-07-21 06:22:04       18 阅读
  10. Perl文件系统过滤:数据筛选的艺术

    2024-07-21 06:22:04       19 阅读
  11. 【音视频】AAC编码器与ffmpeg生成AAC数据

    2024-07-21 06:22:04       15 阅读