BACKGROUND IMAGE: stock.adobe.com
Serverless apps are one of the hottest topics in cloud, and one reason for that is their ability to scale under load as business conditions change. However, to ensure that scalability, cloud teams need to properly design, develop and deploy serverless applications.
An application, in general, is scalable when it can call on processing resources as needed. A scalable application must also consist of components that can multiply under load. In other words, teams can create additional instances of the application on demand and then destroy them as workloads change.
Scalability challenges with serverless apps
The challenge with scalability in a serverless system starts with the software itself. Let's say you want to scale an app that supports ATM withdrawals. You can start another copy of the app to support increased loads, but how does that second copy connect into the workflow? The answer is through load balancing, a service available from major cloud providers. Be sure to use it.
The second issue is more complicated. If you start another copy of an app to respond to load, what happens if a user starts his or her ATM activities on one copy but then shifts to another? Most real-world transactions have context -- meaning they need to take several steps to work. Software that depends on this kind of context can't scale because one copy of the app doesn't know what actions have occurred previously on another copy.
Most business apps have this context, or what's known as state. To create serverless apps that can scale, pull features and functions from monolithic apps that can be written without being stateful or that can obtain state or context information from the outside.
The cloud offerings from the three major cloud vendors -- Amazon Web Services, Microsoft Azure and Google Cloud Platform -- provide examples of how to write stateless or contextless software that can be fully scalable. There are three approaches:
- Write your scalable components using functional or lambda programming techniques. This produces highly scalable apps but could require significant changes in programming practices.
- Write app programs using a toolkit that can manage distributed copies of an app, such as Apache ZooKeeper and Curator.
- Write app components that maintain state from a database or have users pass state to them.
All of these work well, but the second is easiest.
Review serverless features carefully
Take the time upfront to review all the features a serverless cloud provider offers, and review them for all other cloud providers as well. Pay particular attention to the way a cloud provider integrates serverless computing with other cloud services. That will demonstrate how serverless components work with traditional applications -- a capability that will be important to many enterprise deployments.
However, just having scalable app components doesn't solve all the problems. If we follow the example of the ATM app, it's essential, at one point, to have only one copy of account balance data. This means there should either be one place where that data is updated or that all of those places coordinate their updates. Be sure to apply best practices for distributed transaction processing to build serverless apps that can scale.
Deployment tips to ensure scalability
While load balancing, as mentioned above, is important for servlerless apps, it affects both their development and deployment. When there are multiple copies of the same app component, how can admins ensure they route traffic to the correct copy? It's possible to develop a load-balancing serverless component, and there are some software load balancers available on the market. However, these can overload and create a single point of failure. Cloud providers offer distributed load balancing -- a feature admins should use to optimize their serverless scaling strategy.
On the deployment side, admins must have control of the scalability process. For example, because providers charge for serverless apps based on usage, it's critical to place strict limits on scalability. Limit the maximum number of app copies, as well as the conditions under which users can generate a new copy of an app. Also, remember to scale back serverless apps when demand drops.
To further avoid runaway costs, cost monitoring is critical. Cloud providers break out charges for serverless computing, and those numbers help you gauge whether your scalability controls work. Get usage data on serverless apps from cloud providers directly or via cost analytics applications.
Prepare and train your cloud ops team for serverless
Compare serverless options from Azure and Amazon Web Services
See how serverless computing can lead to cost efficiency
Serverless computing adds complexity to app dependency management