-1

I am working on one server having 16GB of RAM. It runs on Apache with php-fpm. The site hosted on this server is taking about 10 seconds to load. First I thought that it's a resources issue, but when I checked memory usage, It's showing me that about 10GB of memory is available!

Here is the output of free -m command.

          total        used        free      shared  buff/cache   available
Mem:      16046        5016        2972         265        8057       10138
Swap:      1023          88         935

I checked php.ini for memory_limit and it is set to 2048MB. The site hosted on this server runs on Wordpress and WooCommerce.

Here is the mpm_event.conf file settings.

<IfModule mpm_event_module>
    ServerLimit              925
    StartServers             4
    MinSpareThreads          25
    MaxSpareThreads          75
    ThreadLimit              128
    ThreadsPerChild          128
    MaxRequestWorkers        925
    MaxConnectionsPerChild   1000
</IfModule>

I don't know what's wrong here. Anything I can do to allow Apache and PHP to use more memory which is available on the server?

p01ymath
  • 129
  • 5
  • Who says it *needs* more memory? – psusi Apr 10 '18 at 12:36
  • Response time is 5-7 seconds and available memory is 10GB. – p01ymath Apr 10 '18 at 12:45
  • There is no necessary correlation between memory availability and response time. There are many things that can make a site slow. If there is free memory, the system would use it automatically if necessary. – Sven Apr 10 '18 at 12:58
  • oki dokki! thanks for downvoting the question and letting me know that there is no relation between memory availability and response time. I will let you know how I solved this issue. – p01ymath Apr 10 '18 at 13:02
  • Are you *sure* your applications need more ram? Did you set you PHP to at "memory_limit",-1" (removing all limits)? – bjoster Apr 10 '18 at 14:46

2 Answers2

0

I had to optimize the Apache/PHP on some customer's site in the past.

In this customer's case, I found that the Apache is loading many modules which are not being used, so in this case, I've unloaded the modules that weren't in use and the site started loading much faster.

The following modules are known to be very resource hungry:

PHP
SSL
Rewrite
Perl
Python
Rack / Ruby / Passenger

So it is best to disable the ones you don't use.

It is also important to calculate how much MB ram each session requires and to optimize Apache accordingly.

Also, I recommend you to check out this resource, it may contain information which you will find useful.

Itai Ganot
  • 10,424
  • 27
  • 88
  • 143
0

You said you checked your php.ini, have you tried increasing that 2048 number?

You can also increase the memory available to Wordpress by modifying your wp-config.php and adding the line:

define('WP_MEMORY_LIMIT', '256M');
Mike M
  • 1,132
  • 4
  • 11
  • I increased value from `1024M` to `2048M`, but it didn't make any difference. – p01ymath Apr 10 '18 at 12:49
  • It made difference but very less. about 500MB. – p01ymath Apr 10 '18 at 12:50
  • If it's not using the memory available to it, then you probably don't have a memory issue. How fast does the site load without any plugins or third party themes enabled? – Mike M Apr 10 '18 at 12:56