SlideShare una empresa de Scribd logo
1 de 24
Descargar para leer sin conexión
Enabling AWS Lambda-like functionality
with OpenStack Swift and OpenWhisk
Shaun Murakami, Senior Cloud Architect, @stmuraka
Andrew Bodine, Software Engineer, @bodine_andrew
Development in the Cloud
Bare
metal
Virtual
machines
Containers
Functions
Decreasing concern (and control) over stack implementation
Increasingfocusonbusinesslogic
Serverless can handle many cloud native 12 Factors app
I Codebase Handled by developer (Manage versioning of functions on their own)
II Dependencies Handled by developer, facilitated by serverless platform (Runtimes and packages)
III Config Handled by platform (Environment variables or injected event parameters)
IV Backing services Handled by platform (Connection information injected as event parameters)
V Build, release, run Handled by platform (Deployed resources are immutable and internally versioned)
VI Processes Handled by platform (Single stateless containers often used)
VII Port binding Handled by platform (Actions or functions are automatically discovered)
VIII Concurrency Handled by platform (Process model is hidden and scales in response to demand)
IX Disposability Handled by platform (Lifecycle is hidden from the user, fast startup and elastic scale is prioritized)
X Dev/prod parity Handled by developer (The developer is the deployer. Scope of what differs is narrower)
XI Logs Handled by platform (Developer writes to console.log, platform handles log streaming)
XII Admin processes Handled by developer (No distinction between one off processes and long running)
Event driven programming
Execute app logic in response to database triggers
Execute app logic in response to sensor data
Execute app logic in response to cognitive trends
Execute app logic in response to scheduled tasks
Provide easy server-side backend for mobile app
Amazon Lambda
• An event-driven compute service where AWS Lambda runs
your code in response to events, such as changes to data or in
response to HTTP requests.
http://docs.aws.amazon.com/lambda/latest/dg/welcome.html
http://docs.aws.amazon.com/lambda/latest/dg/lambda-introduction.html
OpenWhisk
An open source cloud platform
that executes code
in response to events
https://github.com/openwhisk/openwhisk
OpenWhisk supports many growing workloads
OpenWhisk can help power
various mobile, web and IoT app
use cases by simplifying the
programming model of
orchestrating various services
using events without a dedicated
backend.
Digital app workloads Big Data/Analytics pipeline
Complex data pipelines for Big
Data/Analytics tasks can be scripted
using changes in data services or
streams for near real-time analytics
and feedback.
DevOps and infrastructure as code
OpenWhisk can be used to
automate DevOps pipelines
based on events triggered from
successful builds, or completed
staging, or a go-live event.
Microservices builder
OpenWhisk can be used to easily
build microservices given the
footprint and programming model
desired by microservices
OpenWhisk Programming model
Developers use Rules to…
associate how Actions handle events
emitted by Triggers generated by services
R T A:=
riggers
A class of events that can occur
T
Social events
Data changes
Device readings Location updates
User input
ctions
Code that runs in response to an
event (i.e., an event handler)
A
Supports a variety of languages such as
JavaScript, Python, Java, and Swift ...
function main(params) {
return { message: 'Hello, ' +
params.name + ' from ' + params.place };
};
... even as a Docker container
Actions can be chained together
AA := A1 + A2 + A3
AB := A2 + A1 + A3
AC := A3 + A1 + A2
OpenWhisk can implement RESTful microservices
Send HTTP request
HTTP GET
app.com/customers
1
Invoke OpenWhisk
action get-customers
Browser
Mobile App
Web App
2
JS Swift Docker …
OpenWhisk
API
Proxy
OpenStack Swift Middleware
• Swift uses middleware to add custom behaviors.
• The majority of Swift middleware is applied to the
Proxy Server.
• Python WSGI Middleware (or just “middleware”)
can be used to “wrap” the request and response
of a Python WSGI application (i.e. a webapp, or
REST/HTTP API), like Swift’s WSGI servers
(proxy-server, account-server, container-server,
object-server)
http://docs.openstack.org/developer/swift/development_middleware.html
http://docs.openstack.org/admin-guide/objectstorage-arch.html
OpenStack Swift System Metadata
• Provides a means to store potentially private custom metadata
with associated Swift resources in a safe and secure fashion.
• May be set on accounts and containers by including headers
with a PUT or POST request.
• Maybe set on objects using only PUT requests.
• Takes the form of X-<type>-Sysmeta-<key>: <value>
• <type> depends on the resources type (i.e. Account, Container,
Object)
• <key> and <value> are set by trusted code running in a Swift WSGI
Server
http://docs.openstack.org/developer/swift/development_middleware.html#sysmeta
Demo Overview
AWS S3 + Lambda
1. A user uploads an object to the source bucket in
Amazon S3 (object-created event).
2. Amazon S3 detects the object-created event.
3. Amazon S3 publishes the s3:ObjectCreated:* event
to AWS Lambda by invoking the Lambda function
and passing event data as a function parameter.
4. AWS Lambda executes the Lambda function by
assuming the execution role that you specified at
the time you created the Lambda function.
5. From the event data it receives, the Lambda
function knows the source bucket name and object
key name. The Lambda function reads the object
and creates a thumbnail using graphics libraries,
and saves it to the target bucket
http://docs.aws.amazon.com/lambda/latest/dg/with-s3-example.html
OpenStack Swift + OpenWhisk
JS Swift Docker …
OpenWhisk
APIProxy
1. A user uploads an object to a OpenStack Swift
Container.
2. OpenStack Swift detects an object has been
modified in the Container.
3. The Swift Webhook middleware triggers an
OpenWhisk Action by invoking the OpenWhisk API
specified as the container’s webhook URL.
4. The OpenWhisk credentials are validated against
the OpenWhisk authorization service.
5. From the request payload, the OpenWhisk action
knows the source container and object name. The
OpenWhisk Action creates a thumbnail using
graphics libraries and saves it to a target container
Swift
Middleware
Source
Container
Target
Container
2
3
4
Whisk
Action
1
5
Let’s take a look at how it’s implemented
• OpenStack Swift Middleware Code
• OpenWhisk Action Code
OpenStack Swift Middleware (webhook.py)
class WebhookMiddleware(object):
@wsgify
def __call__(self, req):
req.headers[SYSMETA_WEBHOOK] = req.headers['x-webhook']
req.headers[SYSMETA_WEBHOOK_AUTH] = req.headers['x-webhook-auth']
resp = req.get_response(self.app)
if obj and is_success(resp.status_int) and req.method in [’PUT’,’DELETE’]:
webhook_req = urllib2.Request(container_info['sysmeta'].get('webhook'))
webhook_req.add_header('Authorization', base64.b64encode(container_info['sysmeta'].get('webhook-auth')))
webhook_req.add_data(json.dumps({
’url’: swiftUrl, ‘token’: req.headers[‘x-auth-token’], ‘container’: container, ‘object’: obj, ‘method’: req.method
}))
...
try:
webhook_resp = urllib2.urlopen(webhook_req).read()
….
return resp
Install Webhook Middleware
1. Place webhook.py in middleware of swift-proxy
…/swift/common/middleware/webhook.py
2. Update proxy-server.conf
…
[pipeline:main]
pipeline = catch_errors gatekeeper healthcheck ... webhook proxy-server
[filter:webhook]
paste.filter_factory = swift.common.middleware.webhook:webhook_factory
...
OpenWhisk Action Dockerfile
FROM ubuntu:14.04
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update 
&& apt-get install -y curl
# Node.js
RUN curl -sL https://deb.nodesource.com/setup_4.x | bash - 
&& apt-get install -y nodejs
WORKDIR /root/server
COPY server .
RUN npm install
EXPOSE 8080
CMD node ./app.js
OpenWhisk Action
Demo
Putting it all together…
Future work
Swift Asynchronous Event Notification Framework
• Support Multiple Notification Use Cases
• OpenWhisk / Serverless computing
• Cloud inter-service notifications
• Metadata search indexing
• Resource / traffic monitoring
• Common Notification APIs
• Enable / disable notifications on an account or container
• Allow for user / system level policies
• Desire to become a de-facto standard in Swift for notification management
• Deployment Flexibility
• Can be adapted to multiple message queue technologies
• Initial submission will include Kafka and Zaqar
• Patch WIP
• https://review.openstack.org/388393
Resources
• AWS Lambda
• Example: http://docs.aws.amazon.com/lambda/latest/dg/with-s3-example.html
• OpenWhisk
• Code: https://github.com/openwhisk/openwhisk
• On IBM BlueMix: http://www.ibm.com/cloud-computing/bluemix/openwhisk/
• OpenStack Swift Middleware
• http://docs.openstack.org/developer/swift/development_middleware.htm
• Demo Code
• https://github.ibm.com/stmuraka/OpenStackSwift-OpenWhisk

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Building a PaaS with Docker and AWS
Building a PaaS with Docker and AWSBuilding a PaaS with Docker and AWS
Building a PaaS with Docker and AWS
 
