2

I'm trying to figure out how to load balance an application, such as WordPress. My server array would look like this:

  1. Load Balancer.
  2. Database Server.
  3. 2 or more application servers.

Most, if not all of the content will be stored in the database, so content won't be a problem, and deployments will also be solved by having both servers clone from a remote GIT repo, but what happens if someone uploads an image to one server? How would it get synced to the other?

I'm guessing that I could do this with rSync, but I feel that that is kind of outdated. Any recommendations would be greatly appreciated.

2 Answers 2

3

It seems that you need to look at DRBD, glusterfs, and similar products for real-time replication of your files. Of course, such solutions will be much more efficient if the network delay is too small like deploying them within the same LAN.

0
1

If the user-uploaded data is not cached, and/or is stored on a centralized network location, there isn't a problem.

Cached data is definitely a problem. There are at least a couple of general approaches.

  • Maintain session affinity ("sticky" sessions) with a particular web/application server. This essentially renders the stateless web application "stateful", and the application now has an implied connection timeout Typically through the load balancer has a timeout, and the web server has a connection timeout and/or an http keep-alive timeout. Load balancer timeouts can be a tougher nut to crack, as their resources may be more limited than just the application/web server.

  • If feasible, have an mechanism built-in to the application to synchronize created/modified/deleted data between partner web/application servers.

An intermediate caching solution such as Azure AppFabric may not be viable. Many applications that cache large data cannot achieve the same performance when using an intermediate cache, although that would need to be determined through testing.

2
  • Yea, I see what your saying. With WordPress at least, i'm okay with each application server maintaining their own individual cache. It be curious however, to see how I could put a caching layer in front of the two application servers, If I used NGINX as a load balancer, maybe I could use that same server to act as a caching layer as well. Feb 25, 2013 at 18:34
  • It really depends on the application. If there is a lot of cached data that is used with sophisticated dynamic queries, I haven't found anything that compares to an in-memory cache, which typically returns results in < 2 milliseconds. If it is a simple fetch of an object by id using a dictionary/hashtable, that may work fine with an intermediate cache.
    – Greg Askew
    Feb 25, 2013 at 18:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .