Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

The Pros and Cons of A Serverless Architecture and How To Prepare

Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

The Pros and Cons

of a Serverless
Architecture, and
How to Prepare
In this e-guide In this e-guide:
 The pros and cons of A serverless architecture allows developers to focus more on writing code, and spend less
time on managing underlying resources. However, preparing for a serverless architecture will
serverless architecture take considerable time and preparation, as you work to understand the benefits, caveats, and
necessary tools.
 Understanding the benefits
Read this e-guide to learn more.
of serverless functions

 Why deploying APIs on


▼ Next Article
serverless frameworks spurs
innovation

 Three ways to prepare


applications for serverless
platforms

Page 1 of 23
In this e-guide The pros and cons of serverless
 The pros and cons of
architecture
serverless architecture
Chris Moyer, VP of Technology
 Understanding the benefits The term serverless generates a lot of discussion. What exactly does it mean, and how can it
of serverless functions help developers move from a monolithic architecture into a distributed one? Similarly, there is
also confusion about the different benefits of containers and serverless architectures. Both
 Why deploying APIs on architectures are modern approaches to application management, and each has specific
benefits.
serverless frameworks spurs
The best way to understand the difference between containers and serverless architecture is
innovation
to look at the developer communities around each. Most documentation for Docker's
 Three ways to prepare container approach addresses issues that surround how to manage your infrastructure. The
tools are designed to help more easily manage underlying hardware or virtual machines, and
applications for serverless spread containers across multiple servers or instances in AWS. Documentation that
platforms addresses serverless frameworks and activity within the serverless community tends to focus
on building serverless applications.

Fundamentally, serverless lets developers focus on writing code. There are still servers
somewhere in the stack, but the developer doesn't need to worry about managing those
underlying resources. While services like Amazon Elastic Compute Cloud (EC2) require you
to provision resources for the OS and the application, a serverless architecture simply asks
how many resources a single demand of your function requires. For example, a web testing
suite might require 128 MB of RAM for any single website. Even if you deploy 10 million
copies of that function, each individual one needs only 128 MB. They can even all run at the

Page 2 of 23
same time. Serverless focuses on what each individual request requires and then scales
In this e-guide automatically.

 The pros and cons of Approaches to serverless development


serverless architecture
There are several different approaches to serverless development. Most developers who
 Understanding the benefits transition from a traditional framework, such as Flask, Rails or Express, might choose to use a
serverless framework, such as Chalice for Python or Serverless for Node.js. These
of serverless functions frameworks are similar to the traditional ones, which help ease the transition for those
 Why deploying APIs on developers.

serverless frameworks spurs Unfortunately, there are size and complexity limits to the single-framework approach, so
developers who might build an old-style, monolithic application will quickly run into issues
innovation when they try to migrate that app to serverless. For example, a single AWS Lambda function
can only be about 50 MB. This might seem large, but this also includes all third-party
 Three ways to prepare dependencies, as those must be included at
applications for serverless deployment time.

platforms Additionally, when a developer uses AWS If executed correctly, a


CloudFormation, he will discover there is a limit to serverless architecture
how complex the APIs can be. Therefore, he will
can save development
need to split them apart once you have too many
endpoints or operations. Furthermore, all of the teams time when
same pitfalls of any monolithic service apply, so it pushing out new
becomes harder to upgrade, harder to maintain features and can scale
and a single-point-of-failure for the environment.
However, with a single function, cold starts are
nearly infinitely.

Page 3 of 23
easier to manage.
In this e-guide
Microservices are a different approach to serverless development. In this case, you can still
 The pros and cons of use a framework, but split the API into multiple microservices. This approach lets you share
code between services via private packages that communicate via AWS Lambda invocations.
serverless architecture
Consider a scenario when a company operates an email marketing system which is
 Understanding the benefits comprised of several different microservices. Its application is hosted out of Amazon
CloudFront, which uses one service to let users build a template, another service to let them
of serverless functions pick the recipients and a third service that does the actual emailing. Each of those services is
also split into separate microservices. The emailing service first builds a list of recipients in
 Why deploying APIs on one function. Then, it passes the email template and recipient list along to another function,
