plications. From an infrastructure
perspective, serverless and more tra-
ditional architectures may be used in-
terchangeably or in combination. The
determination of when to use server-
less will likely be influenced by other
non-functional requirements, such as
the amount of control over operations
tion written in JavaScript could take as
input a JSON object as the first param-
eter, and context as the second.
Use Case 2:
Current Cloud Provider Serverless
offerings support a wide variety programming languages, including Java,
Python, Swift, C#, and Node.js. Some
of the platforms also support extensibility mechanisms for code written
in any language as long as it is packaged in a Docker image that supports
a well-defined API.
API Composition
Consider a mobile app that sequentially invokes a geolocation, weather, and language
translation APIs to render the weather forecast for a user’s current location. A short
serverless function can be used to invoke these APIs. Thus the mobile app avoids
invoking multiple APIs over a potentially resource constrained mobile network
connection, and offloads the filtering and aggregation logic to the backend. Glucon,
for example, used serverless in its conference scheduler application to minimize client
code, and avoid disruptions.
Due to the limited and stateless
nature of serverless functions, and its
suitability for composition of APIs,
cloud providers are offering an ecosystem of value added services that
support the different functionalities
a developer may require, and is essential for production ready applications.
For example, a function may need to
retrieve state from permanent storage, such as a file server or database,
another may use a machine learning
service to perform some text analysis
or image recognition. While the functions themselves may scale due to the
serverless guarantees, the underlying
storage system itself must provide reliability and QoS guarantees to ensure
smooth operation.
A serverless anti-pattern of offloading API calls from mobile app to backend.
Mobile app
Lat/long
coordinates
3 day weather
forecast in French
def main(dict):
zip = gis.geo ToZip(dict.get("coords"))
forecasts = weather.forecast(zip)
firstThreeDays = forecasts[0:3]
translated = language.translate(firstThreeDays , ”en", ”fr")
return {"forecast": filter(translated)}
Coord ToZipCode service Weather forecast service Language translation service
Tools and Frameworks
Note the main function is acting as an orchestrator that is waiting for a response
from a function before invoking another, thus incurring a cost of execution while the
function is basically waiting for I/O. Such a pattern of programming is referred to as a
serverless anti-pattern.
One of the major challenges slowing
the adoption of serverless is the lack of
tools and frameworks. The tools and
frameworks currently available can be
categorized as follows: development,
testing, debugging, deployment. Several solutions been proposed to deal with
these categories.
The serverless programming approach would be to encapsulate each API call as
serverless function, and the chain the invocation of these functions in a sequence. The
sequence itself behaves as a composite function.
Offloading API calls and glue logic from mobile app to backend.
Mobile App
Almost all cloud providers provide
a cloud-based IDE, or extensions/pl-ugins to popular IDEs that allows the
developer to code and deploy serverless functions. They also provide a local containerized environment with an
SDK that allows the developer to develop and test locally serverless functions
before deploying it in a cloud setting.
To enable debugging, function execution logs are available to the developer
and recent tools such as AWS X-Rayi
allow developers to detect potential
causes of the problem. 22 Finally, there
are open source frameworksj that allow
developers to define serverless func-
Lat/long 3 day weather
forecast in French
Coord ToZipCode service Weather Forecast Service Language Translation Service
composite function
More complex orchestrations can use technologies like AWS Step Functions and
IBM Composer to prevent serverless anti-patterns but may incur additional costs due to
the services.
i https://aws.amazon.com/xray/
j https://serverless.com/
tions, triggers, and services needed by
the functions. Theses frameworks will
handle the deployment of these functions to the cloud provider.
Use Cases
Serverless computing has been utilized to support a wide range of ap-