Weaveworks at AWS re:Invent 2016: Operations Management with Amazon ECS
Weaveworks at AWS re:Invent 2016: Operations Management with Amazon ECSWeaveworks at AWS re:Invent 2016: Operations Management with Amazon ECS
Weaveworks at AWS re:Invent 2016: Operations Management with Amazon ECS
 
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
 
Amazon ECS Deep Dive
Amazon ECS Deep DiveAmazon ECS Deep Dive
Amazon ECS Deep Dive
 
TurboCharge Your Continuous Delivery Pipeline with Containers - Pop-up Loft
TurboCharge Your Continuous Delivery Pipeline with Containers - Pop-up LoftTurboCharge Your Continuous Delivery Pipeline with Containers - Pop-up Loft
TurboCharge Your Continuous Delivery Pipeline with Containers - Pop-up Loft
 
Serverless in production, an experience report (codemotion milan)
Serverless in production, an experience report (codemotion milan)Serverless in production, an experience report (codemotion milan)
Serverless in production, an experience report (codemotion milan)
 
Iguazú: A Long-Running Job Scheduler using Docker and Mesos
Iguazú: A Long-Running Job Scheduler using Docker and MesosIguazú: A Long-Running Job Scheduler using Docker and Mesos
Iguazú: A Long-Running Job Scheduler using Docker and Mesos
 
