+ All Categories
Home > Documents > Cloud Made Simple with Serverless Python · IBM Cloud Functions–managed OpenWhisk on IBM Cloud...

Cloud Made Simple with Serverless Python · IBM Cloud Functions–managed OpenWhisk on IBM Cloud...

Date post: 30-May-2020
Category:
Upload: others
View: 18 times
Download: 0 times
Share this document with a friend
27
1 Cloud Made Simple with Serverless Python Sugandha Agrawal Software Engineer, IBM R&D, Germany [email protected] @SuFromIndia
Transcript

1

Cloud Made Simple with Serverless PythonSugandha AgrawalSoftware Engineer, IBM R&D, [email protected]

@SuFromIndia

How do I run my codeon the cloud today?

2

</> ?

3

Evolution of Serverless

4

Increasing Abstraction

Functions

Application

Runtime

Operating System

Virtualization

Hardware

IaaS PaaS FaaS

Functions

Application

Runtime

Operating System

Virtualization

Hardware

Functions

Application

Runtime

Operating System

Virtualization

Hardware

Functions

Application

Runtime

Operating System

Virtualization

Hardware

On-Prem

Platform Managed

User Managed

5

Writing Applications

Monolithic:o Application deployed as one unit.o Introducing new code is a complete new

deployment.Microservices:o Each service is a functional component of

your application.o DecouplingFaaSo Further decoupling – each fn does one

thing & does it well.o No infrastructure management.

Monolithic Application

Microservice

Microservice

Microservice

Function

Function

Function

Function

Function

What does Serverless promise to developers?

No Servers

6

What does Serverless promise to developers?

Scalability

7

What does Serverless promise to developers?

Pay per use

8

What does Serverless promise to developers?

Event Driven Workloads

9

What does Serverless promise to developers?

Integration with Cloud Services

10

What does Serverless promise to developers?

Decreased time to market

11

“Serverless abstracts away the most menial parts of building an application, leaving developers free to actually spend their days coding.”

- serverless.com

12

When does it make sense to use Serverless?

Internet of Things

Web App Backends

Mobile Backends

Data Processing

Conversational Scenarios

Scheduled Tasks

13

Weather Gods

March, 2019 / © 2019 IBM Corporation

Weather Gods, Backend Architecture

14

USERS DB

GROUP SCANNER

RAIN SCANNER

1 Cron Trigger Every 3 Minutes

WEATHER CHECKER

WEATHER UPDATE

SNOW SCANNER

WIND SCANNER

STORM SCANNER

FROST SCANNER

ETC SCANNER NOTIFICATION TRIGGER

SEND NOTIFICATIONTWC

Service

IBM Cloud Push

Notifications Service

Weather Gods App

2

3

4

TRIGGER

March, 2019 / © 2019 IBM Corporation

Parallel Code Execution

- Run all “weather scanners” in parallel

- Scale these up and down as required based on user preferences

15

Weather Gods, Why Serverless? Scheduled Tasks

- Chronological Trigger every 3 minutes

Integrated Platform Services

- The Weather Company Data

- Cloudant NoSQL DB

- Notifications Service

Event Driven Code Execution

- User location updated

- New user in DB

- New weather item in DB

March, 2019 / © 2019 IBM Corporation

I’m ready to write my next app. How do I get started with Serverless Python?

16

17

Some Serverless Options

Apache OpenWhisk – Apache Incubator Project [Node.js, Go, Java, PHP, Ruby, Swift, Python]IBM Cloud Functions – managed OpenWhisk on IBM Cloud[Node.js, Go, Java, PHP, Ruby, Swift, Python]Azure Functions – Microsoft [GA: Node.js, C#, F#, Python]Amazon Lambda – Amazon [Node.js, Java, Go, C#, Python]Python Anywhere – more focused on web hosting & education[Python]

Write code to run in the cloud.

18

Entry Point

Parameters (json)

Response (json)

19

IBM Cloud Functions & Python Demo

o “Bernese mountain dog”o “dog”o “animal”

[input] [output]

20

IBM Cloud Functions & Python Demo

CLOUDANT

READ CHANGES FROM DB

GET CLASSIFIERS

New DB item

(imageUrl)

CLOUDANT CHANGES TRIGGER

VISUAL RECOGNITION

SERVICE

March, 2019 / © 2019 IBM Corporation

21

Demo.New Image Trigger + Image Analysis in Python.

That’s cool and all, but I’ve got bigger dreams for serverless python!

22

Pywren – Cloud Computing for Everyone

23

• Great for running “embarrassingly parallel” workloads.

• No effort to separate problem into parallel tasks

• No dependency & need for communication between those parallel tasks or task results.

• Simplifies many scale-out use cases for data science and computational imaging.

• Provides a simple “push to the cloud” experience

• Pywren runs the python function at scale while monitoring executions, and obtaining and combining results.

Function

Function

Function

Function

Function

Function Result

Pywren

24

http://pywren.io/

https://github.com/pywren/pywren

Pywren on Amazon Lambda:https://thenewstack.io/aws-lambda-finds-unexpected-market-scientific-computing/

Pywren

25

http://pywren.io/

https://github.com/pywren/pywren

Pywren on IBM Cloud Functions:https://www.ibm.com/blogs/bluemix/2019/01/monte-carlo-simulations-with-ibm-cloud-functions/

March, 2019 / © 2019 IBM Corporation

26

Thank you

https://cloud.ibm.com/openwhisk

twitter.com/SuFromIndia

https://github.com/SugandhaAgrawal/o

w-py

Feel free to reach out for any questions or to share what you’re working on.

27March, 2019 / © 2019 IBM Corporation


Recommended