serverless frameworks spurs which splits that recipient list and passes each recipient, plus the email, to a third function to
do the emailing.
innovation
Serverless functions are often chained together, which is a common pattern that can help
 Three ways to prepare mitigate the five-minute runtime limit, as well as the 50 MB size limit. In the email marketing
system example, the first function, which handles building the recipient list, needs to have
applications for serverless
access to Amazon DynamoDB to pull down recipients. But it doesn't need to have the code
platforms installed to process the email template or send the actual email messages.

The last function, which does the actual emailing, doesn't need access to DynamoDB, but it
does need to know how to build the template from the input data. But most importantly, none
of these functions need to be exposed via Amazon API Gateway. Instead, that's handled
through a separate service which simply takes a user request, authenticates it and then
passes it directly along through an AWS Lambda call to the emailer stack.

For complex interconnected services, such as the aforementioned email example, developers
can choose to use AWS Step Functions instead of connecting Lambda functions together by
hand. This builds in additional support for error conditions, adds more retry logic and can
Page 4 of 23
automatically handle state and data transfer between functions. Each function is still
In this e-guide completely isolated, but the state and transitions are all handled by AWS.

 The pros and cons of Tools for debugging serverless architectures


serverless architecture
Traditionally, developers could simply log into the system, run the application, tail logs and
 Understanding the benefits test input to debug. In a serverless architecture, there is no server to log into, and running
locally can be a lot more complicated. Some AWS plug-ins, such as Serverless Offline and
of serverless functions SAM Local, offer support for running a majority of applications offline. However, these don't
 Why deploying APIs on function so well when an authorization step happens in another repository or where there are
multiple functions that need to be chained together. In many cases, developers must run their
serverless frameworks spurs own stack for development and test and then push changes to a development AWS account.
innovation There are several tools that can help developers and operations teams identify application
problems and track down performance issues. AWS X-Ray can automatically trace issues
 Three ways to prepare with other calls to AWS. For most applications, it will only take a few lines of code to enable X-
applications for serverless Ray. It can then show network graphs and point out issues with, for example, provisioned
throughput on DynamoDB tables or Lambda concurrency limits. Console logs from both
platforms standard error and standard output within a Lambda application are directed to Amazon
CloudWatch Logs, which can be ingested into an Amazon Elastic Search instance or
interacted with directly through the API or AWS Management console.

There are also third-party tools and services that help with serverless tracking, such as IOpipe
and New Relic. Also, there might be logs from other AWS services, such as API Gateway,
that include valuable information when debugging issues. It's more complicated to actively
monitor services because traditional monitoring tools, such as Pingdom, don't offer a way to
test functions, just API endpoints. As a result, developers must build tools to run tests and
expose those via APIs in order to use traditional infrastructure monitoring systems.

Page 5 of 23
In this e-guide The serverless tradeoff
 The pros and cons of Overall, serverless lets development teams focus more on the product and the output of an
organization, but it does require more planning to handle testing and monitoring.
serverless architecture Organizations that plan to use serverless should first build out a project map that helps them
decide if they want to use a microservices architecture or rely on a single-function router to
 Understanding the benefits handle API requests. If executed correctly, a serverless architecture can save development
of serverless functions teams time when they push out new features and can scale nearly infinitely. If developers skip
advance planning and take precautions, it can lead to future problems.
 Why deploying APIs on
serverless frameworks spurs ▼ Next Article
innovation

 Three ways to prepare


applications for serverless
platforms

Page 6 of 23
In this e-guide Understanding the benefits of
 The pros and cons of
serverless functions
serverless architecture
Zachary Flower, Freelance writer
 Understanding the benefits The task of simultaneously managing server infrastructure and writing code is exhausting. For
of serverless functions overworked developers, today's RESTful APIs and serverless platforms may be a match
made in heaven.
 Why deploying APIs on
Despite the name, serverless computing doesn't actually mean that there aren't any servers
serverless frameworks spurs involved. It simply means that developers aren't required to think about the servers. This
characteristic is what allows developers to build powerful, single-serve applications without
innovation
having to deal with resource management. This certainly can make developers lives easier,
 Three ways to prepare while at the same time providing helpful abstractions away from the complexities of API