Going serverless with aws
Going serverless with awsGoing serverless with aws
Going serverless with aws
 
AWS Lambda from the trenches
AWS Lambda from the trenchesAWS Lambda from the trenches
AWS Lambda from the trenches
 
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
 
Docker on AWS - the Right Way
Docker on AWS - the Right WayDocker on AWS - the Right Way
Docker on AWS - the Right Way
 
Velocity NYC 2016 - Containers @ Netflix
Velocity NYC 2016 - Containers @ NetflixVelocity NYC 2016 - Containers @ Netflix
Velocity NYC 2016 - Containers @ Netflix
 
Serverless Reality
Serverless RealityServerless Reality
Serverless Reality
 
Node withoutservers aws-lambda
Node withoutservers aws-lambdaNode withoutservers aws-lambda
Node withoutservers aws-lambda
 
AWS December 2015 Webinar Series - Continuous Delivery to Amazon EC2 Containe...
AWS December 2015 Webinar Series - Continuous Delivery to Amazon EC2 Containe...AWS December 2015 Webinar Series - Continuous Delivery to Amazon EC2 Containe...
AWS December 2015 Webinar Series - Continuous Delivery to Amazon EC2 Containe...
 
Service discovery with Eureka and Spring Cloud
Service discovery with Eureka and Spring CloudService discovery with Eureka and Spring Cloud
Service discovery with Eureka and Spring Cloud
 
Automated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE ApplicationsAutomated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE Applications
 
Give your little scripts big wings: Using cron in the cloud with Amazon Simp...
Give your little scripts big wings:  Using cron in the cloud with Amazon Simp...Give your little scripts big wings:  Using cron in the cloud with Amazon Simp...
Give your little scripts big wings: Using cron in the cloud with Amazon Simp...
 
Serverless Architecture Patterns - Manoj Ganapathi
Serverless Architecture Patterns - Manoj GanapathiServerless Architecture Patterns - Manoj Ganapathi
Serverless Architecture Patterns - Manoj Ganapathi
 
Serverless Architectures on AWS Lambda
Serverless Architectures on AWS LambdaServerless Architectures on AWS Lambda
Serverless Architectures on AWS Lambda
 

Destacado

ServerlessPresentation
ServerlessPresentationServerlessPresentation
ServerlessPresentation
Rohit Kumar
 

