Cách tính toán Apache Process Ram

Tác giả: Dương Nguyễn Phú Cường
Ngày đăng: 4 năm trước


Đếm các tiến trình Httpd: ps aux | grep 'httpd' | awk '{print $6/1024 " MB";}' Tính Trung bình
ps aux | grep 'httpd' | awk '{print $6/1024;}' | awk '{avg += ($1 - avg) / NR;} END {print avg " MB";}'

Here's what I've done to 'solve' it:
  1. Set MaxClients 7 (based on (1740.8Mb Memory on server - 900Mb for MySQL + other stuff) / 111Mb average usage per httpd process = 7.5747747747747747747747747747748)
Therefore:
<IfModule prefork.c>
StartServers       8
MinSpareServers    5
MaxSpareServers   20
ServerLimit      256
MaxClients         7
MaxRequestsPerChild  4000
</IfModule>
  1. Disable all Apache modules except for authz_host_modulelog_config_moduleexpires_moduledeflate_modulesetenvif_modulemime_moduleautoindex_modulenegotiation_moduledir_modulealias_modulerewrite_modulephp5_module
  2. Remove the mod_ssl package since the client isn't using https:// whatsoever.
I'll report back once this new configuration has been running a while to see if this solves it.
Some inspiration here was borrowed from: http://www.activoinc.com/blog/2009/08/31/performance-optimized-httpd-conf-for-magento-ecommerce/ and http://www.activoinc.com/downloads/httpd.conf-magento