0

I have a quick question for something I couldn't find while searching. I'm a total server noob so please don't get angry.

When I track CPU usage using ssh top I can the user process causing about 20 percent of CPU load when calling a website that is hosted on my server.

I have a VPS server with 8 cores and 16gigs of ram and realize that that 20 percent is just one core but still, I am surprised that one visitor can cause 20 percent usage of one of the cores.

What happens if let's say 50 users visit the site at the same time? That would in theory overload the CPU, right?

The server is running Plesk with an nginx as reverse proxy.

The process causing the load is PHP fpm and nginx barely shows up while looking at the ssh top screen.

Is that kind of short spike (2 seconds or so) normal for one visitor? And if so, how many wordpress websites can I host on this server with Let's say 20 concurrent visitors per site?

Thanks so much for your help.

0

You should consider installing some kind of caching plugin so your WordPress would cache responses & use them instead of generating a new page each time.

There are good guides about WordPress optimization here and here. There is a good chance that spikes will be gone if you'd follow those...

Make sure your got opcache enabled in your php.ini. If you want even further caching, try installing apcu module (though it might be tricky with Plesk) and plugin to support it on WordPress side

  • 1
    Also using an opcode cache like APC might help. – Marc Stürmer Feb 1 '17 at 6:26
  • PHP has caching built in and has for a long time now. – Tim Feb 1 '17 at 7:11
  • @Tim You still have to enable opcache manually by adding opcache.enable=1 to your php.ini. As for APCu it is not build it, since it doesn't have any "automagical optimization" & requires your PHP code to actually use its functions instead of those you would use naturally... – Anubioz Feb 1 '17 at 7:24
  • @Anubioz - interesting. But you don't need to install APC, which is more what I was referring to. It definitely helps to try to speed up PHP, but if you can avoid invoking PHP in some situations you can get a huge speedup. – Tim Feb 1 '17 at 7:35
  • @MarcStürmer APC is no longer an existing opcode cache. It was replaced with Zend OPcache some years ago. (And when it was a thing, it was terribly buggy and unstable...) – Michael Hampton Feb 1 '17 at 7:36
0

PHP takes a fair bit of CPU. 50 users browsing your website will only be making about 2-3 requests at a time. 50 simultaneous requests probably represents 1000 people using your website, and 50 (user) * .2 (CPU) = 10 (cores). Since you have 8 cores there'd be a bit of a delay, but not much.

Wordpress caching plugins are ok, but PHP is still invoked, which takes significant CPU and RAM. They reduce resource usage and increase performance. A better solution for websites that have a lot of anonymous users is page caching at the web server level. I have a tutorial on Nginx page caching for Wordpress which you may find interesting, but it could be too complex for you..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.