Destacado (20)

Bringing Cloud Native Innovation to the Enterprise
Bringing Cloud Native Innovation to the EnterpriseBringing Cloud Native Innovation to the Enterprise
Bringing Cloud Native Innovation to the Enterprise
 
AWS re:Invent 2016: Monitoring, Hold the Infrastructure: Getting the Most fro...
AWS re:Invent 2016: Monitoring, Hold the Infrastructure: Getting the Most fro...AWS re:Invent 2016: Monitoring, Hold the Infrastructure: Getting the Most fro...
AWS re:Invent 2016: Monitoring, Hold the Infrastructure: Getting the Most fro...
 
What's new in openstack ocata
What's new in openstack ocata What's new in openstack ocata
What's new in openstack ocata
 
Serverless / FaaS / Lambda and how it relates to Microservices
Serverless / FaaS / Lambda and how it relates to MicroservicesServerless / FaaS / Lambda and how it relates to Microservices
Serverless / FaaS / Lambda and how it relates to Microservices
 
Open stack networking_101_update_2014-os-meetups
Open stack networking_101_update_2014-os-meetupsOpen stack networking_101_update_2014-os-meetups
Open stack networking_101_update_2014-os-meetups
 
Accelerating SDN Applications with Open Source Network Overlays
Accelerating SDN Applications with Open Source Network OverlaysAccelerating SDN Applications with Open Source Network Overlays
Accelerating SDN Applications with Open Source Network Overlays
 
Simplifying the OpenStack and Kubernetes network stack with Romana
Simplifying the OpenStack and Kubernetes network stack with RomanaSimplifying the OpenStack and Kubernetes network stack with Romana
Simplifying the OpenStack and Kubernetes network stack with Romana
 
Summit 16: Cengn Experience in Opnfv Projects
Summit 16: Cengn Experience in Opnfv ProjectsSummit 16: Cengn Experience in Opnfv Projects
Summit 16: Cengn Experience in Opnfv Projects
 
ServerlessPresentation
ServerlessPresentationServerlessPresentation
ServerlessPresentation
 
Monasca 를 이용한 cloud 모니터링 final
Monasca 를 이용한 cloud 모니터링 finalMonasca 를 이용한 cloud 모니터링 final
Monasca 를 이용한 cloud 모니터링 final
 
Openstack taskflow 簡介
Openstack taskflow 簡介Openstack taskflow 簡介
Openstack taskflow 簡介
 
Combining OpenWhisk (serverless), Open API (swagger) and API Connect to build...
Combining OpenWhisk (serverless), Open API (swagger) and API Connect to build...Combining OpenWhisk (serverless), Open API (swagger) and API Connect to build...
Combining OpenWhisk (serverless), Open API (swagger) and API Connect to build...
 
The Serverless Paradigm, OpenWhisk and FIWARE
The Serverless Paradigm, OpenWhisk and FIWAREThe Serverless Paradigm, OpenWhisk and FIWARE
The Serverless Paradigm, OpenWhisk and FIWARE
 
Task flow
Task flowTask flow
Task flow
 
OpenWhisk Under the Hood -- London Oct 16 2016
OpenWhisk Under the Hood -- London Oct 16 2016OpenWhisk Under the Hood -- London Oct 16 2016
OpenWhisk Under the Hood -- London Oct 16 2016
 
Running OpenStack in Production
Running OpenStack in Production Running OpenStack in Production
Running OpenStack in Production
 
Apache kafka big data track
Apache kafka   big data trackApache kafka   big data track
Apache kafka big data track
 
Serverless Realtime Backup
Serverless Realtime BackupServerless Realtime Backup
Serverless Realtime Backup
 
Contrail Deep-dive - Cloud Network Services at Scale
Contrail Deep-dive - Cloud Network Services at ScaleContrail Deep-dive - Cloud Network Services at Scale
Contrail Deep-dive - Cloud Network Services at Scale
 
Apricot2017 Request tracing in distributed environment
Apricot2017 Request tracing in distributed environmentApricot2017 Request tracing in distributed environment
Apricot2017 Request tracing in distributed environment
 

Similar a Open stack ocata summit enabling aws lambda-like functionality with openstack swift and openwhisk

