Web Application Scaling
What is Web Application Scaling?
Web Application scalability is the quality that enables your web application to grow with respect to your traffic growth. A scalable application is one that theoretically, no matter how much traffic, which could be in terms of number of users , transactions or services is sent towards it, will have capacity added to handle that traffic.
Need of Web Application Scaling
Non scalable systems cannot support HA (High availability).
In today's data centric world, web applications have to be ready for any sudden load of data and usage, and for that scalability apparently becomes a must need for such new generation of web applications.
Google.com is a scalable search engine. It can handle any number of users and any amounts of content. It scales easily to more content that is being added on the internet daily and to the large users that use it daily while maintaining a fraction of second response times throughout the day.
An electoral site needs to be scalable and handle all traffic without shutting down at peak times like voting days, election results declarations, counting days etc. If not scalable, it will crash and serve no purpose.
An online banking system and their database transactions systems need to be scalable and support all our financial queries throughout the day else they will lose money and make users unhappy.
A web app which is not scalable may also not support more development and/or improvisations. Non scalable systems often need to be re-hauled and re-written to support future development.
This leads to scraping of all past work thereby requiring re-spend of initial investment in time and money.
Techniques of Scaling Web Application
There are different techniques and tools for scaling the applications like horizontal scaling, vertical scaling, database partitions, performance tuning and the like.
In today’s world, at the Infrastructure level, one can add, at any point in time additional web servers, do database replication, add load balancers, provision for auto scaling, shard data, do database partitioning, use reverse proxies, and use shared storage to generate scalable systems. These may be done in the horizontal scaling paradigm where I am scaling out and adding more servers, or in the vertical scaling paradigm where I scale up by means of virtualization to harness more compute power.
Performance tuning can also help increase the capacity of your application. Although this is more time consuming and much more complex than just adding more machines, one much remember that the scaling achieved with more machines will eventually saturate and provide diminishing returns if the code is not tuned for performance. Approaches like caching, reducing frontend page load times, using noSQL databases,
DB optimization, using opt-code caching, using MVC coding paradigms, multi-threading, using document oriented datastores often help in this regard.
With the availability of various public APIs, the ability to combine multiple applications in a service had made way for service oriented architecture which can be used easily used for scaling up. The API service model has shown the clear ways to architect applications for scalability at an affordable cost.
Stages of Web Application Scaling
Scalability is an issue to be taken care of at different stages of the software development life cycle such as:
- Architecture and Design – Systems won’t scale if they are not designed to scale. The algorithms, data structures, designs, networking protocols, programs and other components used to make software must be assessed in terms of time-complexity (asymptotic analysis or Big-O notation) and chosen with proper insight so they may perform efficiently and practically when subjected to large datasets or large users.
- Coding – The code must be modular and this holds for both frontend and backend code. Brain Tag recommends usage of API based service oriented architecture, usage of MVC (model, view, controller) based frameworks, usage of multi-threading where-ever possible. We advocate design patterns like wrappers, adapters and plug and play. Never copy paste code or repeat code in the same application. Use opt-code caching for PHP and the like. Add support for frontend caching via proxy and application level caching using memcache, fragment caching to support faster and more traffic.
- Deployment – Adopt a balanced mix between horizontal and vertical scaling. Deploy for auto scaling and load balancing. Use the correct deployment setup to serve your traffic and handle additional storage and requests. Use cloud computing. Cloud service providers like amazon AWS, google app engine provide easy ways to stage and set the software deployment such that it is really easy to scale.
Consult Brain Tag for Scaling Web Application
Why choose Brain Tag Consultants
Designing modern era web applications for high availability is root foundation of Brain Tag. Our objective is to consult about the right things in the right way, for which we have introduced the concept of CTO consulting. We take care of modernized technology in fair way where fair is both in terms of time and cost. Brain Tag has a portfolio of developing modern scalable web applications, along with portfolio in cloud computing, NoSQL, Caching, Database replication, Performance tuning and Optimization.
Brain Tag adheres to SDLC processes and cycles in modern and most important anticipated ways.
What we do?
We provide the engineering and efforts required to increase capacity of your system so it may handle greater amounts of load (a.k.a scalability). We do this across various parameters like handling additional traffic, handling more storage capacity, doing more transactions etc. Our support can be both pre-emptive and reactive.
- We make system designs that allow for scaling – Our core foundation architecture and algorithms and API's are chosen with due diligence post analysis of their performance complexity and scalability metrics. See above on 'architecture & design' as one of our stages for scaling web apps.
- We envisage setup and configure the right and the most optimized deployment architecture. We have a lot of expertise in using various Cloud service providers like Amazon Ec2 and google app engine. We can build in for the necessities like auto scaling, load balancing, reverse proxies, master/slave DB replication, sharding, shared storage and the like required for infrastructure level scaling.
- We advocate the correct coding guidelines and design paradigms to support for modular and scalable code which is well written and which can adapt with growing needs of the system in the long run. We advocate MVC (model view controller) paradigm in all applications for the web. See above on ‘coding’ as one of our stages for scaling web apps.
- We do database scalability engineering - MYSQL has changed the whole paradigm of designing web application as it brought application developers concurrency allowing them to read and write at the same time without inadvertently corrupting the data. This results in higher concurrency and drastic improvement in overall system performance. We also advocate usage of NoSQL as it performs a more active role nowadays when it comes to designing scalable web application.
- We can build in for application level caching using systems like memcache. While developing the system with PHP , one can even use Opt code caching which sits between PHP and the server machine; after a PHP script is first compiled, the opt code cache remembers the compiled version and future requests simply pull the already compiled version which saves lot of CPU time.
- If your site is facing scalability bottlenecks and challenges, we can run a battery of tests to detect core issues and suggest plans for improving scalability.
- We help with code re-factoring and re-architecting as needed for scalability. This can be both at application level and at DB architecture level. We will study legacy code and legacy architectures and suggest ways in which the same may be re-factored and/or re-written to provide for scalability.
- Update deployment architecture to account for infra scaling by means of horizontal scaling and/or vertical scaling by building in for virtualization.
- We can help you shift from MySQL to noSQL or practice implement a hybrid model where you may reap benefits of both noSQL and SQL based deployments.
- We can implement data sharding and help you shift to a distributed database model.
- Our strategy for scaling is simple – “Don’t fix it till it breaks”!
- Do the most simple and the least to get the maximum benefits. Do not go for over-generalization. If you are just starting out and want to reach to a reasonable size user-base only, then engineer for just that. Adding a few web servers, load balancers, maybe a few redundant firewalls, caching static content will get you there.
- If you want to go to the next step, look at perhaps code re-factoring and some re-coding. Add application level cache and scale the database. Perhaps add master slave replication.
- If that saturates also, then look at high availability engineering which will require more aggressive steps like DB partitioning and replication, shared storage, shifting to noSQL, multiple data centers etc.
- Know the future – At Brain Tag, we will always discuss with you your wish list and future growth plans wrt. the application. What are the phase 2 features? The core architecture, especially database schema we design adheres to such expansion plans and prevents major re-hauls at later stages.