Serverless Patterns

A presentation at InnoTech San Antonio in April 2019 in San Antonio, TX, USA by Jesse Butler

Slide 1

Slide 1

ive Serverless Patterns Basic Patterns with Functions and Serverless Jesse Butler Cloud Native Advocate, Oracle Cloud Infrastructure cloudnative.oracle.com @jlb13

Slide 2

Slide 2

Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. @jlb13

Slide 3

Slide 3

Level Set • Devs, Ops, DevOps? • Serverless users? • In production? • Lambda? Azure? Something Else? Copyright © 2019, Oracle and/or its affiliates. All rights reserved. @jlb13 3

Slide 4

Slide 4

Monolithic Applications Users Application Database Copyright © 2019, Oracle and/or its affiliates. All rights reserved. @jlb13

Slide 5

Slide 5

Monolithic Applications Users Application Database Copyright © 2019, Oracle and/or its affiliates. All rights reserved. @jlb13

Slide 6

Slide 6

Microservices Deploying Code to Systems We Build in the Cloud with Containers and Kubernetes Load balancer Service Copyright © 2019, Oracle and/or its affiliates. All rights reserved. Service Service Database Queue @jlb13

Slide 7

Slide 7

Serverless Deploying Code to Systems We Build in the Cloud with Containers and Kubernetes Load balancer Service Copyright © 2019, Oracle and/or its affiliates. All rights reserved. Service Service Database Queue @jlb13

Slide 8

Slide 8

Trend towards Serverless Functions Abstractions Containers Virtual machines Bare Metal Decreasing concern (and control) over infrastructure implementation Copyright © 2019, Oracle and/or its affiliates. All rights reserved. @jlb13 8

Slide 9

Slide 9

What Is Serverless? • Event-driven architecture • Invisible infrastructure • Automatic scaling on demand • Granular billing for execution time • Fault tolerant and highly available Copyright © 2019, Oracle and/or its affiliates. All rights reserved. @jlb13 9

Slide 10

Slide 10

How Does it Work? Upload Function Source Code Configure Function Trigger Copyright © 2019, Oracle and/or its affiliates. All rights reserved. Function is invoked when triggered Pay for execution time, not idle time @jlb13 10

Slide 11

Slide 11

Function Example • Different projects and products differ in use and workflow • This example function can be deployed in Oracle Functions • Just the code, configured against any number of event triggers • As with microservices, applications are composed of many functions Copyright © 2019, Oracle and/or its affiliates. All rights reserved. @jlb13

Slide 12

Slide 12

Functions-as-a-Service Event Sources Function Execution F(n) F(n) F(n) Backend Services F(n) Kubernetes, Docker, and/or Hypervisor Business Intelligence Analytics Triggers Compute, Network, Storage Databases Copyright © 2019, Oracle and/or its affiliates. All rights reserved. @jlb13 12

Slide 13

Slide 13

Oracle Functions Pay Per Use Oracle Functions Pay for execution, not for idle time Functions-as-a-Service Oracle Cloud Integrated Container Native Open Source Engine Multi-tenant Secure Copyright © 2019, Oracle and/or its affiliates. All rights reserved. Autonomous Platform auto-scales functions No servers to provision, manage No Lock-in Built on open-source Fn Project and Docker @jlb13 13

Slide 14

Slide 14

Key Features Open Source Engine Container Native Function Dev Kits Fine-grained Billing Advanced Diagnostics HTTP Events Streams Timer Oracle Cloud Triggers Copyright © 2019, Oracle and/or its affiliates. All rights reserved. @jlb13

Slide 15

Slide 15

Execution Model • Synchronous • Asynchronous • Streaming Copyright © 2019, Oracle and/or its affiliates. All rights reserved. @jlb13

Slide 16

Slide 16

Events, Determined by Context • Changes in data • API Invocations • Requests on endpoints • Changes in resources • Timers Copyright © 2019, Oracle and/or its affiliates. All rights reserved. @jlb13

Slide 17

Slide 17

