0

My initial website will not experience heavy traffic during beta. But assuming success, when traffic builds I will need to implement plans to handle increased traffic from being aware of it to actually dealing with it. I'd like to start studying that now.

But there is an amazing wealth of information about this on the web. I was hoping someone might help me cut through the volumes of information by pointing me in the right direction with articles/walkthroughs/etc that are more practical and less theoretical? And of course any direct guidance on the issue would certainly be appreciated.

I am currently using a hosting provider, not running my own IIS server.

Alan
  • 1,587
  • 3
  • 23
  • 43

2 Answers2

3

It's very difficult to predict where your scaling bottlenecks will be. If you're missing a database index for example, queries might run slow, and load balancing your web server won't help.

To start with, you should get comfortable with profiling your application. There's a lot of great tools for the backend, including the Visual Studio Profiler, ANTS Profiler and my favorite, dotTrace.

Next (or maybe first, it doesn't matter), you'll want to profile the client side. Chrome Developer Tools works great, or you can use the new Firefox Developer. This will show you response times and how long it's taking to load assets, like your CSS/Javascript/Images/etc.

After doing both, you should have a good idea where your problem is. But in general, the "easiest" way to improve scaling is:

  • Bundle/minify/compress your asset files. You can remove hundreds of KB from page loads.
  • Use a CDN. Browsers are limited by domain in the number of simultaneous connections they can make to fetch assets. With a CDN, you can split the requests between domains, and for popular libraries like jQuery, they're more likely to already be cached.
  • Cache data as appropriate. If there's some mostly static content that never changes, cache it instead of querying your database every time. Take advantage of things like Output Caching, where your entire rendered view is cached.
  • Check out some of the checklist items in this post.

Once you've taken all those steps, if you still have problems, then you can look at things like load balancing and better hardware. Otherwise, you risk throwing money away when it might not make a difference at all.

mfanto
  • 14,168
  • 6
  • 51
  • 61
  • Thx! That last link is a great source of info. Reviewing your suggestions, I believe learning how to profile both client and app is likely my first task; wouldn't have known that w/o your suggestion. My app already does the bundle/minify/etc., so that's good. I get caching, though hadn't enabled it yet. I have to study CDN's. I'd like to focus on one final topic in the next comment. – Alan Jul 29 '15 at 18:40
  • The remaining part that is still fuzzy for me is how my app is actually spread across multiple servers. Once it's clear the app is running as best as reasonably possible, eventually traffic overtakes the ability for a single server to handle the load, right? When that happens, is that something I have to handle, and if it is, what do I have to do? Or is this handled automatically by something like IIS, or by the hosting provider in some other way? – Alan Jul 29 '15 at 18:44
  • Yep, exactly. Eventually your single server might not be able to keep up with all your requests. How you configure load balancing though depends entirely on your hosting provider. Microsoft Azure (which I highly recommend) provides their [Traffic Manager](https://azure.microsoft.com/en-us/services/traffic-manager/) service, which does a lot of the work for you. You can round-robin to different servers, or provision servers in different parts of the world (so European visitors get sent to European servers, for example), or any combination of load balancing and fail-over. – mfanto Jul 29 '15 at 18:59
  • But in general, you will need to do some configuring at your hosting level. Say you have 2 servers. If you select round-robin, then Visitor 1 gets directed to Server A. Visitor 2 gets directed to Server B, Visitor 3 gets directed to Server A, ... and so on and so forth. – mfanto Jul 29 '15 at 19:01
1

It's great to familiarize yourself with all aspects of a web application. However, load balancing is one of those things that can be tricky to set up, but is nigh impossible to set up right without a very comprehensive knowledge of server and networking architecture and experience. Even the big boys like Twitter and Facebook struggle with handling scale. It's very much a learn as you go process and extremely particular to individual circumstances. An absolutely perfect setup for one application may be completely useless for another.

If you're successful enough to need load-balancing, you're likely also successful enough to hire an infrastructure expert to take care of it for you. Short of that, you can utilize services like Azure, which while they have their own learning curve, provide load balancing nearly out of the box.

Chris Pratt
  • 232,153
  • 36
  • 385
  • 444