integrations.
applications for serverless
platforms Enter the REST API
Serverless applications create a service-centric architecture out of the box, which means that
the individual features of an application are both incredibly lightweight and highly targeted.
While this mindset lends itself well to dealing with business logic, it is also incredibly powerful
for integrating with external APIs.

Let's say, for example, you are building an application that needs to be able to charge users.
However, your chosen API provider -- for example, Stripe -- offers much more functionality
than you need. In keeping with your current serverless design, you decide to create a

Page 7 of 23
serverless function that does one thing and one thing only: charges a credit card using the
In this e-guide Stripe API.

 The pros and cons of Rather than deal with the bloat of customers, subscriptions and invoices, the core application
you create can request a single, targeted endpoint that tucks all those elements away for us.
serverless architecture
This effectively condenses third-party integrations into the functionality you need, rather than
 Understanding the benefits the functionality they offer.

of serverless functions While the above might seem like an over-abstraction, it demonstrates that third-party
dependencies can be tucked into their own corners of an application, which allows developers
 Why deploying APIs on to create serverless functions that solely provide the features you need.

serverless frameworks spurs That said, not every API requires abstraction. The flip side of the coin would be small, single-
serve APIs that require the implementation of server-side technologies. While this usually isn't
innovation
an issue with more monolithic applications, it can end up requiring more resources than
 Three ways to prepare leaner projects have available.

applications for serverless Take, for example, an application that requires a basic Slack integration. It may be the case
that because of the way the application has been developed, creating a webhook for the
platforms Slack integration's "slash" command would mean spinning up a new server. Using a
serverless architecture, developers can deploy ephemeral, dedicated serverless functions
without adding any additional overhead to the core application.

Keeping it DRY
"Don't repeat yourself," or DRY, is a longheld mantra of the software development industry.
While this is typically used to encourage developers to keep their code clean and
maintainable, it applies to serverless application design as well. Let's take our two examples

Page 8 of 23
from above -- integrating with both the Stripe and Slack APIs -- and add a third API for good
In this e-guide measure.

 The pros and cons of Assuming that our application relies heavily on these three APIs, there are three different
ways that we need to build in order to maintain authentication and communication among
serverless architecture
each of them. While most APIs provide clean SDKs, that doesn't do much to ease the pain of
 Understanding the benefits working with more than one at a time. This creates complexities that can be difficult to
manage within a codebase.
of serverless functions
If each of those API integrations were abstracted out into serverless functions, then not only
 Why deploying APIs on would the core codebase be easier to manage, but the way the codebase works with them
would be cleaner as well. Rather than managing three separate methods of communication,
serverless frameworks spurs we can reduce that down to just one function.
innovation
Beware of the caveats
 Three ways to prepare
It is important to note that the above scenarios focus on a very specific type of serverless
applications for serverless
infrastructure, called function as a service. This is the infrastructure made popular by Amazon
platforms Lambda. The other type of infrastructure is the one that completely removes all consideration
of servers. These serverless platforms tend to offer highly vertical functionality, such as
supporting only one language or only one type of application.

Additionally, sometimes a single function just isn't enough, and the metadata of the request is
just as important as the request itself. This can lead to the creation of custom workarounds to
keep things consistent. These workarounds often lend themselves to provider lock-in, which
can cause issues down the line when you outgrow your current infrastructure.

Page 9 of 23

In this e-guide
Next Article
 The pros and cons of
serverless architecture

 Understanding the benefits


of serverless functions

 Why deploying APIs on


serverless frameworks spurs
innovation

 Three ways to prepare


applications for serverless
platforms

Page 10 of 23
In this e-guide Why deploying APIs on serverless
 The pros and cons of
frameworks spurs innovation
serverless architecture
Jan Stafford, Features Writer
 Understanding the benefits Like Cinderella's slipper, serverless computing doesn't fit every foot in software development,
of serverless functions but -- for the right application -- it offers royal opportunity.

 Why deploying APIs on Serverless computing provides a code and API deployment option for companies trying to
