Apache OpenWhisk

an open source, distributed Serverless platform

Upkar Lidder

Developer Advocate, IBM 

 

> ulidder@us.ibm.com

> @lidderupk

> upkar.dev

 

@lidderupk

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

Use Cases

  • Secure and scalable APIs
    • API Gateway Function

 

  • Backend services / micro services

 

  • Event Driven Programming
    • Changes in database
    • Stream Processing
    • Social events
@lidderupk

Short duration, focused, asynchronous

Infrequent or has sporadic demand

Stateless

Highly dynamic​ 

Serverless Landscape

Hosted

Installable

Cloud Native Computing Foundation

@lidderupk

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

Apache OpenWhisk

Packages
@lidderupk

Built on Open Source

@lidderupk

WSK CLI

@lidderupk

WSK SYSTEM PACKAGES

@lidderupk

WSK SYSTEM PACKAGES

@lidderupk
@lidderupk

Apache OpenWhisk (js)

Entry point

Object In

Object Out

Apache OpenWhisk (js)

@lidderupk
@lidderupk

Demo Goals

  • Create secure and scalable REST API for CATS

 

 

[API Gateway ➸ Functions ➸ db]

GET /cat  cat-get

 

POST /cat cat-post

 

PUT /cat cat-put

 

DELETE /cat cat-delete

@lidderupk

Demo Goals

@lidderupk
  • Event Driven Programming
    • Send an email when a  crimson 😻  is added
    • Use cloudant/couchdb feed to listen to document changes on name
    • Use SendGrid to send an email when a crimson cat is added !

Apache

@lidderupk
  • A document-oriented NoSQL database

 

 

 

 

  • Trigger listens to _changes feed. We can use a filter function in a design document to only be notified on certain changes

Demo Goals

@lidderupk
@lidderupk
@lidderupk

What if there is a surge of  cats from Australia ?

CAT-POST is scaled as needed !

@lidderupk

I want to refactor my code base to TypeScript !

Refactor one function/action at a time !

@lidderupk

I want to switch out my email service provider !

Plug and Play model. Only change send_email action !

@lidderupk

I want to onboard more clients to my API

Use API Gateway to set up sepearate keys or use your own authentication !

Composition / Orchestration

CONDITION Action Name

Code

THEN Action Name

Code

ELSE Action Name

Code

@lidderupk

Composition / Orchestration

@lidderupk

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

KUI Shell

@lidderupk

KUI Shell

@lidderupk

Community

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

 

 

  • Github source and OpenWhisk docs

 

 

 

  • Youtube/Medium/Twitter

 

 

  • OpenWhisk Tech Interchange
@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

Future of Serverless ?

@lidderupk

Thank you

 

> ulidder@us.ibm.com

> @lidderupk

> upkarlidder.com

 

@lidderupk

Upkar Lidder

Developer Advocate, IBM

Call for Code 2019

@lidderupk

OpenWhisk

@lidderupk

IBM Cloud Functions

@lidderupk

Compositions

@lidderupk

Solid Foundations

Leverages existing opensource solutions

@lidderupk

Apache OpenWhisk (js)

1

2

3

4

5

@lidderupk

Apache OpenWhisk (py)

Entry point 

Dictionary

Dictionary

@lidderupk

Apache OpenWhisk (py)

@lidderupk

Apache OpenWhisk (py)

@lidderupk

Composition / Orchestration

@lidderupk

Composition / Orchestration

@lidderupk

Apache OpenWhisk (js)

Entry point

Object In

Object Out

@lidderupk

Apache OpenWhisk (js)

1

2

3

4

5

@lidderupk

Composition / Orchestration

CONDITION Action Name

Code

THEN Action Name

Code

ELSE Action Name

Code

@lidderupk

Composition / Orchestration

@lidderupk

Apache OpenWhisk (java)

Entry point

JsonObject In

JsonObject Out

@lidderupk

Apache OpenWhisk (java)

JsonObject In

Fat JAR

@lidderupk

Apache OpenWhisk (java)

@lidderupk

1

2

3

4

Apache OpenWhisk (java)

@lidderupk

Apache OpenWhisk (tail log)

@lidderupk

Apache OpenWhisk (create)

wsk action create helloJava target/hello-world-java.jar

                     --main com.example.FunctionApp

@lidderupk

Apache OpenWhisk (invoke)

wsk action invoke --result helloJava --param name "Upkar Lidder"

@lidderupk

Apache OpenWhisk (example)

@lidderupk
Made with Slides.com