BLOGOLOGY

Search

Is a serverless architecture right for your web application?



Building a web application is getting easier as containerized functions help automate the management and scalability of cloud environments. No longer does it take a combined team of business analysts, software engineers, and IT infrastructure administrators, countless hours to determine how scalable the infrastructure needs to be based on the expected use of the application. A web application within a serverless architecture can seamlessly scale as the demand grows.


What is a Serverless Architecture?


A serverless architecture is a method of deploying a cloud environment to run applications, databases, and data backups automatically as needed. A software engineer can write code and deploy functions to pass the administration of the cloud environment to a cloud provider versus needing to provision, manage, or scale the cloud infrastructure themselves. So yes, a serverless architecture still uses servers, but a software engineer isn’t bothered by the provisioning or management of that server.


Function as a Service (FaaS) is a popular serverless architecture we use at Scalesology. A function is a task or operation written as a discrete piece of code by a software engineer within an application. An event then triggers the function to run. Common triggers are a timer trigger, blob trigger, event hub trigger, HTTP trigger, queue trigger, and webhook triggers. To use a function within a cloud platform, a software engineer uploads the function code to the desired cloud provider and then defines the trigger of the function. The cloud provider takes over from there. When an event triggers the function, the cloud provider spins up a server, executes the functions, and then shuts down the server.


The three leading cloud providers AWS (AWS Lambda), Azure (Azure Cloud Functions) and Google all have FaaS capabilities. Below is an example of a FaaS serverless architecture that Scalesology implemented for a client web application.

Figure 1. Serverless architecture for parallel data collection


The serverless architecture design illustrates the use of a cloud function, which is triggered when a file gets dropped into the cloud storage service. Once triggered, the function provisions a server, pulls in exported email files from cloud storage, processes them using a python script, and then pushes the results into:

  1. a cloud database viewable via a web application, and

  2. an output file that is emailed to the client.

Once complete, the cloud function reports any errors identified during the process and shuts down the server.


Benefits of a Serverless Architecture:

  • Cost effective: Instead of paying for a dedicated cloud instances that are on all the time, you are only charged when the instances are running, which reduces the overall cost.

  • Scalable: Using functions allow the cloud infrastructure to scale automatically based on usage.

  • Easy to deploy: Software engineers can deploy code versus having to provision and manage servers which speeds up the development of applications.

  • Best of class: By allowing cloud providers to manage infrastructure through functions, your organization benefits from enhanced availability of services, security, and maintenance that no longer needs to be managed by your IT team.

Challenges of a Serverless Architecture:

  • Performance: Spinning up and down a server adds several seconds of latency to code execution when functions are triggered after a period of inactivity

  • Testing: Software engineers find it difficult to emulate testing function code locally. Integration tests between the frontend and backend components are difficult to perform.

  • Locked into one cloud provider: Cloud providers have many of their own services that integrate together. To see the maximum benefit of these integrated services you will need to stay with one cloud provider rather than mixing and trying match services from multiple cloud providers.

When does it make sense to use a serverless architecture?

  • Automating Continuous Integration (CI) and Continuous Delivery (CD) pipelines: A software engineer code check-in could trigger a function to automate tests and deploy code into production.

  • Implementing data pipelines: As show in Figure 1, you can use cloud functions to integrate with other cloud services to seamlessly transform raw data to useable information.

  • Integration of data between applications: You can use serverless functions to build REST APIs that will scale on demand.

  • Computing functions triggered by an event: Why pay for a computer to run when you don’t need it to. You can deploy a serverless architecture to respond or collect information on any activity that can trigger a function.

A serverless architecture might not be right for every situation, but a growing number of companies, both large and small, are utilizing FaaS to save cost, scale rapidly, and ensure security within their cloud environments. Want to learn more? Contact us at Scalesology, we can ensure your business scales with the right technology implementation.