What is serverless?
Serverless is a cloud computing model where developers build and deploy applications without managing the underlying infrastructure. In a serverless environment, the cloud provider such as AWS, Google Cloud, or Microsoft Azure automatically handles all the infrastructure tasks, including server provisioning, scaling, and maintenance. This model allows developers to focus purely on writing code, while the cloud provider takes care of everything else.
Serverless is also typified by the lack of a tradtional "server", instead a business pays for compute power only for the duration of running a function. Instead of paying for a server that runs 24/7 even when your website or app has no traffic, serverless systems only run for - and only bill you for - the times they are used.
Why serverless?
At Si Novi one of our founding principles was regarding the use of serverless technology. We firmly believe in the future of serverless systems and their ability to cut infrastructure costs and reduce server management overheads while providing a superior service to power web-based applications.
Key features and benefits of serverless include:
- Automatic Scaling: Serverless applications automatically scale up or down based on demand. If an app receives a surge of traffic, the cloud provider allocates more resources; when traffic decreases, resources are scaled back.
- Pay-per-Use Pricing: In serverless, you only pay for the actual computing time your code consumes. This is often measured in milliseconds, meaning you're not paying for idle server time, which can significantly reduce costs for many applications.
- Event-Driven: Serverless functions are typically triggered by specific events, like HTTP requests, database updates, or file uploads. Each function performs a single task and can be combined to build complex workflows.
- Short-Lived Execution: Serverless functions are usually stateless and designed for short execution times. They perform specific tasks and then terminate. If longer tasks are needed, other architectures may be more suitable, but for quick, isolated tasks, serverless is ideal.
We work with various serverless technologies, particularly in AWS including Lambda, Lambda@Edge, DynamoDB, S3 and Aurora Serverless. We're keen followers of the 'Infrastructure as code' doctrine which allows you to define all your resources as code files for easy maintenance, version control and deployment. We use various Infrastructure as code tools such as AWS Serverless Application Model (SAM), the Serverless Framework and Architect.
Cost savings with serverless
A huge benefit of serverless systems is in the cost savings they bring.
In the traditional model, websites or web applications are hosted and operate one one or more “Servers”. These servers run 24 hours a day, every day. Of course, as a consumer of this hosting provision you're paying for the servers - regardless of whether the website or app is actually being used.
With serverless your website or applications are only 'served' when they are used by a visitor or user. The invocation of a serverless process is charged per run - usually in the thousandths of a penny, and often with generous free tiers from the cloud provider.
This can make applications with infrequent or irregular access patterns much cheaper to run and well suited to serverless architectures.
High-performance static websites with serverless
A static website or web page is defined as one in which is delivered to the browser without use of a programming language to generate the page first. Static webpages are delivered to the browser exactly as they are stored on the server - usually as HTML files.
Delivering static HTML pages to the browser comes with huge benefits of speed and optimisation, particularly when combined with cloud services such as AWS CloudFront for global caching and AWS Lambda@Edge serverless to perform necessary routing, scripting or payload modification.
But static websites have a perceived downside of being... well, static - unchangable. This might be seen as an unsurmountable obstacle any website or application that requires content changes.
However at Si Novi we leverage web and cloud technologies to build websites and applications that have both dynamic content management and static HTML and asset delivery, achieving the best of both worlds.
This website, hosted in AWS using S3, CloudFront and Lambda@Edge is an example of how a highly-optimised, high-performance static website can also be dynamic and regularly updated.
Breaking down monolithic applications in order to scale
Traditional web applications are built as 'monolithic' applications - all the code and functions are within one codebase and hosted on a single web server. This is a perfectly reasonable approach for many applications, however it's difficult to scale an application like this. Scaling up the hosting provision is one option, but this is potentially expensive.
There are always opportunities to break out aspects of applications into discrete microservices - bringing benefits of performance, redundancy, scalability and potential cost savings.
If your existing web application has known high-load events - like document generation or traffic spikes to a particular feature - then migrating that service to a serverless microservice could reduce the load on the rest of your hosting infrastructure, and could allow you to scale your service without investing heavily in hosting.
Utilising serverless technologies naturally means building APIs into your web applications, which makes them more flexible and allows for future integrations with other systems and services. At Si Novi we're experienced at delivering API development and creating and deploying serverless applications in the cloud.
Breaking down web applications into microservices can often be performed slowly, one piece at a time - limiting your investment and risk at each stage.
Summary
In summary, serverless is a flexible, cost-effective, and scalable solution for developing applications, particularly well-suited for workloads that have unpredictable usage patterns, require quick deployment, or can benefit from event-driven design.