What is Serverless Computing and how compelling it is for SaaS

Hussein ElSayed.

By Hussein ElSayed

8 min read
Copy to clipboard
.

On December 2016, I travelled to Las Vegas, Nevada to attend AWS re:Invent event. I remember that my understanding, knowledge, and experience of Cloud Computing and Architecture back then was not as solid as it is now. A lot of things have changed since then, of course. Now I am a Certified AWS Solutions Architect, I have better understanding, more experience, and even more desire to learn about AWS Services and Technologies.

Even though I attended a couple of conferences after this one, beginnings always matter. I remember how happy I was that CEQUENS gave me the opportunity to be a part of this event and how passionate and curious I was about SaaS and Serverless. For me it was quite an experience, a paradigm shift, and the trigger to rethink and rebuild CEQUENS’ CPaaS architecture from the ground up and this time with the ideas of Serverless and SaaS in mind. Of course I did not do it only by myself, I cannot claim that. I actually was just a small part of a team of heroes who made me feel we can do just about anything and everything.

For many reasons I have a passion for knowledge sharing. It really means something to me. And as an Architect and Engineering Manager, I have a responsibility to speak up about my experiences and to share them with the tech ecosystem. At CEQUENS, we take our community role seriously and maybe this is one of the reasons why we sponsored and hosted AWS user group meetups.

What is Serverless?

I still remember how confusing it was for me when I first heard the term 'Serverless.' It took me a while to understand that Serverless doesn’t mean there is no server but that servers, on which your code lives and your application is hosted, still do exist. However, AWS, like many other cloud service providers, allow you to write and deploy code without having to worry about the underlying servers or infrastructure in general. In an Architecture, where Serverless idea and model is being followed, developers can just focus on implementation, pay more attention to the business needs and customer requirements, spend more time focusing on the capabilities of the product and how to make it more competitive, and allocate less time thinking about the underlying infrastructure and scalability issues.

Like Martin Fowler stated, the term Serverless encompasses two different but overlapping areas:

  • BaaS or Backend-as-a-Service: the word Serverless was first used to describe applications that rely on cloud-based hosted services to manage server side logic and state. At CEQUENS the BaaS ecosystem of such services include database services, like Amazon Dynamo DB for example, or Authentication and Identity\User Management services like AWS Cognito. Check Figure 1 for a subset of the AWS services used in CEQUENS CPaaS.
  • FaaS or Function-as-a-Service: the term Serverless can also be used to refer to applications where logic runs in stateless compute containers (FaaS) that are event-triggered and completely managed by the Cloud Service Provider. Perhaps AWS Lambda is the most popular implementation of FaaS.

CEQUENS CPaaS lets developers and architects focus on the business requirements and lets AWS Cognito handle security matters, like Authentication, Authorization, and Tenant Isolation. Amazon Cognito supports multi-factor authentication and encryption of data-at-rest and in-transit. Amazon Cognito is HIPAA eligible and PCI DSSSOCISO/IEC 27001ISO/IEC 27017ISO/IEC 27018, and ISO 9001 compliant.

The list of services offered by Cognito and used by CEQUENS CPaaS is so long. However, we do not have to worry about where or even how users are stored. The service is fully managed by AWS, completely secured and scalable to accommodate hundreds of millions of users.

CEQUENS CPaaS Architecture can be described as an Event-Based Architecture and therefore AWS Lambda is a cornerstone in this Architecture. We have hundreds of Lambda functions written by dozens of developers and used to host logic and code which serve modules such as Campaigning, WhatsApp Business, Contacts, Analytics and Reporting, etc. However, none of these developers have any idea where the container that hosts these Lambdas exist. We focus on the business requirements and implementation and delegate the responsibility of managing the servers and the containers associated with these Lambdas to the AWS team.

Diagrams-05

Figure 1: A Portion of CEQUENS ecosystem and AWS Services

Cost Benefits of Serverless

One of the biggest benefits of adopting Serverless architecture and ideas is cost reduction.

In the early days, anyone who wanted to build a web application or service had to own physical hardware to host their servers. Then came cloud computing where you could rent and pay for a server space of your own.

With Serverless, however, you purchase services on a pay-as-you-go basis. Meaning that you only pay for the services you use and only when you use them. For example, in AWS Lambda you are charged for requests made to your function as well as the duration - the time it takes for your code to execute.

