Is serverless really the best way forward?

Are you looking to reduce your IT spend? Do you need to deploy software without waiting hours or days for servers and infrastructure to be set up? Do you want to develop & deploy software, but don’t want to manage servers? If so, serverless may be the solution.

What is serverless?

Serverless computing is a service offered by cloud providers (AWS, Microsoft Azure, Google Cloud) whereby functions run on application runtime environments that are managed and hosted by the cloud provider. This removes the need for developers, or their IT department, to set up and manage servers before deploying software – it’s all handled automatically for you. This technology has been around since the mid-2000s, but really started to gain traction at around 2014.

It’s also known as Function as a Service (FaaS), and Backend as a Service (BaaS). Applications are broken down into small, single-responsibility functions which are triggered and run on demand. Each function is initiated by a trigger event; and are run on stateless “containers”.

This blog references AWS services specifically, as this is the platform that Symbiotics uses. Microsoft Azure and Google Cloud do, however, provide similar solutions.

The evolution of cloud computing

The diagram below illustrates various infrastructure options & for certain companies, and the typical migration path taken over the last few decades. This is a simplistic view, as there are many companies that implement hybrid infrastructure.

Why use it?

It removes the need for developers to plan and design server requirements for the software that they will deploy. Traditional considerations such as hardware, storage, operating systems, services, networking, scaling and load balancing are taken care of by AWS. Similarly, infrastructure management tasks such as server or cluster provisioning, patching, operating system maintenance, and capacity provisioning are also taken care of by AWS.  This leaves the developer to focus solely on the code that they write.

AWS automatically allocates the server resources required and best suited for the code to be run. This makes the application by default highly available, fault tolerant and scalable, as it takes advantage of the AWS serverless technology and advanced, multi-location infrastructure.

It’s highly scalable – it doesn’t matter whether you have 10 or 10,000 users using your application – AWS will automatically scale as needed.

It can save you money – AWS serverless works on a pay-per-use model. Many applications have reduced their spend by half or more by moving to serverless.  It can also be a low-cost option for experimentation or R&D, as the costing model is pay-per-use. You’ll only pay for the storage and compute time that you use.

What can it do?

Typical use cases for serverless are, but not limited to:

  • Static websites
  • Web applications
  • Event-driven systems
  • Background processes, e.g. user authentication, sending notifications, texts, email
  • Updating information in databases

How does it work?

AWS provides services to support serverless architecture, the most commonly-used at Symbiotics being:

  • Lambda Lambda is a service that developers can upload their code to. Lambda will then run the code without the need for a developer to provision servers. Several languages are natively supported, such as: Java, Go, PowerShell, Node.js, C#, Python, Ruby. It also provides a runtime API which allows you to use any additional programming languages to author your functions.
  • API gateway APIs are the communications gateways between applications and your back end functions, such as Lambdas, databases, etc.Amazon API gateway is a service used by developers to create, maintain, monitor and publish secure APIs.
  • S3
    Amazon Simple Storage Service (S3) is a highly durable object storage service.  Some of the uses of S3 are storing data and objects, such as images or videos, or websites and mobile applications.
  • EFS
    Amazon Elastic File System (Amazon EFS) provides a simple, scalable, fully managed elastic NFS file system. EFS is faster than S3, but more expensive.
  • Step functions
    Step functions are used to build workflows with Lambda functions and AWS services. It’s a service used to run a sequenced series of events that you have defined.
  • DynamoDBA
    fast and flexible no-SQL database.
  • Aurora serverless
    A SQL database specifically architected for serverless that will start up, shut down and scale as required.
  • EventBridge
    Amazon EventBridge is a serverless event bus that makes it easy to connect applications together using data from your own applications, integrated Software-as-a-Service (SaaS) applications, and AWS services.
  • SNS
    Amazon Simple Notification Service (SNS) is a fully managed messaging service for both system-to-system and app-to-person (A2P) communication. It enables you to send messages or notifications directly to users with SMS text messages to over 200 countries, mobile push on Apple, Android, and other platforms or email (SMTP).
  • SQS
    Amazon Simple Queue Service (SQS) can be used to send, store, and receive messages between software components at any volume, without losing messages or requiring other services to be available.

What shouldn’t it be used for?

  • Constant workloads – in this case it may be more cost-effective to use Platform as a Service (PaaS) rather than serverless
  • Long running functions – has a time limit of 5 minutes
  • Real time and speed of response – functions may take time to start up as they are run on demand, which makes them less than ideal for real time solutions.
  • Complex compute applications – you may want to specifically provision the resources you know that you’re going to need for these for cost or speed considerations.

Serverless benefits

  • Apps are highly available – no scheduled maintenance or downtime
  • Fault tolerant – functions are maintained across multiple availability zones (AWS data centres)
  • Scalable – automatically scales to incoming requests with no limits
  • No server setup – the AWS serverless services will handle this for you
  • No idle capacity – there is no need to buy servers to handle the maximum possible workload – AWS will automatically provision only what it needs when it needs it.
  • Reduced infrastructure and support costs
  • No capital outlay for infrastructure, AWS works on a pay-as-you-use model

Serverless drawbacks

As great a technology as it is, there are some drawbacks to the serverless model, and it may not always be the appropriate solution for you. The following points should be considered when designing your system:

  • Learning curve – it’s a relatively new technology and may initially take more design and development time
  • Complex to manage and debug – it won’t automatically monitor your application and log information, such as errors, resource consumption and You’ll need to set this up manually; however, AWS does provide some tools for this, such as AWS X-Ray.
  • High latency (cold starts) – because there isn’t a server constantly running, it can take some time (a few seconds) for the functions to start up
  • Vendor lock-in – it can’t port easily to another cloud provider, so if you decide to move from AWS to Azure (or vice-versa), for example, it will probably mean a re-design and rewrite of your system
  • Security – as serverless runs on shared infrastructure within the cloud, there are concerns over its security

Use of serverless computing at Symbiotics

At Symbiotics, the greater majority of the web and mobile applications that we develop for clients are created using AWS serverless technology. We host cost-effective websites, web and mobile applications; and store data using, amongst others:

  • S3 for storage and website hosting
  • Dynamo DB
  • Lambda, API Gateway and step functions

Some of the applications we have developed include:

  • Insurance claim management system – in this case reducing the infrastructure bill to a third of the original costs
    • Hosting the web and mobile applications
    • Hosting the database
    • Saving images of the insurance claim uploaded from mobile devices
    • Running background tasks to update a claim status as it moves through the claim process
  • Payroll system
    • Integration between a centralised payroll system and 3rd party payroll APIs
    • Processes the payroll
  • Graphical financial information tool
    • Storage of raw financial data
    • Processing raw data for statistical analysis
    • Web-based interactive map for visual representation of the financial data
  • Digital education platform
    • Hosting the web and mobile applications
    • Hosting the database
  • Event management platform
    • Hosting the web and mobile applications
    • Hosting the database