How to Scale Website | CDN | Load Balancers | Walmart Interview
In order to Scale Website, you need to ensure that your website remains accessible even if website traffic grows exponentially i.e website/application should be able to handle more and more concurrent requests. I was asked this question in my Walmart Interview for Frontend Engineer position.
How to scale website |
Let’s see what are the ways to scale website:
- CDN – Content Delivery Network or CDN comes as big rescue if you want scale website. CDN helps you to serve all your static and dynamic assets through its servers across the world. Even if traffic is increasing exponentially, CDN makes sure that all requests are distributed across the world with requests being served from nearest servers. This also decreases load time. Your servers can focus on other stuff.
- Load Balancing – Load balancing is very effective in scaling a website. As the name suggests, load balancing is a process of distributing network traffic across different servers. In this way, if one server is free then load balancer will direct traffic to that server decreasing the load on current servers. This process is done by using couple of algorithms like round robin, IP hash etc.
- Caching – Local Caching which involves storing external resources locally and looking up next time when same resources are requested. Centralized Caching focuses on loading data once and sharing it across multiple devices. All can connect to same store and pull in resources, Redis can be using for this purpose
- More servers – It’s a no-brainer. Bigger and better server always help in handling more traffic
- Reduce Bandwidth usage – Whenever your server receives a lot of traffic, it’s important to decrease bandwidth usage. This effectively leads to increase in page speed, as load on server decreases. This can be done by compressing your code and other resources.
There are couple of other ways to scale website but that involves coding the application in a specific way. From frontend/javascript interview perspective, you may get a question on ways to scale website.
Read my interview experience on Walmart, Amazon, Flipkart, MS, Paytm, MMT, OYO, Intuit, etc.
Links:
I hope, you liked my article on How to Scale Website. Please comment and share your knowledge as well. Also, let me know if you want a entire blog post on my Walmart Frontend Interview experience.