Friday, May 29, 2020

Apache : Boost the Performance

Always keep Apache updated to its latest version

# httpd -v - (centos)
# apache2 –v (ubuntu)

 Used the Multi-Processing Module (MPM)

The event MPM is the default MPM in most Apache installations 
for versions 2.4 and above. It is similar to the worker MPM in that it 
also creates multiple threads per child process but with an advantage: 
it causes KeepAlive or idle connections 
(while they remain in that state) to be handled by a single thread,
thus freeing up memory that can be allocated to other threads.
This MPM is not suitable for use with non-thread-safe modules
like mod_php, for which a replacement such a PHP-FPM must be used instead.

# /etc/httpd/conf.modules.d/00-mpm.conf (centos)
# /etc/apache2/mods-available/<mpm>.load (ubuntu)

Uncomment:
LoadModule mpm_event_module modules/mod_mpm_event.so

Comment out other MPMs version:

The prefork MPM uses multiple child processes without threading. Each process handles one connection at a time without creating separate threads for each. Without going into too much detail, we can say that you will want to use this MPM only when debugging an application that uses, or if your application needs to deal with, non-thread-safe modules like mod_php.

The worker MPM uses several threads per child processes, where each thread handles one connection at a time. This is a good choice for high-traffic servers as it allows more concurrent
connections to be handled with less RAM than in the previous case.

Restart the web server

# systemctl restart httpd php-fpm && systemctl enable httpd php-fpm

Related Posts:

0 comments:

Post a Comment