Linux 为什么两个不同的系统在apache2中每个进程使用的内存有这么大的差异?
我有一对Ubuntu专用服务器 服务器1:Linux 为什么两个不同的系统在apache2中每个进程使用的内存有这么大的差异?,linux,ubuntu,apache2,ram,Linux,Ubuntu,Apache2,Ram,我有一对Ubuntu专用服务器 服务器1: Ubuntu 16.04.7 (64 bits) 16GB RAM 8 Xeon CPU Apache 2.4.18 MPM mode: prefork 服务器2: Ubuntu server 20.04.2 (64 bits) 32GB RAM 8 Xeon CPU 2.4.41 MPM mode: event 在服务器1上,每个apache2进程使用7MB到18MB的RAM ps axo 'user rss cmd' | grep apache
Ubuntu 16.04.7 (64 bits)
16GB RAM
8 Xeon CPU
Apache 2.4.18
MPM mode: prefork
服务器2:
Ubuntu server 20.04.2 (64 bits)
32GB RAM
8 Xeon CPU
2.4.41
MPM mode: event
在服务器1上,每个apache2进程使用7MB到18MB的RAM
ps axo 'user rss cmd' | grep apache | grep -v "\(root\|grep\|tomcat\)"
www-data 18232 /usr/sbin/apache2 -k start
www-data 11700 /usr/sbin/apache2 -k start
www-data 11276 /usr/sbin/apache2 -k start
www-data 10792 /usr/sbin/apache2 -k start
www-data 11216 /usr/sbin/apache2 -k start
www-data 11600 /usr/sbin/apache2 -k start
www-data 10336 /usr/sbin/apache2 -k start
www-data 11356 /usr/sbin/apache2 -k start
www-data 11348 /usr/sbin/apache2 -k start
www-data 10980 /usr/sbin/apache2 -k start
www-data 11316 /usr/sbin/apache2 -k start
www-data 6808 /usr/sbin/apache2 -k start
ps axo 'user rss cmd' | grep apache | grep -v "\(root\|grep\|tomcat\)"
www-data 120436 /usr/sbin/apache2 -k start
www-data 119784 /usr/sbin/apache2 -k start
www-data 128720 /usr/sbin/apache2 -k start
www-data 130208 /usr/sbin/apache2 -k start
在Server2上,每个apache2进程使用120MB到130MB的RAM
ps axo 'user rss cmd' | grep apache | grep -v "\(root\|grep\|tomcat\)"
www-data 18232 /usr/sbin/apache2 -k start
www-data 11700 /usr/sbin/apache2 -k start
www-data 11276 /usr/sbin/apache2 -k start
www-data 10792 /usr/sbin/apache2 -k start
www-data 11216 /usr/sbin/apache2 -k start
www-data 11600 /usr/sbin/apache2 -k start
www-data 10336 /usr/sbin/apache2 -k start
www-data 11356 /usr/sbin/apache2 -k start
www-data 11348 /usr/sbin/apache2 -k start
www-data 10980 /usr/sbin/apache2 -k start
www-data 11316 /usr/sbin/apache2 -k start
www-data 6808 /usr/sbin/apache2 -k start
ps axo 'user rss cmd' | grep apache | grep -v "\(root\|grep\|tomcat\)"
www-data 120436 /usr/sbin/apache2 -k start
www-data 119784 /usr/sbin/apache2 -k start
www-data 128720 /usr/sbin/apache2 -k start
www-data 130208 /usr/sbin/apache2 -k start
为什么使用了如此多的内存差异
在阅读了一些文档和谷歌搜索之后,我想到了加载的模块,但每台服务器之间并没有太大的区别
服务器1
# apache2 -M
Loaded Modules:
core_module (static)
so_module (static)
watchdog_module (static)
http_module (static)
log_config_module (static)
logio_module (static)
version_module (static)
unixd_module (static)
access_compat_module (shared)
actions_module (shared)
alias_module (shared)
auth_basic_module (shared)
auth_digest_module (shared)
auth_openidc_module (shared)
authn_core_module (shared)
authn_file_module (shared)
authz_core_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
bw_module (shared)
cgi_module (shared)
dav_module (shared)
dav_fs_module (shared)
dav_lock_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
expires_module (shared)
fcgid_module (shared)
filter_module (shared)
headers_module (shared)
include_module (shared)
mime_module (shared)
mpm_prefork_module (shared)
negotiation_module (shared)
proxy_module (shared)
proxy_balancer_module (shared)
proxy_fcgi_module (shared)
proxy_http_module (shared)
rewrite_module (shared)
setenvif_module (shared)
slotmem_shm_module (shared)
socache_shmcb_module (shared)
ssl_module (shared)
status_module (shared)
suexec_module (shared)
userdir_module (shared)
服务器2
# apache2 -M
Loaded Modules:
core_module (static)
so_module (static)
watchdog_module (static)
http_module (static)
log_config_module (static)
logio_module (static)
version_module (static)
unixd_module (static)
access_compat_module (shared)
aclr_module (shared)
actions_module (shared)
alias_module (shared)
auth_basic_module (shared)
auth_digest_module (shared)
auth_openidc_module (shared)
authn_core_module (shared)
authn_file_module (shared)
authz_core_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgid_module (shared)
dav_module (shared)
dav_fs_module (shared)
dav_lock_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
fcgid_module (shared)
filter_module (shared)
headers_module (shared)
include_module (shared)
mime_module (shared)
mpm_event_module (shared)
negotiation_module (shared)
proxy_module (shared)
proxy_balancer_module (shared)
proxy_fcgi_module (shared)
proxy_http_module (shared)
remoteip_module (shared)
reqtimeout_module (shared)
rewrite_module (shared)
security2_module (shared)
setenvif_module (shared)
slotmem_shm_module (shared)
socache_shmcb_module (shared)
ssl_module (shared)
status_module (shared)
suexec_module (shared)
unique_id_module (shared)
userdir_module (shared)
我已经在Server2上将MPM模式从Event更改为Prefork,结果相同
我还可以检查什么来理解这种差异?问题在于模块安全性2 启用模块后(每个进程120-160MB) 禁用模块时(每个进程9-15MB)
您可以在此处进行电子邮件对话:可能是事件MPM的线程?您是否尝试过将Server2配置为像Server1一样使用MPM Prefork?感谢@studersi的回答,是的,正如我已经说过的,我已经在Server2上将MPM模式从Event更改为Prefork,结果相同。您好(我是apache用户的Dino)。您可以关闭自己的答案作为接受。谢谢,完成了!谢谢@dAm2K