What, Why, and How of Serverless

Top three use cases with examples

Upkar Lidder, @lidderupk

Developer Advocate, IBM

 

- ulidder@us.ibm.com

- @lidderupk

IBM Cloud - http://bit.ly/ibm-postcon-2019

@lidderupk
IBM Developer

What is Serverless

Serverless computing refers to the concept of building and running applications that do not require server management.

 

It describes a finer-grained deployment model where applications, bundled as one or more functions, are uploaded to a platform and then executed, scaled, and billed in response to the exact demand needed at the moment.

 

It refers to the idea that consumers of serverless computing no longer need to spend time and resources on server provisioning, maintenance, updates, scaling, and capacity planning. Instead, all of these tasks and capabilities are handled by a serverless platform and are completely abstracted away from the developers​.

Cloud Native Computing Foundation

https://github.com/cncf/wg-serverless/tree/master/whitepapers/serverless-overview

@lidderupk
IBM Developer

Top 3 Common Use Cases - we saw today

  • Secure and scalable APIs
    • API Gateway Function
    • HTTP level scaling

 

  • Backend services / micro services
    • function/service level scaling
    • polyglot functions

 

  • Event Driven Programming
    • Changes in database
    • Social events
@lidderupk
IBM Developer

Leans well to ...

  • Small, focused, asynchronous, concurrent, easy to parallelize into independent units of work

 

  • Infrequent or has sporadic demand, with large, unpredictable variance in scaling requirements

 

  • Stateless, ephemeral, without a major need for instantaneous cold start time

 

  • Highly dynamic in terms of changing business requirements that drive a need for accelerated developer velocity

 

@lidderupk
IBM Developer

Example - Game App

@lidderupk
IBM Developer

Example - Conference App

@lidderupk
IBM Developer

Serverless Landscape

Hosted

Installable

https://github.com/cncf/landscape#serverless

@lidderupk

Reference Clients

@lidderupk
IBM Developer

MediaSpirit

90% cost reduction with serverless functions that run only when users need it

https://www.ibm.com/case-studies

Accommodates peaks on weekends and garbage days

Provides monitoring and analytics capabilities to help waste management organizations improve service delivery

GreenQ Ltd

ESPN Fantasy Football

@lidderupk
IBM Developer

ESPN and IBM have teamed up to bring a new level of insight to fantasy football team owners that correlates millions of news articles with traditional football statistics.

 

https://developer.ibm.com/series/watson-behind-the-code-fantasy-football-2018/

The services comprehends over 2 million news articles, videos, and podcasts per day. Over the first 9 weeks of the football season provided over 12.2 billion insights for the millions of ESPN Fantasy players.

CNCF - Serverless

@lidderupk
IBM Developer
https://github.com/cncf/wg-serverless

IBM Code Patterns

@lidderupk
IBM Developer
https://developer.ibm.com/patterns/category/serverless

Apache OpenWhisk

Apache OpenWhisk is an open source, distributed Serverless platform that supports a programming model in which developers write functional logic (called Actions), in any supported programming language, that can be dynamically scheduled and run (with Rules) in response to associated events (via Triggers) from external sources ( Feeds) or from HTTP requests.

@lidderupk
IBM Developer

Apache OpenWhisk

Packages
@lidderupk
IBM Developer

Secure and scalable APIs

@lidderupk
IBM Developer
https://github.com/lidderupk/ibm-cloud-functions-serverless-apis

Secure and scalable APIs

@lidderupk
IBM Developer

Backend services / micro services

@lidderupk
IBM Developer

Backend services / micro services

@lidderupk
IBM Developer

Backend services / micro services

@lidderupk
IBM Developer
ARG model
FROM codait/${model}:latest

ADD openwhisk.py .

EXPOSE 8080

CMD python openwhisk.py
https://github.com/lidderupk/serverless-max-models

Event Driven Applications

@lidderupk
IBM Developer

Event Driven Applications - dark vision

@lidderupk
IBM Developer
https://developer.ibm.com/series/watson-behind-the-code-fantasy-football-2018/

Apache OpenWhisk - more real example

1user registers
2tail logs
3SMS
4email
@lidderupk
IBM Developer

Apache OpenWhisk - more real example

https://github.com/lidderupk/openwhisk-registration/tree/master/javascript

@lidderupk
IBM Developer

Solid Foundations

Leverages existing opensource solutions

@lidderupk
IBM Developer

Solid Foundations

Leverages existing opensource solutions

@lidderupk
IBM Developer

Built on Open Source

@lidderupk
IBM Developer

WSK CLI

@lidderupk
IBM Developer

WSK SYSTEM PACKAGES

@lidderupk
IBM Developer

WSK SYSTEM PACKAGES

@lidderupk
IBM Developer

Apache OpenWhisk (js)

Entry point

Object In

Object Out

@lidderupk
IBM Developer

Apache OpenWhisk (js)

@lidderupk
IBM Developer
@lidderupk

Some things to 🤔

  • Functions are stateless. Need some sort of persistence between runs.
  • Are you able to test and develop locally ? Does provider have CLI ?
  • Can you easily version your functions ? Source control ?
  • Can you easily monitor your functions ?
  • Security and API gateway
  • Avoid long-running loops / mini-monoliths ?
  • Latency (cold, warm and hot loads)
  • How do you track dependencies ?
@lidderupk
IBM Developer

Community and Help

  • Slack
  • http://openwhisk-team.slack.com/

 

 

  • Github and OpenWhisk docs

 

 

 

  • Youtube/Medium/Twitter

 

 

  • Bi-weekly interexchange meetings
@lidderupk
IBM Developer

Future of Serverless ?

@lidderupk
IBM Developer

Thank you

 

Let's chat !

@lidderupk
IBM Developer

Upkar Lidder, IBM

 

@lidderupk

https://github.com/lidderupk/

ulidder@us.ibm.com

Composition / Orchestration

CONDITION Action Name

Code

THEN Action Name

Code

ELSE Action Name

Code

@lidderupk
IBM Developer

Composition / Orchestration

@lidderupk
IBM Developer

So much more ...

  • More Compositions - Use higher-level programming constructs to declaratively chain together multiple actions.
    • while, repeat, let, retry, try, if, etc

 

  • HTTP Actions (web == true)

 

  • Packages community (couchdb, kafka, etc)

 

  • API Gateway (rate limiting, authentication/authorization)

 

  • Install external packages, debugging, etc
@lidderupk
IBM Developer

KUI Shell

@lidderupk
IBM Developer

Serverless Usecases

By Upkar Lidder

Serverless Usecases

  • 880