China Science Challenge
China Science ChallengeChina Science Challenge
China Science Challenge
remko caprio
 

Similar a Open stack ocata summit enabling aws lambda-like functionality with openstack swift and openwhisk (20)

Going Serverless with OpenWhisk
Going Serverless with OpenWhiskGoing Serverless with OpenWhisk
Going Serverless with OpenWhisk
 
The 'Serverless' Paradigm, OpenWhisk and FIWARE
The 'Serverless' Paradigm, OpenWhisk and FIWAREThe 'Serverless' Paradigm, OpenWhisk and FIWARE
The 'Serverless' Paradigm, OpenWhisk and FIWARE
 
IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ...
IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ...IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ...
IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ...
 
Nasdanika Foundation Server
Nasdanika Foundation ServerNasdanika Foundation Server
Nasdanika Foundation Server
 
Apache OpenWhisk Serverless Computing
Apache OpenWhisk Serverless ComputingApache OpenWhisk Serverless Computing
Apache OpenWhisk Serverless Computing
 
OpenStack Identity - Keystone (kilo) by Lorenzo Carnevale and Silvio Tavilla
OpenStack Identity - Keystone (kilo) by Lorenzo Carnevale and Silvio TavillaOpenStack Identity - Keystone (kilo) by Lorenzo Carnevale and Silvio Tavilla
OpenStack Identity - Keystone (kilo) by Lorenzo Carnevale and Silvio Tavilla
 
Web Application Frameworks - Lecture 05 - Web Information Systems (4011474FNR)
Web Application Frameworks - Lecture 05 - Web Information Systems (4011474FNR)Web Application Frameworks - Lecture 05 - Web Information Systems (4011474FNR)
Web Application Frameworks - Lecture 05 - Web Information Systems (4011474FNR)
 
Research Paper
Research PaperResearch Paper
Research Paper
 
Serverless apps with OpenWhisk
Serverless apps with OpenWhiskServerless apps with OpenWhisk
Serverless apps with OpenWhisk
 
Serverless forwardjs
Serverless forwardjsServerless forwardjs
Serverless forwardjs
 
New and smart way to develop microservice for istio with micro profile
New and smart way to develop microservice for istio with micro profileNew and smart way to develop microservice for istio with micro profile
New and smart way to develop microservice for istio with micro profile
 
Openwhisk - Colorado Meetups
Openwhisk - Colorado MeetupsOpenwhisk - Colorado Meetups
Openwhisk - Colorado Meetups
 
How to build a Distributed Serverless Polyglot Microservices IoT Platform us...
How to build a Distributed Serverless Polyglot Microservices IoT Platform us...How to build a Distributed Serverless Polyglot Microservices IoT Platform us...
How to build a Distributed Serverless Polyglot Microservices IoT Platform us...
 
RESTful Web Applications with Apache Sling
RESTful Web Applications with Apache SlingRESTful Web Applications with Apache Sling
RESTful Web Applications with Apache Sling
 
Prototyping applications with heroku and elasticsearch
 Prototyping applications with heroku and elasticsearch Prototyping applications with heroku and elasticsearch
Prototyping applications with heroku and elasticsearch
 
OpenStack Identity - Keystone (liberty) by Lorenzo Carnevale and Silvio Tavilla
OpenStack Identity - Keystone (liberty) by Lorenzo Carnevale and Silvio TavillaOpenStack Identity - Keystone (liberty) by Lorenzo Carnevale and Silvio Tavilla
OpenStack Identity - Keystone (liberty) by Lorenzo Carnevale and Silvio Tavilla
 
OpenStack Swift
OpenStack SwiftOpenStack Swift
OpenStack Swift
 
OpenWhisk - Serverless Architecture
OpenWhisk - Serverless Architecture OpenWhisk - Serverless Architecture
OpenWhisk - Serverless Architecture
 
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
Build an AI/ML-driven image archive processing workflow: Image archive, analy...Build an AI/ML-driven image archive processing workflow: Image archive, analy...
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
 
China Science Challenge
China Science ChallengeChina Science Challenge
China Science Challenge
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 

