Suggestions on load balancing a WordPress Website
Heya guys,
I host a website (LEMP) which gets a lot of traffic, and the CPU hits a 100% at peak times (even on a dedicated server). So, I'm looking to do a basic load balancing setup, and add another dedicated server to the "cluster".
I tried hosting PHP-FPM on another server, and mounting the directories using NFS, and then load balancing only PHP using NGINX, but the requests were being processed very slowly, also the CPU load was somehow in the 1000s range, however the iowait was very low.
What solution would you suggest to accomplish this?
Thank you
Comments
Cache it, static it, or find another publishing product.
My pronouns are asshole/asshole/asshole. I will give you the same courtesy.
I wish I could, it's not my website, and migration isn't an option unfortunately. There's Redis Object Caching and CF Caching in place, and the CPU still maxes out inspite of that.
Throw one of the popular free caching plugins on there. Did that while loadtesting a WP site...dropped CPU usage to near zero
...don't recall which one I used, but one of the popular caching ones. Was actually surprised how effective it was
I have, I've spent over a day on this, trying to tweak it, experimenting with caching plugins, etc., it all came down to 1 plugin causing it. The site gets around 12-13k rt visitors at peak, so that might be it as well.
So - kill that plugin and tell them it will cost X to support. WP-SuperCache should handle the majority of needs if the site doesn't get by-the-minute updates.
My pronouns are asshole/asshole/asshole. I will give you the same courtesy.
Move the database to other server and redis to another one, and use w3 total cache. You can also put nginx in front of them as a proxy.
With Varnish, it will fly.
Then fucking remove PordWress..
My pronouns are asshole/asshole/asshole. I will give you the same courtesy.
Why not cache it on Nginx level? Cache the fastcgi response for certain time, so in that time any request received will be served from cache, won't even touch php. Off-course this strategy depends on how much dynamic your site is.
https://phpbackend.com/
I dont know how much is a lot OP referred to. But cache fastcgi really helpfull. I'm able to handle 10x traffic
Might be worth spending a bit on money on an hour or 5 of quality dev time to look at the plugin, a good dev may be able to spot the issue and tweak it for you @joepie91 @Solaire
https://inceptionhosting.com
Please do not use the PM system here for Inception Hosting support issues.
Yep, I'm trying to convince the website owner about that.
To the others suggesting NGINX caching etc, that was already in place. The plugin basically embeds videos from multiple video sites (vimeo, YT, etc.), but gets rid of how YT videos look generally (it probably gets the direct link from their CDN). So, for every view, the plugin has to process the request. Caching would be have probably worked if the generated page had a direct link to the video, and not smth like
domain.tld/wp-content/plugins/<video-embedder-plugin>/player.php?provider=fb&id=<randomid>
.aaah wow, I used a youtube embedder/grabber plugin on a site about 6 - 7 years ago, it was horrible, in the end I paid someone on freelancer.com about $50 to write a new one for me, if I still had it I would give it to you but that is long gone, it took them no time.
https://inceptionhosting.com
Please do not use the PM system here for Inception Hosting support issues.
Hah, an youtube grabber?!? Oh that pain.
However, did you read Nginx docs? They are pretty simple to follow and rich.
https://docs.nginx.com/nginx/admin-guide/load-balancer/http-load-balancer/
https://nginx.org/en/docs/http/load_balancing.html
You just have to make a mirror copy of your current server on new server. Then configure the "load balancing" nginx to proxy pass all incoming request to any of the working servers based on some criteria (round robin, least_connection.. etc)
How much CPU juice your current setup has? I would ensure max strength on my current setup before scaling out.
Because in my book, less moving parts means simpler architecture and better maintainability. Only scale when you've been maxed out.
https://phpbackend.com/
:P
Yeah, I'm doing it that way now. It was probably GlusterFS and NFS slowing things down. Moved to Unison for file replication, everything seems solid for now. The current machine has a R5 3600 (it was upgraded from a small 2 core, 8GB VPS).
Deleted. See comment below
VPS reviews | | MicroLXC | English is my nth language.
Was this stolen from WikiHow?
My pronouns are asshole/asshole/asshole. I will give you the same courtesy.
I would not know- came in a newsletter for WPLift. When I read it I recalled this thread and posted here.
VPS reviews | | MicroLXC | English is my nth language.
https://www.wikihow.com/Make-a-Realistic-Farting-Noise
My pronouns are asshole/asshole/asshole. I will give you the same courtesy.
Lol, that's a nice one. Anyhow, I got the client to switch to a better plugin for now, which actually works with the cache, and everything's so much better ^_^