reach more customers, grow their businesses and serve people in new and innovative ways --
serverless frameworks spurs without having to scale IT overhead. Serverless provides a deployment platform that,
according to Gartner analyst Martin Reynolds, is "absolutely bulletproof" and guaranteed to
innovation
deliver reliable, consistent results without losing information.
 Three ways to prepare For software pro Chris Moyer, building and deploying APIs on a serverless framework has
applications for serverless been a good step. Doing so makes the API lightweight on the client side, scalable on the
cloud, easier to secure and less expensive.
platforms
In his role as CTO of marijuana-license tracking and research firm Cannabiz Media, Moyer
chose to deploy a serverless API that has to respond to requests quickly. That approach
makes sense because the API doesn't need a cloud instance's distribution network to serve
its front-end static pages.

Moyer chose to deploy another Cannabiz Media API in an Amazon Elastic Compute Cloud
instance. "It's for running some back-end tasks that take longer to do, like two hours, as
opposed to five minutes for the serverless API," said Moyer, who is also vice president of ACI
Information Group, a social media and blog aggregation service.

Page 11 of 23
The moral of this story is, "Don't try to squeeze everything into serverless, but do take
In this e-guide advantage of the benefits of serverless wherever it makes sense," Moyer said.

 The pros and cons of By deploying APIs on serverless frameworks, an organization can realize benefits to both its
business and its DevOps process.
serverless architecture

 Understanding the benefits


of serverless functions

 Why deploying APIs on


serverless frameworks spurs
innovation

 Three ways to prepare


applications for serverless
platforms

Page 12 of 23
In this e-guide 'It just works'
 The pros and cons of Serverless is, first and foremost, a developer's tool designed to deploy code quickly, said
Judith Hurwitz, CEO of Hurwitz & Associates, a research and consulting firm. "You're
serverless architecture developing code with tools you know and deploying on a serverless framework without having
to do the setup," she said. "Developers don't
 Understanding the benefits have to know how it works. It just works."
of serverless functions Serverless APIs don't have to fit into an You're developing code
 Why deploying APIs on enterprise's existing architecture, said Gartner's with tools you know and
Reynolds. Indeed, deploying a serverless API
serverless frameworks spurs
deploying on a
doesn't require building a serverless architecture,
either. Instead, most developers use lightweight serverless framework
innovation
packaged tool sets called serverless frameworks without having to do the
 Three ways to prepare to deploy APIs. setup.
applications for serverless "Serverless APIs are neutral on the architecture
and framework," Reynolds said. "They are just
CEO, Hurwitz &
platforms little functions that you call. They are part of your Associates
application architecture, and they run in the
serverless framework." Size and function are the Judith Hurwitz
key criteria for choosing serverless APIs. "If an
API is small and just built to do a call to a back-
end system, like saying what to do at a certain time, deploying on serverless makes sense,"
Hurwitz said.

Fixate IO analyst and developer Zachary Flower avoids deploying long-running or


complicated processes on serverless frameworks. "Working with APIs that can be easily

Page 13 of 23
abstracted into simple function-style endpoints will go a long way towards maintaining sanity,"
In this e-guide Flower said.

 The pros and cons of Which APIs fit serverless?


serverless architecture
Single-feature APIs with small footprints work well for specific serverless functions, Flower
 Understanding the benefits said. Monolithic APIs are out. Treat each endpoint as a simple action, rather than a sentence
or paragraph; in other words: Do x as opposed to do everything, Flower explained. An
of serverless functions example is the Twilio REST API that simply requests an SMS. "These are simple abstractions
 Why deploying APIs on that demonstrate how to best consume an API in serverless," Flower said.

serverless frameworks spurs Any API function that can return in less than 30 seconds works in serverless computing,
Moyer said. There's a 30-second timeout in the typical API gateway. "Basically, anything that
innovation takes longer than 30 seconds is questionable," Moyer said.

 Three ways to prepare There are other functions that may be squeezed into the serverless computing mold, but let
the user beware.
applications for serverless
Don't try to put serverless on top of your existing virtual machine infrastructure, Reynolds
platforms
advised. Serverless is all about building as little overhead as necessary. "Go all in, and build it
in a serverless framework," he said.

