AP Scaling


This week’s topic will be on system design and scalability. If your website all of a sudden becomes super popular overnight, and your website has both static content such as HTML files, images, or gifs, and dynamic content such as PHP code and a database such as MySQL, how can we scale a website so that it can handle more users? One straightforward approach is vertical scaling.

If we’re running low on disk space or facing high CPU server usage, for example, then we can add vertical scaling, and upgrade a single server on more expensive, state-of-the-art hardware. However, the catch with adding more resources and money to fix the problem is that there is a ceiling with hardware and financial constraints. One advantage of the advancements in hardware (ex. more CPU cores) is companies such as Amazon, can provide virtual private servers (VPS) services like EC2, which provides scaling capabilities.

In contrast to throwing more resources or money to fix the problem, another solution is horizontal scaling. This is a solution that avoids hitting the ceiling and instead scaling horizontally with cheaper hardware – using servers that are not top of the line – and this includes adding more capacity, instances, or servers, to support the memory workload and processing across multiple devices.

One method of implementing horizontal scaling include using load balancers. A load balancer can help to direct user requests to the various servers based on set requirements such as server load, and thereby distribute the workload across the servers as well as avoiding unhealthy servers. An advantage of load balancers is that it can help as an additional layer of security, by having requests be directed to the load balancer’s public IP, it can then handle the requests to all the other servers’ private IPs. Notably, load balancers can route traffic based on various metrics, including: random, least loaded, session/cookies, round robin or weighted round robin, layer 4 (looks at transport layer) and layer 7 (looks at application layer). However, disadvantages include a load balancer becoming a performance bottleneck if it does not have enough resources or is not configured properly, increased complexity, and it becomes a single point of failure. But how can we implement a load balancer? There are two ways, using software such as “ELB,” “HAProxy,” or “LVS,” or using hardware such as “Barracuda,” “Cisco,” “Citrix,”, or “F5.”

Source: CS75 (Summer 2012) Lecture 9 Scalability Harvard Web Development David Malan (https://www.youtube.com/watch?v=-W9F__D3oY4)

Print Friendly, PDF & Email

Leave a Reply

Your email address will not be published. Required fields are marked *