(Ask) Wordpress Optimization Setup

Hello,

As the title says, currently I have a wordpress site with around ~6000 post in it with monthly pageview ~4.5-5.0 million. It is currently hosted on a dedicated server with i3 proccesor (2C/4T), 8 GB of Memory and 1 TB of disk space and it is using almost 90-100% cpu usage all the time.

Currently it is using easyengine stack with wp redis and hhvm.

Now, before I upgrade the server for a beefier one, I would love to ask some suggestion on the setting / config to optimize the server performance to be able to handle the traffic and load. Current config is the default one, by easy engine script.

Thanks for any help :smile:

1 Like

Since WordPress talks to a MySQL Database all the time, it is more important to have a fast (better) harddisk as it is processing lots and lots of disk reading tasks.

To achieve an optimized setup for WordPress check if it is possible to get an SSD (solid state disk) instead of a usual HDD.

That will already improve performance of your WordPress powered site very much.

I am running three servers with each set up as follows (hardware-wise) :

  • Intel®Xeon® E5-26xxV3 (8 dedicated cores, each core 2.3Ghz)
  • 24GB DDR4 RAM
  • 320GB SSD
  • Raid10
  • Networking card 1Gbit/s
  • Data center located in Frankfurt, Germany (as I am Germany based and most of my clients as well)

One server is hosting 5 sites and not even coming close to 5% CPU usage :wink:

The others are hosting one site each plus a few additional cloud ERPs and other cloud softwares that my clients need for daily business.

All running smooth with easy engine setup.

Hope this helped a little

Maybe it’s your WordPress instance that’s the culprit, not the server setup. You may have a bad plugin or bad code in a theme that may be causing a memory leak.

You might need a performance audit.

Also, as SaskiaLund pointed out you will be better off with a E5 CPU and SSD hard drive.

I’ve done a similar setup once, Redis hardly causes any issue (As per my experience). hhvm is a memory eater, I had some memory leak issues with it. So, from my experience here are some of my suggestion.

  1. Performance tuning hhvm - https://github.com/facebook/hhvm/wiki/performance-tuning
  2. Restarting hhvm service when it gobbles up more than desired CPU%, Here is a simple bash script to tackle this issue - http://pastebin.com/bmTW4gma
  3. Have a fallback service like php-fpm as always backup in your production environment

I would consider doing some Varnish caching or a similar set up for that kind of traffic. I serve 180,000 users monthly on a 512 MB RAM 1GB swap VPS. My CPU is rarely above 5% as an average.

You need to look at the individual components, do you have any monitoring software installed so you can see how much RAM, CPU etc each daemon (nginx, php5-fpm, mysql) is using?

Have you run MySQLtuner lately? Looked at slow query logs?

Have you tried P3 Performance profiler or used Query monitor to see if you have a troublesome plugin sucking up all your CPU?

@SaskiaLund

Thank you for the suggestion.

It is correct with such hardware, I would get great improvement for performance. Unfortunately for a “hobby” website, that would be quite expensive to get those setup. I would like the cost as minimum as it can, but the performance isn’t too shaby (good price : performance ratio).

@AndreiChira

Thank you for the suggestion.

That’s also what I thought, but unfortunately I am not a webmaster guru so troubleshooting is kinda hard for me. But, after spending some times, I think I start to get a better idea of the cause. It seems that some of it, are from broken DB table that caused by Wordpress update… I found many inquiry of missing termmeta table on my hhvm error log. Will try to find the solution for it.

Also I try to separate the web server stack and database server stack so it will split the load, and hopefully will bring more stable and better performance. So far, by doing this I could reduce ~30-40% of the server load.

@abhisek

Thank you for those link, it is really useful and I could learn some things that I didn’t know before.

@blindpet

Thank you for the suggestion.

Hmm, I think web performance would be different as each website has its own characteristic. As for my own, almost all of the visitor do some searching of the post using the search function on our website. Thus, the db load could be quite high sometimes since each query runs quite deep on a few thousand post that I have. I try to solve this issue by migrating the DB server outside the main web server, and the load has been decreased. But, the hhvm load is still pretty high, I am starting to suspect there are some “bad code” on the themes/plugin that I use. I purchase the theme from theme forest, and the plugin are from wordpress plugin repository. I would love to do som code audit and tidying everything, but unfortunately that is out of my capability. Do you now, where I could hire a service to do such jobs? Preferably with a pretty good price, since the budget is quite tight.

You are right performance tweaking depends on the service type you are offering. If you need a lot of searches to perform quickly there are SQL optimizations and using sphinx to consider.

You can PM me and we can work something out. There are definitely some optimizations to do for your site.

You can try automatically fixing your database with:

mysqlchk -Ar
mysqlchk -Ao

The commands above usually solve at least 95% or my database inconsistency troubles.

Thank you for the suggestion. Will keep that in mind.

Today, I decide to do some clean reinstall, and migrate the website rather than using nginx+redis+hhvm, i decide to try out those php7 stack (nginx+redis+php7), and surprisingly the load is decreased by A LOT. now the server is stable on 20-30%. Should do some stability test, but I think my issue is finally finding it’s light of way out :smile:

1 Like