Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Key factors for designing scalable web based application

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 ?

like image 642
Silent Warrior Avatar asked Aug 16 '09 16:08

Silent Warrior


4 Answers

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.
like image 196
cletus Avatar answered Oct 06 '22 00:10

cletus


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

like image 27
Paul Keeble Avatar answered Oct 05 '22 22:10

Paul Keeble


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.

like image 36
Ben S Avatar answered Oct 06 '22 00:10

Ben S


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.

like image 27
Glenn Avatar answered Oct 05 '22 23:10

Glenn