VPS侦探论坛

 找回密码
 注册
查看: 3791|回复: 2

lnmp1.5 lnmpa模式下的apache版本为2.4.6,MPM模式不明

[复制链接]
发表于 2018-6-2 21:08:52 | 显示全部楼层 |阅读模式

军哥,上午换成lnmpa,502的问题基本没有了,但是httpd几个进程加起来的cpu占有率超过100%,甚至200%,而且一直有占用,于是怀疑需要优化。用httpd -V发现如下:
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.18.74.219. Set the 'ServerName' directive globally to suppress this message
Server version: Apache/2.4.6 (CentOS)
Server built:   Apr 20 2018 18:10:38
Server's Module Magic Number: 20120211:24
Server loaded:  APR 1.4.8, APR-UTIL 1.5.2
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture:   64-bit
Server MPM:     prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT="/etc/httpd"
-D SUEXEC_BIN="/usr/sbin/suexec"
-D DEFAULT_PIDLOG="/run/httpd/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"


发现这里的MPM模式是prefork,但是我去httpd.conf发现是event(默认安装)
这里有两个问题:
1、我看apache安装源码是2.4.33,为什么在lnmpa下是2.4.6?没有更新还是用老版本?
2、MPM模式编译的是prefork还是all,与httpd.conf配置似乎不符。

如果可能,请更新到最新版2.4.33,MPM模式默认为event。
感谢军哥
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2018-6-2 22:12:06 | 显示全部楼层

回复 1# 的帖子



版本问题搞清楚了,是在centos下又为了测试ab装了个httpd,卸载后去apache目录看正常。
但是httpd总是占用cpu,而且动辄60%以上,最高四个加起来有200%左右了。这个怎么优化?
阿里云 2核4G。
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2018-6-3 10:38:59 | 显示全部楼层

这个不是lnmp安装的apache,这是yum安装上的apache

event模式就是调整/usr/local/apache/conf/extra/httpd-mpm.conf 里event部分配置
<IfModule mpm_event_module>
    StartServers             3
    MinSpareThreads         75
    MaxSpareThreads        250
    ThreadsPerChild         25
    MaxRequestWorkers      400
    MaxConnectionsPerChild   0
</IfModule>
可以参考
MaxSpareThreads > StartServers * ThreadsPerChild
MaxRequestWorkers = ServerLimit * ThreadsPerChild
这两个公式调整参数
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-24 03:23 , Processed in 0.026384 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表