DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Leveraging Serverless Architecture

Leveraging Serverless Architecture

From our latest Cloud Guide, take a look at this explanation of serverless architecture and what it brings to developers.

Stefan Thorpe user avatar by
Stefan Thorpe
CORE ·
Oct. 09, 18 · Opinion
Like (17)
Save
Tweet
Share
10.18K Views

Join the DZone community and get the full member experience.

Join For Free

This article is featured in the new DZone Guide to Cloud: Serverless, Functions, and Multi-Cloud. Get your free copy for more insightful articles, industry statistics, and more!

Serverless computing — also known as serverless architecture, and sometimes just serverless — is a hot topic in computing right now. Amazon, Google, and Microsoft (the big three when it comes to cloud computing) are all investing heavily in serverless architecture to provide continuous service integration for businesses of all types. It has become an increasingly common subject to find guidebooks for on bookshelves, alongside the usual programming and networking books.

But even if you have come across serverless architecture before, it can still take some time to wrap your head around and understand the concept properly. Many people find themselves wondering what serverless architecture is and how it is currently being best employed.

What Is Serverless Architecture?

As with many revolutionary technology trends, serverless architecture is hard to pin down and summarize in a simple, catchy soundbite. It is a technology that is becoming increasingly important and which could also play a crucial role in the future of cloud computing — especially for enterprise systems.

Serverless architecture is a way of approaching cloud computing in which cloud service providers manage the allocation of server resources in a dynamic way. Processes are run in isolation and are fired when certain triggers or events happen the resources required to run the process is typically managed by the cloud provider. By combining third-party cloud services, client-side logic, and the ability to call/request cloud-based services with a variety of triggers, serverless architecture delivers what we often refer to as Functions-as-a-Service (FaaS).

Why Do Developers Use Serverless Architecture?

There are a number of reasons that developers choose to utilize serverless architecture, but there are also some situations where a traditional server-based approach will yield better results.

No Need to Worry About Maintenance

The traditional server-driven approach to cloud computing has always presented a number of inherent problems and challenges for businesses. For example, when applications and runtime environments are stored on remote servers, those servers need to be maintained. This maintenance includes ensuring that remote patches and security updates are applied and that any issues with availability are rectified as soon as possible. With serverless architecture, you only need to rely on your cloud provider to handle server maintenance. All of them now have a multitude of redundancies and other measures to ensure that any downtime is kept to the bare minimum.

Cost

For many businesses, the biggest selling point of serverless architecture is cost. When compared to the cost of renting out physical servers and maintaining them around the clock, serverless architecture offers impressive savings. In fact, serverless computing utilizes a completely different pricing model to traditional server architecture.

When renting a physical server, you have to pay according to the specifications of that server and how its available resources are allocated to you. In contrast, a serverless architecture provider will charge you based on the number of executions — a pay-per-resource scheme. The cloud provider will allocate you a certain timeframe, which will vary according to the package you choose. The amount of memory available to you during that time can also be adjusted if you need to be able to perform more executions. The more memory per millisecond that you require, the more expensive your package will be.

Environments

With a serverless cloud setup, it is just as easy to configure multiple different environments as it is to set up a single one. Because serverless computing occurs on a per-execution basis, it is easy to have different executions calling into play different architectures. This also means that you don't have to worry about tracking the status and configurations of a whole bunch of different environments.

What Are the Drawbacks?

No technology is perfect. There are certainly some circumstances and setups for which traditional server architecture would provide better results than a serverless solution.

Networking

When it comes to networking applications, serverless architecture suffers from an unfortunate downside — namely that serverless functions can typically only be accessed as private APIs, meaning that an API gateway needs to be configured to allow access. With a serverless computing setup, you won't be able to access these services through the usual IP. For configurations that require constant networking capabilities, traditional server architecture is unarguably the way to go.

Timeout Limits

The timeout limit in serverless architecture refers to the amount of time in which you are able to execute your functions. Most serverless architecture providers give a maximum timeout limit of 300 seconds. Anything that needs to run for longer than this, or which takes longer than this to run, is unsuitable for a serverless architecture setup.

Use Cases

UI-Driven Applications

Imagine an e-commerce app linked to an online retailer — a clothing store, for example. Using traditional server architecture, the customer would connect from their internet-connected device to the clothing store's server, then access the database contained on it. This database would contain all the information regarding the business, their products, etc. The application, stored on the server, will provide the user with an interface through which to access the server and place orders.

With a serverless architecture approach, the structure becomes very different. Rather than the customer going through the clothing store's physical server, the purchase and search functions can be separated by an API gateway to access the appropriate isolated functions.

APIs

A simple and direct application for serverless computing is setting up REST APIs that deliver data for use by a single-page application or another service.

REST APIs are not typically considered difficult to create. Often, you just need a basic web framework, a library for translating data in the format you require (usually JSON), and whatever glue code required to talk to the backend from where you're pulling data. With serverless architecture, the developer can concentrate on just writing and deploying code to serve the API and not have to worry about much else.

Typical functions that need manual configuration in a REST API, such as autoscaling to meet demand, can be automatically addressed by serverless frameworks. Plus, the pay-per-resource model that's become the nature of cloud pricing means that a lightweight, minimally viable API costs next to nothing to deploy.

Best Practices

As with any other technology, you will get the most out of serverless architecture when you adhere to a particular set of best practices. These are the tips that you should keep at the front of your mind when you are considering how to design and execute your serverless architecture implementation.

  1. Use a compute service to deploy code on demand. In order for your setup to become truly serverless, you will need to ensure that there are compute services available through your chosen cloud service provider suitable for achieving your goals. As soon as you have to rely on a physical server, a virtual machine, or any containers of your own creation, you have strayed away from serverless architecture.
  2. Write functions that are stateless and single-purpose. When you are writing functions for your serverless architecture, ensure that each function is serving a single purpose and is serving it properly. Many serverless setups utilize different functions in order to form microservices.
  3. Push-based and event-driven pipelines. When you need to carry out more complex computations and tasks, create pipelines that are event-driven and pushed-based, allowing different services to easily communicate with one another.

Serverless architecture gives us a glimpse at what the future of cloud computing will look like. With so many services now available in the cloud, and with the amount of cloud storage and power available, the possibilities for serverless computing going forward are awe-inspiring.

This article is featured in the new DZone Guide to Cloud: Serverless, Functions, and Multi-Cloud. Get your free copy for more insightful articles, industry statistics, and more!

Architecture Cloud computing Serverless computing Computing microservice Web Service application

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Detecting Network Anomalies Using Apache Spark
  • Asynchronous Messaging Service
  • How Chat GPT-3 Changed the Life of Young DevOps Engineers
  • Introduction Garbage Collection Java

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: