Scaling web applications is the set of approaches towards development, infrastructure planning and deployment, that guarantees more sustainability of your web application over time when its usage grows due to popularity or intensive use.
Technical Infrastructure for Scaling
Amazon Web Services Hosting
Helps to scale easier due to use of bunch of specialized services that are designed according to peculiarities of usage, and can be easily scaled by themselves.
Elastic IP is used to flexibly map to different instances and switch between them, without needing to change the DNS records.
Computing Servers (Elastic Compute 2)
EC2 for computing resources and database hosting.
Storing Images, Videos and Audio
You can store images on your main server on early stages of user base growth.
It is not advised at all to store big data in the database.
We usually store content on the usual server first, but then employ content distribution networks; Amazon’s CloudFront is one of them.
We use SES for email messaging. It has got simple API. Besides, EC2 will not let you send more than a limited amount of emails, and SES is the solution for sending batches of emails that have bigger chances to bypass
* RDS – later for database management
Scaling Approaches at Web Application Level
Growth potential is enabled by set up of resource-efficient solutions:
nginx, including its setup for the memory, maximum simultaneous threads and length of queue
lean code structure. Athough MVC framework versus pure PHP code will add memory stack overhead, we choose to use one of the most resource-efficient MVC-framework among the list of industry-accepted solutions.
AJAX. Lean requests and responses in JSON 😉
caching the dictionaries and frequent database requests into the memory (memory mysql engine, memcache etc)
Scaling is often being added to project when it becomes a necessity, but we always design general architecture with provisioning scaling in the future, so we will be accumulating technological credit.
Some scaling approaches will be:
Database denormalization to contain interim tables with most frequently requested data corteges.
Load balancing (with help of ELB by AWS)
Database sharding (horizontal – divided by indexes into volumes, vertical – different tables on different servers).