Using Events • Events are configured differently by platform • Abstractly, inform the platform to what event(s) should invoke this function • CNCF Serverless WG has drafted the CloudEvents specification • Oracle Functions use Cloud Events format for portability Copyright © 2019, Oracle and/or its affiliates. All rights reserved. @jlb13

Slide 18

Slide 18

Use Case: Web and Mobile Backends ORACLE CLOUD Identity Database API Platform Web, Mobile Apps Functions Mobile Trigger functions Process data Copyright © 2019, Oracle and/or its affiliates. All rights reserved. Storage Data persisted @jlb13 18

Slide 19

Slide 19

Extend and Enhance Existing Applications ORACLE CLOUD SaaS App Inventory create / update Analytics Functions Another App Support incident create / update Trigger functions Enrich data and send to Analytics service Copyright © 2019, Oracle and/or its affiliates. All rights reserved. Use data for analytics and insights Visualize data @jlb13 19

Slide 20

Slide 20

Automation and DevOps ORACLE CLOUD Compute Storage Other

Check tags Check security roles Patch or update Modify/kill resource Vulnerability assess State Change Triggers Copyright © 2019, Oracle and/or its affiliates. All rights reserved. Reports/Notifications @jlb13 20

Slide 21

Slide 21

Use Case: Real-Time Stream Processing ORACLE CLOUD Messaging/ Streaming Database Functions Data from multiple sources – Product Reviews and Ratings, Customer Service Interactions, Social Media, etc. Trigger functions Perform user sentiment analysis Copyright © 2019, Oracle and/or its affiliates. All rights reserved. Records saved in database Dashboards with user sentiment analysis trends @jlb13 21

Slide 22

Slide 22

Use Case: Real-Time File Processing ORACLE CLOUD Database Storage Functions High resolution product image uploaded to storage Trigger functions Generate images of different resolutions and sizes Copyright © 2019, Oracle and/or its affiliates. All rights reserved. Storage Images saved in Storage, metadata in Database Generated images displayed on various pages and devices @jlb13 22

Slide 23

Slide 23

Use Case: Batch Processing ORACLE CLOUD Scheduled batch job Database Database Functions Credit card transactions Transaction details Calculate bonus points Bonus points updated Loyalty bonus received Scheduled batch job Database Storage Functions Utility consumption Consumption details Generate utility bill PDF file Copyright © 2019, Oracle and/or its affiliates. All rights reserved. PDF files saved in Storage Utility bill PDF file @jlb13 23

Slide 24

Slide 24

Internet of Things ORACLE CLOUD Service Cloud Ingest Functions Devices and things streaming sensor data Trigger functions Executive Dashboard Check data against thresholds. If exceeded, raise support incidents, send notifications Copyright © 2019, Oracle and/or its affiliates. All rights reserved. Mobile Incident created in Service Cloud, notification sent to the technician Technician App @jlb13 24

Slide 25

Slide 25

Mapping Execution, Events and Architecture • Eventing is typically driven by context • Execution model is an important choice Copyright © 2019, Oracle and/or its affiliates. All rights reserved. @jlb13

Slide 26

Slide 26

Choose a Pattern that Helps you Minimize • Less is more: shoot for a single handler per module • Better to proliferate than to decompensate • Observability and triage become infinitely easier at the boundaries Copyright © 2019, Oracle and/or its affiliates. All rights reserved. @jlb13

Slide 27

Slide 27

Separate and Simplify • Typically consumption of events define application boundaries • Share libraries between functions and applications, not execution context Copyright © 2019, Oracle and/or its affiliates. All rights reserved. @jlb13

Slide 28

Slide 28

Worries • Don’t worry too much about cold starts • Do worry about lock-in and data egress • Pay attention to the system you are integrating with – keep it open Copyright © 2019, Oracle and/or its affiliates. All rights reserved. @jlb13

Slide 29

Slide 29

Dive In! • The best way to learn is to do • Often a POC becomes production • You will not be alone • Have fun! Copyright © 2019, Oracle and/or its affiliates. All rights reserved. @jlb13

Slide 30

Slide 30

Thanks! @jlb13 cloud.oracle.com/trial cloudnative.oracle.com