Open stack ocata summit enabling aws lambda-like functionality with openstack swift and openwhisk

  • 1. Enabling AWS Lambda-like functionality with OpenStack Swift and OpenWhisk Shaun Murakami, Senior Cloud Architect, @stmuraka Andrew Bodine, Software Engineer, @bodine_andrew
  • 2. Development in the Cloud Bare metal Virtual machines Containers Functions Decreasing concern (and control) over stack implementation Increasingfocusonbusinesslogic
  • 3. Serverless can handle many cloud native 12 Factors app I Codebase Handled by developer (Manage versioning of functions on their own) II Dependencies Handled by developer, facilitated by serverless platform (Runtimes and packages) III Config Handled by platform (Environment variables or injected event parameters) IV Backing services Handled by platform (Connection information injected as event parameters) V Build, release, run Handled by platform (Deployed resources are immutable and internally versioned) VI Processes Handled by platform (Single stateless containers often used) VII Port binding Handled by platform (Actions or functions are automatically discovered) VIII Concurrency Handled by platform (Process model is hidden and scales in response to demand) IX Disposability Handled by platform (Lifecycle is hidden from the user, fast startup and elastic scale is prioritized) X Dev/prod parity Handled by developer (The developer is the deployer. Scope of what differs is narrower) XI Logs Handled by platform (Developer writes to console.log, platform handles log streaming) XII Admin processes Handled by developer (No distinction between one off processes and long running)
  • 4. Event driven programming Execute app logic in response to database triggers Execute app logic in response to sensor data Execute app logic in response to cognitive trends Execute app logic in response to scheduled tasks Provide easy server-side backend for mobile app
  • 5. Amazon Lambda • An event-driven compute service where AWS Lambda runs your code in response to events, such as changes to data or in response to HTTP requests. http://docs.aws.amazon.com/lambda/latest/dg/welcome.html http://docs.aws.amazon.com/lambda/latest/dg/lambda-introduction.html
  • 6. OpenWhisk An open source cloud platform that executes code in response to events https://github.com/openwhisk/openwhisk
  • 7. OpenWhisk supports many growing workloads OpenWhisk can help power various mobile, web and IoT app use cases by simplifying the programming model of orchestrating various services using events without a dedicated backend. Digital app workloads Big Data/Analytics pipeline Complex data pipelines for Big Data/Analytics tasks can be scripted using changes in data services or streams for near real-time analytics and feedback. DevOps and infrastructure as code OpenWhisk can be used to automate DevOps pipelines based on events triggered from successful builds, or completed staging, or a go-live event. Microservices builder OpenWhisk can be used to easily build microservices given the footprint and programming model desired by microservices
  • 8. OpenWhisk Programming model Developers use Rules to… associate how Actions handle events emitted by Triggers generated by services R T A:=
  • 9. riggers A class of events that can occur T Social events Data changes Device readings Location updates User input
  • 10. ctions Code that runs in response to an event (i.e., an event handler) A Supports a variety of languages such as JavaScript, Python, Java, and Swift ... function main(params) { return { message: 'Hello, ' + params.name + ' from ' + params.place }; }; ... even as a Docker container Actions can be chained together AA := A1 + A2 + A3 AB := A2 + A1 + A3 AC := A3 + A1 + A2
  • 11. OpenWhisk can implement RESTful microservices Send HTTP request HTTP GET app.com/customers 1 Invoke OpenWhisk action get-customers Browser Mobile App Web App 2 JS Swift Docker … OpenWhisk API Proxy
  • 12. OpenStack Swift Middleware • Swift uses middleware to add custom behaviors. • The majority of Swift middleware is applied to the Proxy Server. • Python WSGI Middleware (or just “middleware”) can be used to “wrap” the request and response of a Python WSGI application (i.e. a webapp, or REST/HTTP API), like Swift’s WSGI servers (proxy-server, account-server, container-server, object-server) http://docs.openstack.org/developer/swift/development_middleware.html http://docs.openstack.org/admin-guide/objectstorage-arch.html
  • 13. OpenStack Swift System Metadata • Provides a means to store potentially private custom metadata with associated Swift resources in a safe and secure fashion. • May be set on accounts and containers by including headers with a PUT or POST request. • Maybe set on objects using only PUT requests. • Takes the form of X-<type>-Sysmeta-<key>: <value> • <type> depends on the resources type (i.e. Account, Container, Object) • <key> and <value> are set by trusted code running in a Swift WSGI Server http://docs.openstack.org/developer/swift/development_middleware.html#sysmeta
  • 15. AWS S3 + Lambda 1. A user uploads an object to the source bucket in Amazon S3 (object-created event). 2. Amazon S3 detects the object-created event. 3. Amazon S3 publishes the s3:ObjectCreated:* event to AWS Lambda by invoking the Lambda function and passing event data as a function parameter. 4. AWS Lambda executes the Lambda function by assuming the execution role that you specified at the time you created the Lambda function. 5. From the event data it receives, the Lambda function knows the source bucket name and object key name. The Lambda function reads the object and creates a thumbnail using graphics libraries, and saves it to the target bucket http://docs.aws.amazon.com/lambda/latest/dg/with-s3-example.html
  • 16. OpenStack Swift + OpenWhisk JS Swift Docker … OpenWhisk APIProxy 1. A user uploads an object to a OpenStack Swift Container. 2. OpenStack Swift detects an object has been modified in the Container. 3. The Swift Webhook middleware triggers an OpenWhisk Action by invoking the OpenWhisk API specified as the container’s webhook URL. 4. The OpenWhisk credentials are validated against the OpenWhisk authorization service. 5. From the request payload, the OpenWhisk action knows the source container and object name. The OpenWhisk Action creates a thumbnail using graphics libraries and saves it to a target container Swift Middleware Source Container Target Container 2 3 4 Whisk Action 1 5
  • 17. Let’s take a look at how it’s implemented • OpenStack Swift Middleware Code • OpenWhisk Action Code
  • 18. OpenStack Swift Middleware (webhook.py) class WebhookMiddleware(object): @wsgify def __call__(self, req): req.headers[SYSMETA_WEBHOOK] = req.headers['x-webhook'] req.headers[SYSMETA_WEBHOOK_AUTH] = req.headers['x-webhook-auth'] resp = req.get_response(self.app) if obj and is_success(resp.status_int) and req.method in [’PUT’,’DELETE’]: webhook_req = urllib2.Request(container_info['sysmeta'].get('webhook')) webhook_req.add_header('Authorization', base64.b64encode(container_info['sysmeta'].get('webhook-auth'))) webhook_req.add_data(json.dumps({ ’url’: swiftUrl, ‘token’: req.headers[‘x-auth-token’], ‘container’: container, ‘object’: obj, ‘method’: req.method })) ... try: webhook_resp = urllib2.urlopen(webhook_req).read() …. return resp
  • 19. Install Webhook Middleware 1. Place webhook.py in middleware of swift-proxy …/swift/common/middleware/webhook.py 2. Update proxy-server.conf … [pipeline:main] pipeline = catch_errors gatekeeper healthcheck ... webhook proxy-server [filter:webhook] paste.filter_factory = swift.common.middleware.webhook:webhook_factory ...
  • 20. OpenWhisk Action Dockerfile FROM ubuntu:14.04 ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && apt-get install -y curl # Node.js RUN curl -sL https://deb.nodesource.com/setup_4.x | bash - && apt-get install -y nodejs WORKDIR /root/server COPY server . RUN npm install EXPOSE 8080 CMD node ./app.js
  • 22. Demo Putting it all together…
  • 23. Future work Swift Asynchronous Event Notification Framework • Support Multiple Notification Use Cases • OpenWhisk / Serverless computing • Cloud inter-service notifications • Metadata search indexing • Resource / traffic monitoring • Common Notification APIs • Enable / disable notifications on an account or container • Allow for user / system level policies • Desire to become a de-facto standard in Swift for notification management • Deployment Flexibility • Can be adapted to multiple message queue technologies • Initial submission will include Kafka and Zaqar • Patch WIP • https://review.openstack.org/388393
  • 24. Resources • AWS Lambda • Example: http://docs.aws.amazon.com/lambda/latest/dg/with-s3-example.html • OpenWhisk • Code: https://github.com/openwhisk/openwhisk • On IBM BlueMix: http://www.ibm.com/cloud-computing/bluemix/openwhisk/ • OpenStack Swift Middleware • http://docs.openstack.org/developer/swift/development_middleware.htm • Demo Code • https://github.ibm.com/stmuraka/OpenStackSwift-OpenWhisk