By: Shankar
February 23 2019

Serverless Computing with Drupal

iRobot, a leading global consumer robot company, had a spectacular debut on Amazon Prime Day as it sold thousands of its Roomba robotic vacuums. Eventually, with the greater focus on its central value proposition vis-à-vis offering leading-edge robots to relieve customers from humdrum chores and the increasing number of connected customers, iRobot decided to move its mission-critical platform to the Amazon Web Services (AWS) Cloud. By leveraging the powerful tools and integrations of AWS, they were able to use a serverless architecture that offered an efficacious combination of scalability, global availability and breadth of services.

a humanoid standing on a rocky surface while the sun sets in the distance


Why is such a big organisation like iRobot opting for serverless computing? Using a serverless architecture powered by AWS IoT and AWS Lambda was beneficial to keep the cost of the cloud platform low, negate the need for subscription services and handle the solution with fewer people. Also, the need to maintain physical infrastructure and systems software vanishes. Drupal, as a leading player in the open source content management framework market, has been a humongous option for building innovative solutions. Drupal can be a great solution for implementing a serverless architecture. Before diving right into it, let’s traverse the road that delineates how the concept of serverless came into existence.

The emergence of serverless computing

To look at how serverless came into existence, freeCodeCamp has compiled an interesting story that takes us to the 1950s. This was the time period when the computing paradigm called mainframes burst onto the scene. Eventually, the mid-2000s witnessed the advent of a new paradigm called cloud computing.

Flowchart with arrows pointing different words to explain history of serverless computing
Source: ResearchGate

It was in the 2010s when the concept of serverless architecture popped up. Serverless is more: From PaaS to present cloud computing report has an interesting compilation that distinguishes six main dimensions, as seen in the figure above, of critical breakthroughs that paved the way for the emergence of serverless.

Serverless: In-depth

Flowchart showing icons representing servers, cloud, Microsoft Office 365 logo, AWS Lambda to explain serverless computing
Source: freeCodeCamp

What is Serverless Computing? It enables you to write and deploy code without having any sort of obstruction while handling the underlying infrastructure. Here, the cloud-based servers, infrastructure and operating systems are relied upon by the developers. Although it is referred to as serverless, there is still an involvement of servers. Being a fully managed service, the setup, capacity planning and server management are managed by the cloud provider.

Serverless architectures are application designs that incorporate third-party “Backend as a Service” (BaaS) services, and/or that include custom code run in managed, ephemeral containers on a “Functions as a Service” (FaaS) platform. By using these ideas, and related ones like single-page applications, such architectures remove much of the need for a traditional always-on server component.- Martin Fowler

Martin Fowler states that there is no clear view of defining Serverless. On one side, it was first used to describe applications that involve the incorporation of third-party, cloud-hosted applications and services for handling server-side logic and state called (Mobile) Backend as a Service (BaaS). On the other side, it can also mean applications in which the server side logic is written by the developer and run in stateless compute containers that are fully managed by a third party called Functions as a Service (FaaS).

Benefits of Serverless

Bar graph with blue-coloured horizontal bars to explain benefits of serverless computing


Following are some of the merits of Serverless stated by AWS:

  • Governance: There is no need for governing any servers. To add to this, no software or runtime to install, maintain or administer is needed.
  • Scalability: Automatically, your application can be scaled. It can also be flexibly scaled by adjusting its capacity which is done by toggling the units of consumption (such as throughput or memory) in lieu of units of separate servers.
  • Cost: You can pay for consistent throughput or execution duration instead of making payment by server unit.
  • Availability: It offers built-in availability and fault tolerance

Implementation

Flowchart showing logos of Amazon Aurora, CloudFront, S3, EFS to explain implementation of serverless computing with Drupal


A combination of Amazon CloudFront, a web service that quickens the process of distribution of static and dynamic web content; [email protected], that extends serverless compute feature to the CloudFront network; and Drupal as a powerful headless CMS can be fantastic for building a serverless architecture. The seamless integration between CloudFront, [email protected] and headless Drupal delivers the lowest latency and personalised experience to the users.