Four timely enterprise uses for serverless computing

While APIs are an excellent entry into serverless computing, plenty of other viable uses exist.
Contributors and experts suggested that decision-makers explore these four uses for
serverless frameworks and function as a service (FaaS):

Page 14 of 23
 Microservices. Tom Nolle, president of consulting firm CIMI Corp., sees microservices
In this e-guide deployment as the best use case for serverless today. "Properly designed
microservices are little functional atoms that can be made stateless easily, scaled
 The pros and cons of easily and used to compose apps easily," Nolle said.
 Event processing. In Nolle's opinion, this is the broader mission of serverless and
serverless architecture FaaS. In particular, the ever-expanding adoption of IoT-related event-driven
applications will drive the need for serverless computing's flexibility and ease of
 Understanding the benefits deployment. Deploying an event-driven application on IaaS would waste compute
resources, as the instance would only be used when an event occurs.
of serverless functions  Retail. Retailers such as Nordstrom are early adopters of serverless computing. "It's a
means of opening the retail product line and distribution channel to new customers,"
 Why deploying APIs on Gartner analyst Martin Reynolds said. He expects Amazon to use FaaS to build out the
online business of Whole Foods, which it acquired in 2017. "With serverless, they will
serverless frameworks spurs
be able to scale the Whole Foods business without increasing the spend on IT," he
innovation said.
 NoOps applications. Developers can deploy apps on a serverless framework without
 Three ways to prepare any involvement from operations, Reynolds said. Serverless offers an automated
package of the ops infrastructure and tools used in the software application lifecycle
applications for serverless management process. Developers can even test serverless code in the cloud without
going through the operations workflow. Microservices could work well here, as would
platforms any software functions that produce semi-static information specific to users, Reynolds
said.

The list of plausible enterprise uses for serverless is much longer, of course. Today,
organizations are deploying static and semi-static information and webpages, and single-page
and hosted static websites, on serverless frameworks.
Powerful, real-time socket APIs are better suited to traditional infrastructure, as they will
quickly erode the cost savings of serverless, Flower said. For example, in API design, using a
function as a service (FaaS) approach rather than a serverless framework for overly flexible
API infrastructures like GraphQL can become more trouble than it is worth, he said.

Page 15 of 23
Moyer had a right-sizing problem with serverless APIs when he found that his content delivery
In this e-guide network (CDN) limited resources per cloud formation template. He had set up 15 different
APIs via a serverless framework. "I wanted to add something that would allow people to fetch
 The pros and cons of other users in their accounts," he said. In time, those APIs hit the CDN's 200-endpoint limit. "I
serverless architecture could no longer add a new API endpoint. I had to split the APIs apart."

 Understanding the benefits Benefits of serverless APIs


of serverless functions Building and deploying the right type of API on serverless platforms brings many benefits,
 Why deploying APIs on including reducing repetitive, low-value tasks in software development. Even better, it relieves
worries about scaling and managing APIs. For a business, serverless computing can lower
serverless frameworks spurs development costs and increase monetization opportunities, but without the risk of vendor
lock-in.
innovation
Some key benefits to deploying serverless APIs include the following:
 Three ways to prepare
Security. Serverless APIs run in a completely trusted and secure environment, Reynolds
applications for serverless
said. Serverless is a way to deploy proprietary APIs and code in almost any environment
platforms without anybody being able to see what's going on. It promises, and has so far delivered, that
"nobody can actually attack that code," he said.

Scalability. The traditional way to build safe applications doesn't scale well, Reynolds said.
Serverless scales automatically, which pays off when APIs and apps must scale to meet the
needs of many customers at once. Reynolds cited Nordstrom's use of Amazon Web Services'
Lambda serverless platform to scale its customer requests for product recommendation and
reduce response time from minutes to seconds. "You can't keep adding mainframes to do this
stuff," Reynolds said.

Page 16 of 23
Cost. Users only pay for the compute time they use. For example, Cannabiz Media has
In this e-guide clients nationwide and a very random traffic pattern. There are spikes first thing in the morning
in each U.S. time zone, but traffic can also spike in the early evening. "It doesn't make sense
 The pros and cons of for us to run even one server overnight when most of the time there's not going to be anyone
