Apache2Buddyとは何ですか?
Apache2Buddyスクリプトを使用して、パフォーマンスと安定性を支援するApache®Webサーバー構成への変更に関する推奨事項を作成します。 Apache2Buddyはサーバー自体に影響を与えず、変更を加えません。スクリプトの実行後、検討して適用を検討できるApacheの修正が提案されます。
Apache2Buddyは、少なくとも次の懸念事項をチェックします。
- PHP®のメモリ制限
- Memcache
- MaxClients
- メモリ使用量
- 最大潜在メモリ使用量
- Apacheに割り当てられたRAMの合計の割合
- MaxRequestWorkers
Apache2Buddyを実行する
次のコマンドを実行して、Linux®コマンドラインからスクリプトを起動します。
curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/master/apache2buddy.pl | perl
Apache2Buddyスクリプトが完了すると、次のような出力が返されます。
Apache Tuning with Respect to RAM Footprint of Web Applications
--------------------------------------------------------------
The MaxClients setting in your Apache configuration allows your web application child processes
to consume more RAM than is available on the server.
---
[ -- ] Distro: CentOS
[ -- ] Version: 6.9
[ -- ] Codename: Final
[ OK ] This distro is supported by apache2buddy.pl.
[ -- ] Hostname: Server-01
[ -- ] Primary IP: 123.45.67.890
[ -- ] Apache is using prefork model.
[ OK ] Memory usage of parent PID is less than 50MB: 8368 Kilobytes.
[ -- ] Apache has been running 21d 06h 49m 32s.
[ -- ] Your server has 5834 MB of PHYSICAL memory.
[ -- ] Your ServerLimit setting is 60.
[ -- ] Your MaxClients setting is 60.
[ OK ] Current Apache Process Count is 22, including the parent PID.
[ -- ] Number of vhosts detected: 17.
[ -- ] |________ of which 13 are HTTP (specifically, port 80).
[ -- ] |________ of which 4 are HTTPS (specifically, port 443).
[ OK ] Current Apache vHost Count is less than maxclients.
[ -- ] Your MaxRequestsPerChild setting is 2000.
[ -- ] Your PHP Memory Limit (Per-Process) is 128 MB.
[ -- ] MySQL Detected => Using 134.74 MB of memory.
[ OK ] No large logs files were found in /var/log/httpd.
[ OK ] MaxClients has not been hit recently.
[ !! ] PHP Fatal errors were found, see summaries below.
[ @@ ] Check the logs manually.
[ @@ ] - /var/log/httpd/example.com-error.log-20200203: 3
[ @@ ] - /var/log/httpd/example.com-error.log: 5
[ @@ ] - /var/log/httpd/example2.com-error.log-20200203: 1
[ -- ] httpd is currently using 2384.92 MB of memory.
[ -- ] The smallest apache process is using 83.18 MB of memory
[ -- ] The average apache process is using 107.48 MB of memory
[ -- ] The largest apache process is using 133.83 MB of memory
[ !! ] Going by the average Apache process, Apache can potentially use 6448.81 MB RAM:
Without considering services: 110.54 % of total installed RAM
Considering extra services: 113.16 % of remaining RAM
[ !! ] Going by the largest Apache process, Apache can potentially use 8029.81 MB RAM:
Without considering services: 137.64 % of total installed RAM
Considering extra services: 140.90 % of remaining RAM
--------------------------------------------------------------------------------
### GENERAL FINDINGS & RECOMMENDATIONS ###
--------------------------------------------------------------------------------
Apache2buddy.pl report for server: Server-01 (123.45.67.890):
Settings considered for this report:
Your server's physical RAM: 5834 MB
Remaining Memory after other services considered: 5699 MB
Apache's MaxClients directive: 60 <---- Current Setting
Apache MPM Model: prefork
Largest Apache process (by memory): 133 MB
[ !! ] Your MaxClients setting is too high.
Your recommended MaxClients setting is between 37 and 42. <---- Acceptable Range (10% of MAX)
Max potential memory usage: 8029 MB
Percentage of TOTAL RAM allocated to Apache: 137.64 %
Percentage of REMAINING RAM allocated to Apache: 140.90 %
--------------------------------------------------------------------------------
次の例のようなApache2Buddyスクリプトからの出力も表示される場合があります。
[ !! ] Going by the average Apache process, Apache can potentially use 6448.81 MB RAM:
Without considering services: 110.54 % of total installed RAM
Considering extra services: 113.16 % of remaining RAM
[ !! ] Going by the largest Apache process, Apache can potentially use 8029.81 MB RAM:
Without considering services: 137.64 % of total installed RAM
Considering extra services: 140.90 % of remaining RAM
このステートメントは次のことを前提としていることを知っておく必要があります。
- 平均的なApacheプロセスを使用する :すべてのApacheプロセスが平均的なサイズであるとは限りません。一部のプロセスは、大きくなったり小さくなったりする場合があります。
- サービスを考慮せずに :Apache2Buddyyは、ApacheWebサーバーの可能なメモリ使用量を計算しようとします。使用可能なメモリが、PHP、MariaDB®、およびオペレーティングシステム自体などの他のアプリケーションにも使用されているとは見なされません。
- 追加サービスの検討 :Apache2Buddyは可能なを計算しようとします 他の利用可能なアプリケーションのメモリ使用量を想定しながら、ApacheWebサーバーのメモリ使用量。これは正しくない可能性があります。
注 :Apache2Buddyによって提供されたこのステートメントは、最悪のシナリオに関する情報であると見なす必要があります。明確にするために、さらに調査する必要があるかもしれません。詳細については、次のリンクを参照してください:https://richardforth.github.io/apache2buddy_ag/。