views:

309

answers:

6

Currently I am working on web based application. I want to know what are the key factors a designer should take care while designing scalable web based application ?

+1  A: 

Every application is different. You'll have to profile your application to see where you should concentrate your optimization efforts. Some web applications might require database access optimizations, while others have complicated business logic that cause the bottleneck.

Don't attempt to optimize random arbitrary parts of you application without first profiling. You might end up having to support complicated optimized code that doesn't actually make your application snappier.

Ben S
+2  A: 

Having a good read of highscalability.com should give you some ideas. I highly recommend the Amazon articles.

Paul Keeble
I wouldn't actually implement any of these strategies until their needed however. Design with them in mind, but implement optimizations as they are needed.
Ben S
+4  A: 

That's a fairly vague and broad question and something you could write books about. How far do you take it? At some point the performance of SQL JOINs breaks down and you have to implement some sharding/partitioning strategy. Is that the level you mean?

General principles are:

  • Cache and version all static content (images, CSS, Javascript);
  • Put such content on another domain to stop needless cookie traffic;
  • GZip/deflate everything;
  • Only execute required Javascript;
  • Never do with Javascript what you can do on the serverside (eg style table rows with CSS rather than using fancy jQuery odd/even tricks, which can be a real time killer);
  • Keep external HTTP requests to a minimum. That means very few CSS, Javascript and image files. That may mean implementing some form of CSS spriting and/or combining CSS or JS files;
  • Use serverside caching where necessary but only after you find there's a problem. Memory is an expensive but often effective tradeoff for more performance;
  • Test and tune all database queries;
  • Minimize redirects.
cletus
+1. But can you explain what you meant by "using fancy jQuery odd/even tricks ... can be a real time killer"? It will arguably make the page render a little slower on the **client** side but how does is negatively affect webapp scalability?
ChssPly76
@ChssPly76 whether the web app *actually* scales by some metric we can see doesn't matter. What does matter is the *perception* of scaling to the end-user.
Rex M
@Rex M - while that is true, it's not relevant to the topic at hand. Unless your page has many tables with lots of rows each, time it takes jQuery to decorate them is negligible. And if does have that many tables / rows, it'll most likely take _longer_ to generate / download / render the page with all the additional `class="odd"` attributes, even with gzip and all.
ChssPly76
@cletus nicely recommending those "lessons learned" after a year right? ;) +1
OscarRyz
A: 

None. Just code the application using proper design techniques (separation of concerns, etc) and then when the application is done or nearly done, do your performance testing. You'll find the real bottlenecks then - they won't be what you might have guessed in the beginning. This is where your proper design from the beginning comes into play - it makes it easy to make changes to fix the bottlenecks.

Rex M
@Rex M: I agree with you. But just want to know while designing which are the key factors I should take care of while designing for improving scalability ?
Silent Warrior
A: 

Sometimes, a specific answer is more helpful than just generic tips.

If you want to scale, the only thing to target is SPEED (in hardware and software) and RESOURCES (in hardware).

Hardware, the latter is expensive (more servers, load-balancers, etc.).

So, by carefully selecting your initial development framework you will save a lot of time and resources -up to several orders of magnitude.

For example, nginx is (much) faster than Apache.

Other solutions are faster than nginx (for both static and dynamic contents) but I could not disclose them without being censored on StackOverflow (it was rated SPAM & advertising despite the fact that this is a FREE solution).

That's the limits of "sharing": we must share only "acceptable" solutions rather than efficient solutions.

Cheers,

Pierre.

A: 

I get the sense from the other answers here that there is a general confusion between scalability and performance. High performance means that the response is quick. High scalability means that you get a response no matter how many others are also using the site at the same time. There's a big difference.

In fact, you actually have to sacrifice a little performance just to get good scalability. A general pattern to scalability is distributed computing. Factoring functionality out into separate tiers of clustered servers (web, business rules, database) is the usual approach to scalability. That extra round trip will slow down page load a little bit.

Everyone always wants to focus on high scalability but also don't forget that, for software vendors who sell licenses to customers who self host the application, scaling down can be just as important as scaling up. An application that can run on a single server for ten users but can also be configured to run on a ten server web cluster, a three server middle tier, and a four server database cluster for 10,000 users would be a system well designed for scalability.

Glenn