What goes in to making a web site that needs to scale?

I am planning to build an application that will get a large amount of traffic. (Please don't say I won't get traffic, this is for an internal network, so the traffic will be there. Just trying to avoid the 'You won't get that much traffic, don't worry about it.)

As for what type of traffic I'm expecting, users will browse various dynamically created (based on user account details). On those sites the user may submit text inputs. Both loading the pages and handling user input will hit the database. Loads will obviously be reads, but handling input will require both reads & writes. Inputs may also affect other users views. If this happens, I will need to notify the other users to refresh the page.

What sorts of things do I need to do so that it doesn't simply crash under the load of a large amount of users?

What becomes the limiting factors? Database stuff? I/O with front end?

I've never really developed a serious web app before and am looking for some help.

EDIT: I was considering using Erlang for the backend since I've used it a little bit and really like all the concurrency stuff. Would this be a viable choice or should I try for something more traditional?


This is a very big topic, and you'll probably want to do as much research as time allows. There are several big topics to consider.

  • Session state storage. Obviously, session storage takes up memory or disk space. You need to have a strategy to store session information properly and in a way that can be used by a web farm.

  • Caching. A robust caching strategy can reduce loads dramatically. Do lots of research as to when, what and where you should be caching.

  • Scalability and load testing. Extra thought has to go into each resource fetching operation to make sure that it's being done as few times as necessary. Load testing and code profiling can help identify bottlenecks here if you use good tools.

  • Database optimization. Make sure you understand how to properly optimize your database for thousands (millions?) of operations per minute. If your application is write-heavy, you may need to look at warehousing older data that doesn't need to be included in indexes anymore to speed up your write operations.

  • Upgrade path. Is your traffic going to ramp up over time? Be sure to understand how you would plug in more servers and memory to your application if/when it's needed, and what would be required.

  • There are lots of books around that you could invest in that would probably pay off in big dividends. Do a search for "building scalable web applications" at amazon or chapters and you'll probably find lots of texts to go on, both technology specific and agnostic.


    In addition to everything else mentioned here, you should be looking at the timing of your traffic. Is it relatively constant over time? Or does it come in bursts, where you'll get a much higher amount of traffic in a short period of time?

    By and large, you'll want to design a system that can handle the peak loads gracefully (though not necessarily at the ideal performance level). If your traffic is very bursty then you'll have to devote more effort to making it scale than you would if you got the same amount of traffic gradually.


    As far as Erlang goes: it sounds like an acceptably good language (based on the little I know about it), but it is certainly not a magic wand that gives you scalability. There's dozens of different factors and products to consider. Language choice is but one of them... and probably one of the least significant ones.

    You may be better of going with what you already know & learning how to make it scale, rather than going to a new/unknown technology and hoping that it scales for you.

    链接地址: http://www.djcxy.com/p/53442.html

    上一篇: Django的规模如何?

    下一篇: 有什么需要制作一个需要扩展的网站?