Building Scalable Apps Using Platform-as-a-Service
Early success can be a scary thing for startups. The jump from 10 customers to 1,000 can happen with the snap of a finger. A company gets a mention in an influential technology outlet, and things take off. Each new milestone puts more stress on a startup’s foundation. The joy from newfound attention can quickly turn to dread when the app that’s being heralded comes crashing down because it wasn’t prepared to scale.
Scaling, or the process of modifying the resource pool of an application to handle certain loads with as much efficiency as possible, allows applications to keep growing and working no matter how much the workload changes. Any developer faced with an increase or decrease in-app usage should have a deep understanding of scaling and the tools needed to scale successfully. To help developers avoid the pitfalls of scaling, we’ll briefly dive into why it’s important, the different methods, and why a platform-as-a-service (PaaS) is the right tool for the job.
Scaling Saves Apps
Bringing a great idea to market is a juggling act — the last thing anyone wants is an application crash, wasted resources, or overloading. When done proactively, scaling can not only mitigate these issues but prevent them before they impact a startup’s bottom line. Proactivity is key to successful scaling. If issues with scale are addressed reactively or started when an application’s resources are near their threshold, the time spent trying to get an application back online will cost more than if the issues had been addressed ahead of time.
Types of Scaling
There are two approaches to scaling: vertical and horizontal. While neither approach is ever a perfect fit for a given problem, developers who understand the difference will find greater success scaling down the line.
Vertical scaling adds more resources — such as CPU, RAM, GPU, Network Interfaces, storage — to workers already existing within the infrastructure. Vertical scaling is a good solution for scaling issues created when an existing pool of workers is straining to best leverage their existing resources.
Horizontal scaling adds more workers (like nodes or machines) to existing infrastructure to better distribute the load. Horizontal scaling is a better fit for problems that can be addressed by increasing or reducing the number of workers assigned to a given problem. Some specific examples of horizontal scaling include adding more VMs behind a load balancer all hosting the same site or adding more instances of an app in a PaaS.
Building a Scalable App Using PaaS
Now that we’ve covered the basics let’s double down on how to use what I believe to be the right tool for the job: PaaS. There are many different solutions that can be used to scale apps — depending on how your apps are structured — using VMs, Kubernetes or PaaS. PaaS, in particular, is a great fit for startups looking to get the most bang for their buck while staying away from undifferentiated infrastructure management work
Scaling an app with PaaS benefits startups in two main ways. First, PaaS creates a layer of abstraction between developers and their cloud infrastructure. This allows for effectively a zero-downtime method of scaling — whether it is vertical scaling to move your workload to bigger more capable infrastructure instances, or adding more resources to run more instances of your app. Doing both of these things in Infrastructure-as-a-service (IaaS) requires you to either have downtime or do extra work to maintain continuity while this scaling happens. PaaS simplifies the experience.
Second, most PaaS solutions provide some kind of auto-scale functionality that allows users to specify certain parameters (like the amount of CPU, RAM usage, etc.) or certain events (like above a certain threshold of user requests coming to the app). In response to these parameters, the PaaS system automatically scales the app either vertically or horizontally. Modern serverless solutions will scale by themselves even without the user having to worry about it so they can just focus on their code and business logic.
The best-designed apps are built with questions of scaling in mind. Remember, scaling is not a place where developers want to play catch up. When creating an app, developers need to consider their resources’ thresholds, the capabilities of their worker pool, and the impact unnecessary resources could have on their business. Addressing scaling issues ahead of time is a key factor in preventing negative business impact and can be streamlined with the proper tools. For lean startups, that tool is a PaaS that streamlines time-consuming manual efforts associated with scaling.