我对我的symfony项目的api请求消耗了大量内存和cpu,每个请求占用约3.4%的ram和〜3-5%的cpu。我正在使用Apache HTTP Server和mysql db。
server: memory 4gb
cpu: Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
OP: Ubuntu 16.04.5 LTS
this is what apache2buddy says:
--------------------------------------------------------------------------------
### GENERAL FINDINGS & RECOMMENDATIONS ###
--------------------------------------------------------------------------------
Apache2buddy.pl report for server: localhost ():
Settings considered for this report:
Your server's physical RAM: 3951 MB
Remaining Memory after other services considered: 3779 MB
Apache's MaxRequestWorkers directive: 167 <--------- Current Setting
Apache MPM Model: prefork
Largest Apache process (by memory): 25 MB
[ !! ] Your MaxRequestWorkers setting is too high.
Your recommended MaxRequestWorkers setting (based on available memory) is between 134 and 149. <------- Acceptable Range (10% of MAX)
Max potential memory usage: 4215 MB
Percentage of TOTAL RAM allocated to Apache: 106.69 %
Percentage of REMAINING RAM allocated to Apache: 111.54 %
--------------------------------------------------------------------------------
A log file entry has been made in: /var/log/apache2buddy.log for future reference.
最近5条记录:
2019/07/12 16:57:05 Uptime: "0d 0h 22m 45s" Model: "Prefork" Memory: "3951 MB" MaxRequestWorkers: "150" Recommended: "167" Smallest: "8.94 MB" Avg: "18.20 MB" Largest: "22.59 MB" Highest Pct Remaining RAM: "89.37%" (85.77% TOTAL RAM)
2019/07/12 17:23:31 Uptime: "0d 0h 49m 06s" Model: "Prefork" Memory: "3951 MB" MaxRequestWorkers: "206" Recommended: "169" Smallest: "8.94 MB" Avg: "18.20 MB" Largest: "22.33 MB" Highest Pct Remaining RAM: "121.32%" (116.43% TOTAL RAM)
2019/07/15 14:06:57 Uptime: "0d 22h 56m 14s" Model: "Prefork" Memory: "3951 MB" MaxRequestWorkers: "167" Recommended: "181" Smallest: "9.98 MB" Avg: "14.94 MB" Largest: "20.86 MB" Highest Pct Remaining RAM: "92.21%" (88.18% TOTAL RAM)
2019/07/18 17:26:49 Uptime: "2d 03h 05m 42s" Model: "Prefork" Memory: "3951 MB" MaxRequestWorkers: "167" Recommended: "167" Smallest: "9.49 MB" Avg: "16.96 MB" Largest: "22.61 MB" Highest Pct Remaining RAM: "99.92%" (95.57% TOTAL RAM)
2019/07/18 17:28:36 Uptime: "2d 03h 07m 29s" Model: "Prefork" Memory: "3951 MB" MaxRequestWorkers: "167" Recommended: "149" Smallest: "9.65 MB" Avg: "17.49 MB" Largest: "25.24 MB" Highest Pct Remaining RAM: "111.54%" (106.69% TOTAL RAM)