GNU/Linux >> Linux Esercitazione >  >> Linux

Utilizzo dello script Apache2Buddy per prestazioni e stabilità

Cos'è Apache2Buddy?

Utilizzare lo script Apache2Buddy per fornire suggerimenti per le modifiche alla configurazione del server Web Apache® che aiutano con prestazioni e stabilità. Apache2Buddy non ha alcun impatto sul server stesso e non apporta modifiche. Dopo l'esecuzione, lo script suggerisce correzioni Apache che puoi esaminare e considerare di applicare.

Apache2Buddy controlla almeno le seguenti aree di interesse:

  • Limiti di memoria PHP®
  • Meccanica
  • MaxClient
  • Utilizzo della memoria
  • Utilizzo massimo della memoria potenziale
  • Percentuale della RAM totale assegnata ad Apache
  • MaxRequestWorkers

Esegui Apache2Buddy

Eseguire il comando seguente per avviare lo script da una riga di comando di Linux®:

curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/master/apache2buddy.pl | perl

Dopo che lo script Apache2Buddy è stato completato, restituisce qualcosa di simile al seguente output:

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  %
--------------------------------------------------------------------------------

Esamina i risultati

Potresti anche vedere l'output dello script Apache2Buddy simile al seguente esempio:

 [ !! ] 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

Dovresti sapere che questa affermazione fa le seguenti ipotesi:

  • Seguire il processo medio di Apache :Non tutti i processi Apache sono di dimensioni medie. Alcuni processi potrebbero essere più grandi o più piccoli.
  • Senza considerare i servizi :Apache2Buddyy tenta di calcolare il possibile utilizzo della memoria del server Web Apache. Non considera che la memoria disponibile venga utilizzata anche per altre applicazioni come PHP, MariaDB® e il sistema operativo stesso.
  • Considerando servizi extra :Apache2Buddy tenta di calcolare il possibile utilizzo della memoria del server Web Apache mentre si fanno ipotesi sull'utilizzo della memoria di altre applicazioni disponibili, che potrebbero non essere corrette.

Nota :Dovresti considerare questa affermazione fornita da Apache2Buddy come informativa sullo scenario peggiore. Potrebbe essere necessario indagare ulteriormente per ottenere chiarezza. Per ulteriori informazioni, vedere il seguente collegamento:https://richardforth.github.io/apache2buddy_ag/.


Linux
  1. 7 trucchi pratici per usare il comando wget di Linux

  2. Che cos'è una versione continuativa di Linux e qual è il vero vantaggio del suo utilizzo

  3. convenzione di denominazione per script di shell e makefile

  4. Ambito variabile per gli script e le funzioni della shell bash nello script

  5. Utilizzo del modem per l'invio della registrazione vocale

Suggerimenti per l'utilizzo del comando top in Linux

Best practice DNS per sicurezza e prestazioni

La guida completa per l'utilizzo di ffmpeg in Linux

Le 10 migliori cache Web Linux per prestazioni migliori

Le 5 migliori distribuzioni Linux per sviluppatori e programmatori

Scrittura e debug di applicazioni C++ Linux da Visual Studio usando il sottosistema Windows per Linux