DEV Community

Rahul Nagare
Rahul Nagare

Posted on • Originally published at scaledynamix.com

Scaling Webapps: Up vs Out

As your web app starts to grow, there comes the point where current server resources are no longer sufficient. WordPress starts to slow down, there are occasional timeouts, and your marketing team has to limit their campaigns to avoid taking the site offline. At this point, you have a decision to make – scale-up or scale-out.

Scaling up means adding more resources to the existing web server. In most cases, this refers to resizing the VM instance to the next available size. Scaling up is also called verticle scaling.

Scaling up is easy, reasonably painless, and has minimal potential to break your site.

But

There is an upper limit on how much you can scale up. Although you can launch VMs with 128 GB memory and 32 CPUs these days, other bottlenecks show up way before you run out of memory. In other words, doubling the memory doesn’t double the capacity to serve visitors. The server starts to run out of available ports, sockets, and in case of containers, IP addresses as the traffic grows. Scaling up also doesn’t protect you against single-point-of-failure.

On the plus side, scaling up keeps the deployment and ops workflows the same as before and doesn’t introduce any changes.

Scaling out means splitting the traffic across several web servers. Scaling out is also called horizontal scaling.

Scaling out is complex and requires extensive work to get started and to keep the site running smoothly. On the plus side, scaling out provides high-availability and significantly more capacity to serve visitors when done right.

When you consider scaling out your infrastructure, you need a plan for the following areas that aren’t necessary with a single web server:

Replicated file system to share code and media across web servers.

Standalone database server accessible over the network

SSL Termination and load balancing.

Log aggregation.

A deployment strategy with an optional blue-green deployment solution.

So, which scaling method is right for you?

If you expect the traffic to grow 2x this year, scaling up saves you from the complexity and overhead. All you need is a maintenance window where you can resize your server and adjust server configurations to utilize available resources effectively.

If you expect the traffic to grow 10x this year, investing in scaling out is more effective. It requires careful planning, testing, and migration from the current server to the new cluster. But when done right, scaling out helps you grow an order of magnitude more compared to scaling up.

If you don’t expect the traffic to change but need better availability for your site, consider this:

Daily automated server snapshots in 2 regions and low TTL on your DNS server.

If there is an extended outage, you can spin up a new VM in a different region using the daily snapshot, update the DNS, and get back online without the complexity of high-availability systems.

Top comments (0)