Setup Wordpress Load Balancer

Status
Not open for further replies.

MediaStar

Active Member
2,664
2010
446
235
Hello guys,

I read some guide about wordpress with load balancer.

My question is, if we create some post and upload some file (like image file) during the load balancer read server 1 how can it copied image to server 2?

The content will stored on database server (example server 3), so how about the image i uploaded into server 1, when load balancer read server 2 the image will not display right because it was stored on server 1?
 
3 comments
Hello,

You can use CDN and that will be cheaper. There can be other solutions like roundrobin but it is preferable to use hardware load balancer, but it is quite costly solution. Something like $500. So, if you really need it, you can consider it
 
Hi MediaStar,

Yes, your assumption is correct, you would need a way to replicate the content on all of your web servers OR have all your web servers reference an external server for all the media content. This way you can decouple the dynamic content (i.e. your wordpress blog posts) from the media content (i.e. images).

One possible setup is a bunch of servers like this:
  • wordpress01 (web server with wordpress)
  • wordpress02 (web server with wordpress)
  • static (web server used for keeping local files)
Whenever you create a a new post on either servers, you can just reference the image from the static server (smth like static.mydomain.com/images/my_funny_image.jpg).

Of course (but this seems beyond the scope of this article), there's the question of how to actually replicate post content between the web servers. There a couple of ways this could be done, but again, this is really beyond the scope of this article.

Cheers,
inz
 
Hello guys,

I read some guide about wordpress with load balancer.

My question is, if we create some post and upload some file (like image file) during the load balancer read server 1 how can it copied image to server 2?

The content will stored on database server (example server 3), so how about the image i uploaded into server 1, when load balancer read server 2 the image will not display right because it was stored on server 1?

Use nginx proxy cache as media cache for X Amount of time and point it to the server where you have media located. It wil read image only once and put it on disk cache. Instead of using wordpress load balancer i would suggest upgrading your php to php7.4 which has amazing memory cache features and it's faster 10x than php-opcache. If you don't receive milions of traffic each day load balancer is no needed good server config tuning will do the job.
 
Status
Not open for further replies.
Back
Top