cloud functions, one can appropriately
cache the most important packages
across the node workers, thus leading
to reduced startup times. 24
In typical serverless cloud offerings, the only resource configuration
customers are allowed to configure
is the size of main memory allocated
to a function. The system will allocate other computational resources
(for example, CPU) in proportion to
the main memory size. The larger
the size, the higher the CPU allocation. Resource usage is measured and
billed in small increments (for example, 100ms) and users pay only for the
time and resources used when their
functions are running.
Several open source serverless com-
puting frameworks are available from
both industry and academia (for exam-
ple, Kubeless, OpenLambda, Open-
Whisk, OpenFaaS). In addition, ma-
jor cloud vendors such as Amazon,
IBM, Google, and Microsoft have
publically available commercial server-
less computing frameworks for their
consumers. While the general properties
(for example, memory, concurrent in-
vocations, maximum execution dura-
tion of a request) of these platforms
are relatively the same, the limits as set
by each cloud provider are different.
Note the limits on these properties are
a moving target and are constantly
changing as new features and optimi-
zations are adopted by cloud provid-
ers. Evaluating the performance of dif-
ferent serverless platforms to identify
the trade-offs has been a recent topic
of investigation, 17, 20, 26 and recent
benchmarks have been developed to
compare the serverless offering by the
different cloud providers.h
Programming Model
A typical FaaS programming model consists of two major primitives: Action
and Trigger. An Action is a stateless
function that executes arbitrary code.
Actions can be invoked asynchronously
in which the invoker—caller request—
does not expect a response, or synchronously where the invoker expects a
response as a result of the action execution. A Trigger is a class of events from
a variety of sources. Actions can be invoked directly via REST API, or executed based on a trigger. An event can also
trigger multiple functions (parallel
invocations), or the result of an action
could also be a trigger of another function (sequential invocations). Some
serverless frameworks provide higher-level programming abstractions for developers, such as function packaging,
sequencing, and composition, which
may make it easier to construct more
complex serverless apps.
Currently, serverless frameworks ex-
ecute a single main function that takes
a dictionary (such as a JSON object) as
input and produces a dictionary as out-
put. They have limited expressiveness
as they are built to scale. To maximize
scaling, serverless functions do not
maintain state between executions.
Instead, the developer can write code
in the function to retrieve and update
any needed state. The function is also
able to access a context object that rep-
resents the environment in which the
function is running (such as a security
context). As shown in Figure 2, a func-
h http://faasmark.com/
the function—use code from storage
use—into the container and executes
the event. The platform also manages
stopping and deallocating resources
for idle function instances.
Creating, instantiating, and destroying a new container for each function
invocation while can be expensive and
introduces an overall latency, which is
referred to as the cold start problem. In
contrast, warm containers are containers that were already instantiated and
executed a function. Cold start problems can be mitigated by techniques
such as maintaining a pool of uninstan-tiated stem cell containers, which are
containers that have been previously
instantiated but not assigned to a particular user, or reuse a warm container
that have been previously invoked for
the same user. 7 Another factor that can
affect the latency is the reliance of the
user function on particular libraries (for
example, numpy) that must be downloaded and installed before function
invocation. To reduce startup time of
One class of applications that exemplify the use of serverless is event-based
programming. The following use case shows an example of a bursty, compute-intensive
workload popularized by AWS Lambda, and has become the “Hello, World” of
serverless computing. It is a simple image-processing event handler function.
Netflix uses serverless functions to process video files ( https://amzn.to/2xMtwAt).
The videos are uploaded to Amazon S3, 23 which emits events that trigger Lambda
functions that split the video and transcode them in parallel to different formats. The
flow is depicted in the figure here.
The function is completely stateless and idempotent, which has the advantage that
in the case of failure (such as network problems accessing the S3 folder), the function
can be executed again with no side effects.
While the example here is relatively simple, by combining serverless functions with
other services from the cloud provider, more complex applications can be developed,
for example, stream processing, filtering and transforming data on the fly, chatbots,
and Web applications.
Use Case 1:
Event Processing
Video processing.
Serverless functions
to transcode videos
Raw
videos
Video
segments
New video
event
Store
segments
Serverless functions
to transcode videos
Transcoded
videos
New segment
event