Is Your Web Platform Scalable

Building Scalable Web Platform

Most Web Applications developed by inexperienced software companies are not scalable. The application runs fine when launched. However, in most cases, as soon as traffic reaches a critical mass, due to bad software design, the web application starts hanging and crashing resulting in a very poor user experience, having a negative impact on the success of the platform. Getting the functionality right is only half the story. It is very important to make sure that the application has scalable web architecture and can scale easily as traffic grows, without having to rewrite large portions of the application to support the increasing traffic.


 

The following checklist lists some of the most important things that should be followed at the time of software architecture design to insure smooth scalability of the web application:

  • Code Scalability:Code scalability consists of two things.First is to make sure that good & efficient data structures and algorithms are used and the code is optimized to handle large number of requests quickly. There are very few nested loops and the code runtime scales linearly at worst with traffic. Unit testing coupled with load testing can be used to insure that the code is up to the mark.Second is to make sure that the during software architecture design, the code is clearly broken up into logical modules and written in a very modular manner. This will make adding new features to the code relatively easy and bug free..
  • Database Scalability: Most web applications are backed by databases for application data storage and persistence. In order to make the database scalable, design techniques like de-normalization must be used when designing the database. This insures small data footprint. Further relevant indexes should be created and all database queries optimized avoiding unnecessary joins and non-index queries. As traffic increases, queries logs can be monitored using the slow query logs to find slow queries and optimize them.
  • Scalable Deployment: Once the application & data storage have been optimized for scalability, the final and most important piece in achieving scalability is the actual software deployment architecture and insuring that it can quickly be scaled. The following are some deployment tips that can insure a scalable web architecture:
    • Hosting on Cloud: It is recommended to use a cloud platform to host the application, as it allows for quickly procuring additional resources to handle increasing traffic.
    • Horizontal Scaling: Horizontal scaling means adding more web servers to handle user requests. This usually entails having a (or a set) load balancer that handles all incoming server requests and balances the load amongst the various web servers. Concepts like elastic load balancing are fairly common in the cloud and allow the application to automatically provision new servers as traffic increases and release servers when traffic drops. This also provides failover protection, so that if one server fails, traffic can automatically be routed to the other servers without any disruption in service.However, the application needs to be designed in a way that supports horizontal scaling. For example, using separate storage servers to store all static and user-generated files is needed, so that all the dynamic files are available across all instances. Similarly, batch jobs and other one-time scripts must be set up to run only on a single instance (or a separate instance) to insure they only once.
    • Master-slave replication for DB: As traffic scales, the database can become the bottle-neck and drastically slow down the overall system. Master-slave replication can be used, such that all writes go to the master, while all reads are done from the slaves. With most applications being read-intensive, this can be scaled very easily as needed.

As you can see, designing a scalable web architecture has many different moving parts and requires deep knowledge and good design skills, right from the application layer to the actual deployment architecture. So is your web platform scalable?