Additionally, reducing development costs also comes with the BaaS aspect of Serverless. By using a service like AWS Cognito, you are definitely reducing the development cost by integrating with a service that provides ready-made authentication and authorization functionality instead of coding it yourself, specially that processes, like Sign In, Sign Out, Forgot/Change Password are very similar across all SaaS and non-SaaS product. Hence, you will not gain anything by reinventing the wheel. Save your time and effort and integrate with Cognito to better focus on developing features that shall differentiate your product and make it more competitive.

Finally, there is also a cost benefit associated with Serverless by reducing, if not eliminating, the operational cost associated with servers management and administration by delegating this overhead to the cloud service provider you are using.

Serverless and Scalability

Here at CEQUENS, downtime is not measured in hours, minutes, or seconds, rather in dollars. The repercussions of having a frustrated customer in the business is the last thing you will ever need and therefore quality attributes, like Performance, Availability, Reliability, and Scalability matter and they carry so much weight for CEQUENS CPaaS.

For SaaS products in the cloud the overall responsibility of your system availability is shared between the architect and the cloud service provider. However, on the infrastructure level, AWS services are by design, and by SLA, highly available. For example, S3 Standard storage class is designed for 99.99% availability and almost the same for compute services like EC2 and Database services RDS.

Speaking of scalability, a scalable architecture is by definition an architecture that can scale up to meet increased workloads and there are mainly two ways to scale up a system: Vertical and Horizontal scaling. Vertical scaling is when you increase the capacity of the server on which your app or service is hosted by, for example adding more memory, faster CPU, or larger\faster hard disk. Horizontal scaling is when you accommodate the excess traffic you are experiencing by adding more servers or more compute units.

Diagrams-01-1

Figure 2: Vertical vs Horizontal Scaling

Perhaps there is no better example than CEQUENS Campaign Wizard where scalability is crucial to the success of a product. For Campaign Wizard, we needed a scalable architecture that follows and responds to the occasional traffic spikes in an elastic manner so that we don't have to over-provision resources, as shown in Figure 3 below, that would be unused most of the time but are only there just to ensure that a spike in traffic will not exceed our infrastructure capacity limit. 

Diagrams-02

Figure 3: Over-Provisioning Resources to Meet Occasional Traffic Spikes.

Campaign Wizard is adopting microservices, event-driven architecture where AWS Lambda - an implementation of FaaS - is heavily used and this is exactly where all the magic happens. With Lambda, Horizontal scaling is automatic, elastic, and completely managed by AWS. In CEQUENS CPaaS Campaign Wizard module, each campaign goes through a pipeline of Lambda functions, each of them responsible for something from processing recipients, validating them, personalization, preparing CTA links, etc… until the campaign reaches the MNO (Mobile Network Operator). See Figure 4.

Diagrams-04-3

Figure 4: High Level View of Campaign Wizard Serverless Architecture

As shown above, when a user submits a new campaign, the system automatically spawns a pipeline of Lambda functions responsible for processing this campaign. At any point of time AWS automatically scales out the infrastructure by spawning N Lambda functions to process N number of campaigns. It should also be noted that the cost benefit of this model, when there are no campaigns submitted through the system, is that it will not create Lambda functions and you will not be charged. In other words, you only pay for the compute units that you use. See Figure 5.

Diagrams-03

Figure 5: Scalability with Serverless and FaaS Contrary to Over-Provisioning

Summary

This article was about the value proposition of Serverless, what Serverless means, and how compelling Serverless is for SaaS and why. In addition to cost optimization and operational efficiency, Serverless also helps you spend less time thinking about the infrastructure and avoid over-provisioning resources. Serverless and the managed nature of it lets you just write and deploy code without having to worry where it lives or how to scale it.

From an agility perspective in SaaS environments, we are always looking for ways to move faster, to respond to the market faster, to add more features that would make our product more competitive, and this is exactly where Serverless comes into play. Serverless allows you to have more time working on the features, functions, and capabilities of the product and spend less of your time dealing with scalability and infrastructure issues.

Despite bringing a lot of benefits to the table, there are some drawbacks to Serverless. To be continued...

 


 

About CEQUENS

We are a global Communication-Platform-as-a-Service (CPaaS) provider in the Middle East and Africa (MEA) region. By offering omnichannel customer experiences, we make it easier for businesses to strengthen customer engagement and retention.

Talk to our experts today about the advantages of CPaaS 3.0. These include building seamless customer experiences that can meet the shifting needs of your customers.

CONTACT SALES

Share this article

Copy to clipboard

Related blogs

View All