0

I have a VPS, with 2 GBytes of RAM on an Ubuntu 14 machine. After a while I decided to upgrade my packages in the machine, including installing the latest version of apache2 (2.4.7).

However, after a few days, problems have began to appear regarding my wordpress (v 4.0) installation. When I restart the apache server, it does fine, serving pages. Then, after a few hours, any request to the server takes 1-2 minutes to get a response. I don't have much traffic to the web server, to justify this delay. Not by a long shot. This also happens regarding HTML pages, not just PHP.

When I restart the apache server, everything is OK, until problems start again, after a few hours, when the server becomes unresponsive.

Here is my /etc/apache2/mods-enabled/mpm_prefork.conf file:

<IfModule mpm_prefork_module>
    StartServers            10
    MinSpareServers         10
    MaxSpareServers         30
    MaxRequestWorkers       100
    MaxConnectionsPerChild  2000
</IfModule>

I have also tried to increase those numbers (up to the point where the apache processes would consume as high as 1,6GB) to no avail.

I don't know many things about apache configurations, can anyone point me in the right direction to find the error?

csotiriou
  • 111
  • 5
  • 3
    So you configure it to have 10 servers, 100 workers per server and max 2000 connections per child (total: 1000 workers and 2 million max connections) and wonder you need more memory than 2gb? You likely swap like crazy due to using a lot more memory than you have. I suggest reviewing those limits. – TomTom Nov 03 '14 at 10:51
  • MaxConnectionsPerChild is the amount of requests a child will serve before being recycled, not the amount of concurrent requests. His configuration will serve at most 30x100 connections. – ThoriumBR Nov 03 '14 at 12:08
  • 1
    Try to look at Apache configuration and disable all the unused modules. They consume a sizable amount of memory if all are enabled. – ThoriumBR Nov 03 '14 at 12:10
  • 1
    RAM usage is not the problem. My RAM usage with this configuration does not exceed 512MBytes. – csotiriou Nov 03 '14 at 12:37
  • 2
    You will probably find it useful to enable server-status and `ExtendedStatus on` and graph the results of the states of the workers. I have observed a similar set of symptoms to yours with Apache 2.4. Mine shows that roughly every 8 hours, all the existing workers switch to the "Gracefully restarting" state and a new set of normal ones are spawned. Your problem is clearly different to mine but the information you get will probably still be useful. – Ladadadada Nov 03 '14 at 15:13

2 Answers2

1

Turns out that I was the victim of xmlrpc attacks on wordpress.

I checked the logs and saw hundreds of requests on my xmlrtc.php wordpress file, by a single entity. I changed my .htaccess file to contain one additional rewrite rule:

RewriteRule ^xmlrpc.php$ "http://0.0.0.0/" [R=301,L]

And so far I have not experienced any problems.

csotiriou
  • 111
  • 5
-1

Have a look over the error log in apache. You might check if you find any incompatibility between your new apache version and the older PHP version

  • Checking error logs is generally good advice but I'm not sure where you got the idea that he is using an older PHP version or that there would be conflicts with Apache or that those conflicts would cause the symptoms he describes. Could you elaborate a little? – Ladadadada Nov 03 '14 at 14:59