The seamless integration between CloudFront, [email protected] and headless Drupal delivers the lowest latency and personalised experience to the users.

AWS has delineated how to accelerate the Drupal content with Amazon CloudFront. It showed how to deploy CloudFront to cache and accelerate your Drupal content with the help of a globally distributed set of CloudFront nodes. In this, every CloudFront distribution consisted of one or more origin locations. An origin is where Drupal content resides. By running the supplied Amazon CloudFormation stacks, Drupal 8 was deployed. Amazon Elastic Compute Cloud (EC2), Amazon Elastic File System (EFS), Amazon Relational Database Service (RDS) and Amazon Aurora came in handy as well. It was all wrapped up in a highly available design using several Availability Zones and its configuration was done in such a way that it was able to auto scale using Amazon EC2 Auto Scaling groups.
 
Path module, available in Drupal 8, helped in creating URL aliases for the content. ‘Aggregate CSS Files’ and ‘Aggregate JavaScript Files’ were enabled by default within the Drupal 8 administration. This led to the reduction of bandwidth requirements between the Origin AWS infrastructure and CloudFront Edge nodes. Internal Drupal caching was disabled by default that controlled the maximum amount of time a page could be cached by browsers and proxies. Drupal’s CDN module was also suggested to be enabled that could alter file URLs so that CSS, JavaScript, images, audio and videos could be easily cached within CloudFront. This was followed by the creation of CloudFront distribution by using CloudFront console which involved configurations on Origin, default cache behaviour settings, and distribution settings.

What lies ahead?

A report by Markets and Markets estimates that the market size of serverless architecture was estimated at USD 4.25 billion in 2018. This is expected to grow at a Compound Annual Growth Rate (CAGR) of 28.6% to reach USD 14.93 billion by 2023. Elimination of the need to administer servers for minimising infrastructure costs and streamlining deployment, governance and execution, shift from DevOps to serverless computing, and the burgeoning state of microservices architecture have been contributing towards its growth.

Bar graph showing blue, green, indigo, maroon coloured vertical bars to explain serverless computing market share
Source: Grand View Research

A report by Grand View Research states that automation and integration services segment play a crucial role in establishing a serverless architecture. While the monitoring services segment is expected to see the highest CAGR of 28.8%, the small and medium enterprises (SME) segment will grow with CAGR of 28.6% between the forecast period of 2015 and 2025. The banking, financial services and insurance (BFSI) segment to anticipated to retain its dominance in this market share. Moreover, North America, with the powerful presence of U.S., is growing at a great pace. Asia-pacific is also expected to witness a growth of CAGR of 26% in the forecast period.
 
Research and Markets, in a report, states that serverless computing does come with certain challenges during its deployment. As Cloud Service Providers (CSP) control the underlying infrastructure, users are unable to customise or optimise the infrastructure. Further, the organisation has no authority over the infrastructure that raises the risk factor involved with adding several customers on the same platform. Also, consumers do not have control over penetrations tests and vulnerability scanning on infrastructure that increases the requirement for compliance concerns adopters and acts as restraints to the market growth.

Conclusion

The Chief Technology Officer (CTO) of Amazon, Werner Vogels, said in his 2016 keynote, “Before, your servers were like pets. If they became ill you had to nurture them back to health. Then, with cloud, they were cattle, you put them out to pasture and got yourself a new one. In serverless, there is no cattle, only your application. You don't even have to think about nurturing back to health or getting new ones, all the execution is taken care of.”
 
Serverless Computing can be a great solution in combination with Drupal. The serverless platform enables you to globally distribute your web application for running dozens of data centres across the globe with the customers being served from the one that is nearest to them.
 
Be mindful of the fact that serverless is not the right approach for all the problems and consider your business requirements before taking a plunge.
 
We have been on a constant pursuit of offering a magnificent digital presence to our partners using our expertise in Drupal development.
 
To decide if serverless is the right fit for your business, let us know at [email protected] so that we can help you scale your digital business.