If 2017 was a landmark year for the adoption of serverless architecture, the trend certainly didn’t lose any momentum over 2018 and looks set to maintain trajectory into 2019. The big ServerlessConf 2018 in San Francisco demonstrated enthusiasm as developers and tech-savvy entrepreneurs expressed their thoughts and shared experiences on the serverless approach.
A recent analysis of AWS users highlighted that serverless adoption is growing 2.5x faster than the adoption of server containers. From this, it becomes clear that serverless architecture in cloud computing is a ‘must have’ for companies now and moving forward into the years ahead. Serverless architecture allows developers to create and run programs and services without sweating over the complex management processes involved in running a vast server framework.
K&C’s experts build backend apps for a wide range of different clients across a wide variety of sectors. Over the last year, we have been continuously archiving and reviewing the approaches we have used when building these backend apps and because we’re all heart here at K&C, we wanted to share some of our conclusions with you.
A host of new stack providers have entered the serverless space over the past couple of year. However, while the functionality they often provide can be great, they still lag the behemoths of Amazon, (Microsoft) Azure, and Google.
Amazon Web Services (AWS) is the first name that first comes to mind when thinking about cloud computing. Amazon is the largest provider in the cloud space and has a wider range of supporting tools and resources than any other competitor. At K&C we do a lot of AWS consulting and have built up experience and valuable insight.
A big plus to implementing AWS Lambda is the all-encompassing and well written documentation that is the result of the project’s maturity. You are able to see any updated information or new functionalities recorded online. This eliminates unpleasant “it-doesn’t-work-like-it-says-it-does” moments.
Lambda helps deliver a serverless application that can run at scale but demands a platform with a broad set of capabilities:
-Cloud logic layer
-Orchestration and state management
-Responsive data sources
-Application modelling framework
-Application and integrations libraries
-Security and access control
-Reliability and performance
-Global scale and reach
Lambda has benefited from increased credibility and profile as a result of the success some of its high profile customers such as InVision, CircleCI, and 9GAG have had using it. Another strength is the “democratic” approach it takes to its standard pricing model which allows for up to one million requests and 400 terabyte-seconds of compute time per month. This is more than sufficient for you to take it for a spin to size up all the pros and cons within the context of your particular needs without being hit by a huge bill.
As might be expected, we also have significant Azure consulting experience at K&C. Microsoft is quickly expanding Azure functionalities suite (as well as its client base), as it goes head-to-head with AWS for market share. Supported resources are pretty much along the same lines to what AWS offers but Azure also provides quite a few additional features specific to the .NET and Typescript audience.
Microsoft takes care of its community of developers by meticulously documenting all its products and creates the conditions for further improvements. Azure’s attractive pricing model also ensures constant community growth. Azure boasts cost estimates that are the lowest among large providers when comparing offers for the same workload.
If choosing between the two major players (AWS and Azure), you are most likely to choose the one that provides the most comfortable environment and best support for the technologies that you anticipate applying on the stack.
It was only to be expected that Google (Alphabet) would throw its hat into the ring for the serverless market in competition with AWS and Azure. Google’s Cloud Functions does not offer anything particularly unique when compared to the other two but several of the features provided are still worth noting.
The attention to detail that has been paid to its documentation demonstrates that Google has put significant effort into making it in-depth, easy-to-understand and simple to navigate.
The pricing model for Google Cloud Functions is slightly different from those of AWS and Azure — Google’s free tier allows for 2 million invocations per month, with a charge of $0.0000004 per invocation above that.
As promised, let’s detail some of the bottlenecks that can be encountered when implementing serverless architecture.
Any discussion on the disadvantages of a serverless approach inevitably begins with the topic of complicated observability. This compromises the critical insight into their functions that developers require. The result is an overwhelming majority of developers that just don’t know how to work with new features, inhibiting their ability to perform even the simplest tasks.
Although the issue is complicated, serverless observability should improve significantly over the next couple of years. Some monitoring and logging platforms have already seen massive improvements over a short period of time. In the meanwhile, it’s better to keep on our toes. Serverless functions are stateless, which in many cases makes them hard to debug.
When we think “serverless”, “cold starts” often comes to mind as well.
Fortunately, there is a relatively simple workaround — just keep your functions “warm”. This is possible if you hit them at regular intervals. Note however, that this works only for smaller functions or workflows that are quite straightforward.
If you want to reduce cold start times, you should always minimise the size of your application and thus your code. Also, we advise you to choose the language you use carefully — our preference is generally for Python or Go.
FaaS functions are usually constrained considering the allowed duration of each invocation. Currently, the response to an event of the AWS Lambda function takes around 5 minutes. Microsoft Azure and Google Cloud Functions are the same in this regard.
This results in re-architecture of certain classes of long-lived tasks in order to make them suitable for FaaS functions — you may need to create several different coordinated FaaS functions, whereas in a traditional environment you may have one long-duration task performing both coordination and execution.
Serverless computing such as AWS Lambda is without doubt a fantastic resource. So don’t put off the integration of the technology into your cloud DevOps delivery chain. However, it is also fair to say that while serverless computing is irreplaceable for a variety of tasks, it still can’t substitute some other technologies when it comes to deploying and managing your own containers. Serverless computing is designed to work with containers, rather than replace them.
The bad news is that JSON parsing can be rather tricky. The good news is that AWS services give Lambda the event payload in a defined structure per service. If processing messages are embedded in the JSON payload itself, all you need to do is to explore JSON schema validation tools. Next check the data types of attributes in JSON following validation. And if you’re processing binary objects, explore packages that can help verify or test the contents.
Your CD pipeline should be captured as code and version controlled. Builds should be replicable. Dependencies, including transient dependencies, should be locked down to exact versions. If a minor/patch version, updates can creep in between 2 builds, in which case the build cannot be reproduced.
The decision to migrate to serverless architecture should be well-considered. To benefit from a serverless approach you have to clearly understand why your project may need it, how it is implemented and what drawbacks you may have to contend with.
The K&C team have worked with serverless architecture for a couple of years and have significant experience in Cloud DevOps consulting, AWS consulting and hybrid cloud solutions. If you’re not sure if serverless is the right approach for you, then please just give us a shout and we’ll be happy to provide an insightful reply!