serverless architecture using it," Moyer said. With the requests routed through a serverless API, the company is
paying per request, not for the time people aren't using it.
 Understanding the benefits
Management. It's automated. "You don't have to manage anything," Reynolds said. "If there
of serverless functions need to be another 10 instances in Canada, boom, they're there," Reynolds said. "You didn't
even have to know about it. They're just there as opposed to all the paperwork you'd have to
 Why deploying APIs on do if you needed a new server."
serverless frameworks spurs Monetization. Businesses can sell their APIs as a serverless function, rather than taking the
innovation longer route of patenting it, Reynolds said. For example, a developer creates a black box
function that helps a retailer sell more frozen peas. The developers could provide it as a
 Three ways to prepare serverless interface available in a cloud provider's API library and then charge for a call of that
function, Reynolds said. "Serverless opens the opportunity to monetize algorithms, APIs and
applications for serverless
other ideas that you couldn't see how to do before," he said.
platforms
No lock-in. While Amazon delivered the first modernized cloud-based serverless offering, it's
not the only game in town, Moyer said. Today, changing serverless framework providers is
simple. "A DevOps team can choose to re-architect for serverless using a cloud provider's
FaaS platform or taking a simple approach by deploying software on a serverless framework,"
Moyer said.

Serverless frameworks, FaaS or stateless? What's the diff?

The definitions of types of serverless computing are moving targets. FaaS, serverless
architecture and serverless frameworks are frequently referred to as one and the same. While
Page 17 of 23
each refers to an event-driven, pay-per-use cloud service, knowing the differences among
In this e-guide them can be important.

 The pros and cons of Serverless or stateless? In some IT circles, serverless is synonymous with stateless. In both
approaches, software development takes place entirely in the cloud, where automated
serverless architecture
infrastructure and tools needed to run application code or services are provided. Classic
 Understanding the benefits serverless refers to functional computing or stateless microservices, said Tom Nolle,
president of consulting firm CIMI Corp. In these application architectures, developers create a
of serverless functions specific model of transient code that can be scaled or replaced at will.

 Why deploying APIs on Serverless architecture. Keeping it simple, Gartner analyst Martin Reynolds sees a
serverless architecture as a model for how a development team builds and deploys
serverless frameworks spurs applications. Most application functions take place on the front end. There's no need for
innovation running an always-on server for these on-again, off-again activities.

 Three ways to prepare Serverless framework. A serverless framework is a product for deployment of serverless
applications. In essence, the framework is a command-line interface tool. An automated tool
applications for serverless set facilitates building and deploying web, mobile and IoT applications on event-driven
platforms compute services.

Function as a service. FaaS refers to specific cloud service offerings that provide
capabilities similar to serverless frameworks, but typically have closer integration with the
cloud compute provider. Amazon's Lambda product is a widely known FaaS. Because of
these roots, FaaS and serverless are considered synonyms by many, but FaaS and
serverless frameworks are not. With FaaS, developers may be required to create some of the
server-side logic, but most offerings include a serverless architecture. Some do not. Docker,
for one, provides FaaS but requires the user to manage the underlying infrastructure.

Page 18 of 23
This is the year to experiment with serverless, and APIs are good test cases. Reynolds
In this e-guide suggested doing some trial runs to find internal APIs and applications that can deliver better
value with serverless than with fixed IT assets. "A business using serverless computing can
 The pros and cons of dramatically increase its ability to scale and significantly reduce the cost of dealing with
serverless architecture variable workloads," he said.

 Understanding the benefits


of serverless functions
▼ Next Article
 Why deploying APIs on
serverless frameworks spurs
innovation

 Three ways to prepare


applications for serverless
platforms

Page 19 of 23
In this e-guide Three ways to prepare applications
 The pros and cons of
for serverless platforms
serverless architecture
George Lawton, Contributor
 Understanding the benefits Major cloud vendors, including AWS, Microsoft and Google, have all rolled out serverless
