If I'm at the wrong place to ask this kind of question, please point me to the right direction, i'd appreciate very much!

My setup

I'm hosting a Drupal website on a VPS. Here are the specs:

The VPS commercial denomination is E3-SSD-2-32 - E3-1225v2 - 32GB - SoftRaid 3x120GB SSD. I'm not an expert but this is what I get: 32GB of RAM is a lot. And the hard drive is SSD which is supposed to mean fast read and writes. Also I think it has 3 CPU cores, but like I said I'm shit in hardware...

According to Google Analytics:The website has about 50,000 daily users and between 300 and 500 users are browsing at any given time.

My problem

At some times of the day (around lunch time), the server response time is insanely slow (up to 20 seconds to show a page), and sometimes, the connection just times out and chrome shows the grey error page.

What I've looked into

-> Apache2 MaxRequestWorkers

I've used Apache2Buddy to help me tune Apache2 MaxRequestWorkers.

Here's the complete Apache2Buddy output: https://pastebin.com/PQKrrcCz

Here's my current /etc/apache2/mods-enabled/mpm_prefork.conf:

<IfModule mpm_prefork_module>
        StartServers             5
        MinSpareServers          5
        MaxSpareServers          10
        ServerLimit              1300
        MaxRequestWorkers        1300
        MaxClients               1300
        MaxConnectionsPerChild   0

-> Caching

I've also enabled caching in Drupal to reduce Mysql load.

-> htop

Here's the output of htop taken when the website was being slow: https://imgur.com/a/gObNfyP

According to htop, the memory usage is 2.75GB, and the CPUs are only at 4% usage.

What I don't get is that Apache2Buddy is telling me that Apache is using about 9GB of RAM while htop says total RAM usage is 2.75GB.

The only clue I have...

When I restart apache with apachectl restart the website starts to work normally again... only until the next crisis...

Seriously I'm starting to lose hope here so any help would be very much appreciated.....

migration rejected from superuser.com Oct 5 at 13:13

This question came from our site for computer enthusiasts and power users. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as too broad by Rob, John Conde Oct 5 at 13:13

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • There can be many possible reasons. Are you using any CDNs? I take it that other websites load at a reasonable speed on your device at the time you have slow access times on your website? – Chris Rogers Oct 4 at 14:28
  • There's too many reasons why this could be occurring not least of which could be your code. You should profile it and make sure it is efficient. – John Conde Oct 5 at 13:14