2

My website currently runs on a dedicated web server (with LiteSpeed) and dedicated MySQL database server. It's a download based site with a lot of user-generated content, which can be streamed and downloaded, there are also thousands of thumbnails and static content.

I'm at the stage where the web server can no longer handle the amount of traffic, so I'm looking a how best to increase capacity considering the large amount of downloadable content.

My host suggests mirroring everything on a second web server and distributing the load between them using either DNS Made Easy, or to have my own load balancer (using ldirector) in front of the two web servers.

Could anyone advise whether the above method would be the best option? Does any one have any experience with DNS Made Easy and/or ldirector?

I'd appreciate any help.

MDMarra
  • 100,734
  • 32
  • 197
  • 329
markxi
  • 43
  • 5

2 Answers2

2

First and foremost, you must understand where the bottleneck is located before you can make any progress.

Hosts are quick to recommend new hardware but in many cases, unless it is clear you have hardware limitations, new hardware may not yield significant improvements.

Adding hardware has diminishing returns if not done smartly. Going from one server to two may double your resources but you then need to go from 2->4, 4->8 to get the same bump.

Monitor and Measure

If you are not monitoring system metrics, load times and other data, then that is the first place to start. Free tools like Munin and systat are great on server solutions. Tools like http://Browsermob.com and http://webpagetest.org can provide you with user-focused metrics.

Segment Traffic

Typically a straight port of a complex media site to another server is not very effective. Often you will get superior results for your investment by segmenting traffic.

For example, we have a client with a very busy flash game site (millions of hits/day). We have offloaded the flash games to a pool of inexpensive servers running Nginx. These systems push out TB's of traffic/month. These are entry level boxes and all they serve up is static content.

Now on the cost side, these two entry boxes combined were 20% cheaper than the primary server. We gained more than a 4x capacity improvement. If we had just cloned the primary server and load balanced, I suspect at best the improvement would have been 1.5-1.8x.

In short, putting some effort into understanding the guts of the performance issue can save you a lot of money later on.

DNS Made Easy

This is a DNS solution and does not really address load balancing. They may be talking about round-robin DNS. Not really sure why this was brought into the equation at this stage.

Ldirector

This is a tool to manage nodes in a LVS cluster. Once again not sure whey this specific item was suggested. Typically we just use a load balancer (hardware or something like Nginx/HA-Proxy) and route traffic to the appropriate backend servers.

jeffatrackaid
  • 4,142
  • 19
  • 22
  • Many thanks for your reply and examples. The bottleneck seems to be a combination of CPU and disk performance. The server is a dual 5410 Harpertown, 2 x 750GB SATA RAID 1. I was actually wondering how to segment traffic, but if I move my download/static content to a separate pool of servers, I am not sure how I would then manage these files from my PHP scripts on the main web server; renaming, deleting, checking for file existence etc. It sounds like a real headache. – markxi Nov 26 '11 at 04:24
0

DNS-based load balancing is not good for several reasons:

  1. You can control how your servers will be accessed and you can't assign the traffic differently or evenly between the two servers.
  2. More importantly, this way of load balancing does not recognize server failure. So, you will lose part of the traffic if one of the servers fail unexpectedly.
  3. DNS caching makes it even worse.

I prefer to use a smarter load balancing technique like ldirector or haproxy. This type of load balancing enables you from distributing the traffic according to the servers specs and using several factors (load, number of conn, etc.).

There is one more important thing to note. You said you have a mysql DB and user content on the server. If you will be distributing the traffic between the two servers, you need to have a sync mechanism between the two servers. Otherwise, the users will not always see the same data when they access a different server each time.

Khaled
  • 36,533
  • 8
  • 72
  • 99