Server was real fast, now quite slow (server performance / optimization)

September 3, 2014 5.1k views


I have a few DO droplets up&running. At the beginning, one droplet was not too fast, so I started installing newer PHP version, OPCache, increased a few values in my php.ini, etc.

After this, the server was crazy fast. Everything loaded instantly on my site after clicking, never been this fast.

However, suddenly everything is back to quite slow again. I checked my php.ini and the values are still pretty high. (max_input_vars 10000, memory_limit 384M,
post_max_size 256M)

This is ok right?

What could be the problem? I run a seperate DB server. So 2 droplets, both 1 gig one is the website server (lamp with virtualmin setup), one is the DB (just myssql).

I did top on both servers but nothing crazy shows up.

I hop someone can help, thanks a lot!

3 Answers

Some things to look for:

  • Are non-php files slow as well, or just php files?
  • How much memory is php using?
  • How much memory is apache or nginx using?
  • How many apache or nginx processes are running when it's slow?
  • Is it fast right after you restart php, apache, nginx?
  • What is cpu/load at when it's slow?
  • How about over on the mysql server, memory used and load?
  • Thanks for this!

    I checked mem and cpu usages using TOP command. There was at max 30% mem consumption and CPU was at max like 15% on the webserver and 5% on the db server.

    The 30% I was talking about is all apache on the webserver. On the dbserver it was mysqld. There are 6 apacha processes active on the webserver.

    I was just thinking about something. Recently, I added multilangual functionality to my program. I have written a custom PHP program which I am talking about which was real fast and now very slow. Since I just needed multilangual for a few parts I implemented this with a $lang variable, where I store translated strings in. This variable is quite big now. Could it have something to do with that variable? If so, what can I do to have my server load this big variable faster?

    Ps. I guess it is just PHP files that are slow, images are loading fine.

    Thanks again!

  • So I disabled my multilangual and still everything was real slow. I guess it has to be something else. Strang thing is that I run a Magento demo store and my program on the same server. The demo store is working quite ok. I did not change anything to my program recently, but still it is real slow.

    It was blazing fast once.

    Restart of apache or mysql did not make it faster..

    Where do I look now? I guess you could say my code is just bad or something , but that would not explain why it worked OK before.

    I tested the page on Google developers pagespeed insight, and they said:
    Decrease the response time of your server. It took 9,3 seconds before we got response.

    9.3 seconds is crazy right? How can I increase this?

Anyone ideas?


DO made a change to the server or something back then. But I afterwards found out that the real reason was a particular script doing a request to external site which responded real, real slow. I disabled that request and everything was real fast again. The reason why requests were that slow I do not know yet. I did not really need the request on that script so I removed it, but currently I need it on another script and I`m looking into this now. I will update this question if I have found the problem.

Have another answer? Share your knowledge.