of serverless functions platforms that enable users to weave together simple, or even highly complex, applications on
top of a collection of functions. But to run cloud applications successfully on one of these
 Why deploying APIs on platforms, development teams need to evolve their design processes.

serverless frameworks spurs A few key principles that developers should follow to build serverless apps include:
innovation
1. Develop small and discrete application components.
2. Implement stateless functions.
 Three ways to prepare 3. Plan for ephemeral functions with a short lifespan.
applications for serverless
platforms 1. Smaller, discrete components
Serverless functions, by nature, are intended to perform a single task. This requires teams to
keep their functions small and to orchestrate their development processes around these
separate application components.

A good practice is to break up functions, based on the types of events that trigger them, into
their own repositories. Basically, developers should design each function from the get-go to
respond to one event. If multiple functions are triggered by the same event, then include them
in the same repository. This makes it easier for developers to identify functions based on the
events that launch them.

Page 20 of 23
Each separate function should also include configuration data to ensure consistency when it
In this e-guide launches in development, testing and production environments. It's also important to declare
and isolate dependencies within each function, using tools such as npm and webpack.
 The pros and cons of
serverless architecture 2. Go stateless
 Understanding the benefits Development teams should consider implementing functions as stateless services, in which
the state of a function is stored outside the application itself. You can configure functions to
of serverless functions reference data stores and databases that are managed as part of the configuration data and
 Why deploying APIs on stored with the function in the repository.

serverless frameworks spurs Some serverless platforms offer local storage that persists between function calls. While
developers might be tempted to use this for more complex functions, this local storage doesn't
innovation always hold between function calls and, even if it does, might not work consistently.

 Three ways to prepare Try to use a backing service to store stateful data in a database, separate data store or
cache. A backing service refers to any external service a function consumes over a network
applications for serverless
as part of its normal operation, including caching services, like Memcached, data stores like
platforms CouchDB or databases like MySQL.

3. Plan for ephemerality


One of the benefits of serverless functions is that they can start up in as little as a few
milliseconds -- compared to several seconds or minutes for larger apps that run on PaaS,
containers and VMs -- and stop just as quickly. This makes it easy to scale up a large number
of functions in response to demand or spread computation across functions that run in parallel
and then spin them back down once the process is complete.

In essence, serverless apps are more ephemeral in nature.


Page 21 of 23
This means, to fully realize the benefits of serverless platforms, developers need to remove
In this e-guide many of the components that they commonly bundle with applications from the core logic of
their functions. Developers should:
 The pros and cons of
serverless architecture  prewarm the data sources required by functions;
 set up external logging and tracing infrastructure; and
 Understanding the benefits  manage security.

of serverless functions Prewarm


To prewarm a function, you set up the infrastructure required for the function to communicate
 Why deploying APIs on with databases in advance of deployment.
serverless frameworks spurs To do this, separate the function handler from the core logic. Much like idling a car to improve
innovation how it runs on a cold day, idling the event handler ensures that, as soon as it is invoked, the
function can operate at peak performance. Tools such as AWS CloudFormation and Azure
 Three ways to prepare Event Hubs support the prewarming process.

applications for serverless External logging and tracing

platforms Functions need to be able to shut down quickly and gracefully. Although serverless platforms
include some built-in native storage, it's important to configure an external logging and tracing
service, built into the serverless framework itself, or to set up custom tools to gather and store
logging data from functions as they run.

Tools such as AWS X-Ray and Azure Application Insights can help with logging and tracing.

Security

Serverless apps present another potential attack vector for hackers. Without proper security
measures in place, hackers might be able to spin up functions and access sensitive data.

Page 22 of 23
Developers should configure security settings for classes of functions to allow for minimal
In this e-guide access to other apps required to execute a particular task.

 The pros and cons of


serverless architecture ▼ Next Article
 Understanding the benefits The pros and cons of serverless architecture

of serverless functions Understanding the benefits of serverless functions

 Why deploying APIs on Why deploying APIs on serverless frameworks spurs innovation

serverless frameworks spurs Three ways to prepare applications for serverless platforms

innovation

 Three ways to prepare


applications for serverless
platforms

Page 23 of 23

You might also like