SlideShare ist ein Scribd-Unternehmen logo
1 von 26
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
Hammock
A Good Place to REST
June, 2016
Eyal Posener eyal@stratoscale.com
Software Engineer / Stratoscale
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
Agenda
❏ Nice to meet you - I’m Eyal
❏ Software developer at Stratoscale (~2 years)
❏ Why am I presenting Hammock?
❏ Stratoscale has moved to microservices in containers:
❏ Currently 8 internally developed REST services.
❏ Internal & external communication.
❏ Coverage:
1. Creating a simple REST application with Python.
2. What was missing for Stratoscale.
3. Hammock
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
Introducing WSGI - (Web Server Gateway Interface)Web Server
Gateway Interfa
PEP 3333 / PEP 333 Web Server Gateway Interface.
❏ Defines a simple API between the server/gateway and
framework(/application).
Server/
Gateway
Framework
WSGI
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
Many Many WSGI Players
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
Application
An application is developed with a specific framework.
Server/
Gateway
Framework
WSGI
Application
Framework
API
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
Let’s build a REST Server in Falcon
❏ REpresentational State Transfer
❏ A convention for communication:
Path pattern
HTTP
method
Action
Status
(usually)
Response
(usually)
Request Args
Location
.../<item>s POST Create new item 201/202 Dict Body
.../<item>s GET List all Items 200 List of dicts Query
.../<item>s/<item>_id GET Get <item> 200 Dict Query
.../<item>s/<item>_id PATCH/PUT Update <item> 202 Dict Body
.../<item>s/<item>_id DELETE Delete <item> 204 Nothing Query
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
class Files(object):
def on_post(self, req, resp): # create
pass
def on_get(self, req, resp): # list
pass
class File(object):
def on_get(self, req, resp, file_id): # get one
pass
def on_delete(self, req, resp, file_id): # delete
pass
def on_patch(self, req, resp, file_id): # update
pass
app = falcon.API()
app.add_route('/files', Files())
app.add_route('/files/{file_id}', File())
Falcon Application Example
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
import files # Business logic is here
class Files(object):
def on_get(self, req, resp):
"""List files"""
# First, extract request arguments
path = req.get_param('path', required=True)
sort = req.get_param('sort', default='modified')
reverse = req.get_param('reverse', default=False)
# Convert arguments if a specific type is required
reverse = reverse == 'True'
# Here we actually do stuff
try:
result = [f.to_dict for f in files.list(path, sort, reverse)]
except OSError:
raise falcon.HTTPNotFound('No path {}'.format(path))
# When all ready, prepare the response
result_string = json.dumps(result)
resp.status = falcon.HTTP_200
resp.body = result_string
resp.content_type = 'application/json'
Falcon Application Example (cont.)
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
WSGI Deficiencies
To do the same work: Different framework == different application
Once you choose a framework, you are locked in!
Server/
Gateway
Application2
Application1
Application3
WSGI
API 1
API 2
API 3
Application4
API 4
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
REST Frameworks: Same Same but Different
Same same But Different
Methods that do
something with request
and response objects.
● Some accept request and response objects.
● Some accept requests and return responses.
● Some magically have the request.
● Some accept URL arguments.
● Some convert return value to a response.
● Some can read/write from the resource class methods.
Register of Python
methods/classes on URLs.
● Some use resource classes.
● Some use resource methods.
● Some use both.
● For some the class is only for a specific URL, for some it is for a
resource.
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
REST Frameworks: Same Same but Different (cont)
Same same But Different
Error handling ● Some catch a specific exception types.
● Some need a response object returned.
Their own
Request/Response object
They were made for web
serving
With REST extensions.
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
Hammock
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
Hammock
1. Abstraction
2. Built for REST & developer friendly
3. Many cool features
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
1. Hammock Abstraction
ApplicationHammock
Server/
Gateway
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
Hammock Abstraction
Server/
Gateway
Well… to be honest....
ApplicationHammock
WIP
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
2. Ease of Use: Handlers
class Files(hammock.Resource):
@hammock.get('/')
def list(self, path, sort='modified', reverse=False, type=None):
"""
List files in directory.
:param str path: Path to list files in.
:param str type: Show only files of type.
:param str sort: Sort files by attribute
:param bool[False] reverse: Sort reverse.
:return list: List of files.
"""
try:
return [f.to_dict for f in files.list(path, sort, reverse)]
except OSError:
raise exceptions.NotFound('No path {}'.format(path))
@hammock.get('/{file_id}')
def get(self, file_id)
...
Don't worry about
converting requests to
arguments.
Don't worry about
converting results to
responses.
Simply write
Python
functions
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
2. Ease of Use: Some Corner Cases
Hammock has some reserved arguments.
# streams
@hammock.post()
def func(self, _file): # get octet/stream
return open(‘path’, ‘r’) # return octet/stream
# headers
@hammock.post()
def func(self, _headers): # get headers
return {‘_headers’: {‘key1’: ‘value1’}} # return headers
# when request body is a list
@hammock.post()
def func(self, _list): # get a list body
return [] # return list
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
2. Ease of Use: Resource Registering
Use a package structure to build URLs:
resources/
hotels/
hotels.py /hotels
rooms/
rooms.py /hotels/{hotel_id}/rooms
reservations.py /hotels/{hotel_id}/rooms/{room_id}/reservations
customers.py /customers
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
3. Many COOL Features
Hammock
Free Python
client!
Free CLIAuthorization
enforcement
Free API
documentation
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
How does it work?? At Server Startup:
app = hammock.Hammock(‘falcon’, resources)
❏ Iterate over a 'resources' package,
collect all decorated route methods
into a dict:
{path: {method: function}}
❏ Register handlers using a backend API.
❏ The handler is a translator between backend
handler to the function.
class Files(object):
def on_post(self, req, resp):
...
class File(object):
def on_get(self, req, resp, file_id):
...
app.add_route('/files', Files())
app.add_route('/files/{file_id}', File())
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
How does it work?? Upon request:
Backend
Request
Backend
Response
Hammock
Request
Hammock
Response
Method
Arguments
Method
Result
Backend
Framework
Decorated
Method
There is a lot of magic there...
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
Future work
❏ More frameworks! (maybe you wanna help?)
❏ Scheme validation.
❏ Combine with swagger/RAML.
❏ Improve unit testing infra.
❏ And much more :-)
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
Questions?
❏ Contact:
eyal@stratoscale.com
❏ Install:
pip install hammock-rest
>>> import hammock
❏ Contribute:
git clone https://github.com/Stratoscale/hammock.git
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
Performance
Property Falcon Hammock Ratio Remarks
Document Length [bytes] 638 601 1.06 ujson :-)
Time taken for tests [seconds] 36.3 38 0.96
Requests per second [#/sec] (mean) 1378.5 1314.6 1.05
Time per request [ms] (mean) 0.725 0.761 0.95
Transfer rate [Kbytes/sec] received 955.8 864 1.11
Small benchmark with Apache bench for 50,000 GET requests that returns the
same file list method.
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
WSGI
def app(environ, start_response):
start_response('200 OK', [('Content-type', 'text/plain')])
return ['Hello world!n']
® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244
Appendix
List of WSGI compliant servers.
List of WSGI compliant frameworks.

Weitere ähnliche Inhalte

Was ist angesagt?

OpenStack Tutorial For Beginners | OpenStack Tutorial | OpenStack Training | ...
OpenStack Tutorial For Beginners | OpenStack Tutorial | OpenStack Training | ...OpenStack Tutorial For Beginners | OpenStack Tutorial | OpenStack Training | ...
OpenStack Tutorial For Beginners | OpenStack Tutorial | OpenStack Training | ...Edureka!
 
Cooking with OpenStack Heat
Cooking with OpenStack HeatCooking with OpenStack Heat
Cooking with OpenStack HeatEric Williams
 
Red Hat Enteprise Linux Open Stack Platfrom Director
Red Hat Enteprise Linux Open Stack Platfrom DirectorRed Hat Enteprise Linux Open Stack Platfrom Director
Red Hat Enteprise Linux Open Stack Platfrom DirectorOrgad Kimchi
 
Eric Williams (Rackspace) - Using Heat on OpenStack
Eric Williams (Rackspace) - Using Heat on OpenStackEric Williams (Rackspace) - Using Heat on OpenStack
Eric Williams (Rackspace) - Using Heat on OpenStackOutlyer
 
OpenStack Orchestration (Heat)
OpenStack Orchestration (Heat)OpenStack Orchestration (Heat)
OpenStack Orchestration (Heat)Jimi Chen
 
Understanding AWS with Terraform
Understanding AWS with TerraformUnderstanding AWS with Terraform
Understanding AWS with TerraformKnoldus Inc.
 
Best Practice for Deploying Application with Heat
Best Practice for Deploying Application with HeatBest Practice for Deploying Application with Heat
Best Practice for Deploying Application with HeatEthan Lynn
 
Terraform: An Overview & Introduction
Terraform: An Overview & IntroductionTerraform: An Overview & Introduction
Terraform: An Overview & IntroductionLee Trout
 
Spark day 2017 - Spark on Kubernetes
Spark day 2017 - Spark on KubernetesSpark day 2017 - Spark on Kubernetes
Spark day 2017 - Spark on KubernetesYousun Jeong
 
Adam Dagnall: Advanced S3 compatible storage integration in CloudStack
Adam Dagnall: Advanced S3 compatible storage integration in CloudStackAdam Dagnall: Advanced S3 compatible storage integration in CloudStack
Adam Dagnall: Advanced S3 compatible storage integration in CloudStackShapeBlue
 
Introduction openstack horizon
Introduction openstack horizonIntroduction openstack horizon
Introduction openstack horizonJim Yeh
 
Red Hat OpenStack - Open Cloud Infrastructure
Red Hat OpenStack - Open Cloud InfrastructureRed Hat OpenStack - Open Cloud Infrastructure
Red Hat OpenStack - Open Cloud InfrastructureAlex Baretto
 
Best Practices of Infrastructure as Code with Terraform
Best Practices of Infrastructure as Code with TerraformBest Practices of Infrastructure as Code with Terraform
Best Practices of Infrastructure as Code with TerraformDevOps.com
 
OpenStack Heat slides
OpenStack Heat slidesOpenStack Heat slides
OpenStack Heat slidesdbelova
 
Case Study: Using Terraform and Packer to deploy go applications to AWS
Case Study: Using Terraform and Packer to deploy go applications to AWSCase Study: Using Terraform and Packer to deploy go applications to AWS
Case Study: Using Terraform and Packer to deploy go applications to AWSPatrick Bolduan
 
Oracle on kubernetes 101 - Dec/2021
Oracle on kubernetes 101 - Dec/2021Oracle on kubernetes 101 - Dec/2021
Oracle on kubernetes 101 - Dec/2021Nelson Calero
 
DevEx | there’s no place like k3s
DevEx | there’s no place like k3sDevEx | there’s no place like k3s
DevEx | there’s no place like k3sHaggai Philip Zagury
 
On CloudStack, Docker, Kubernetes, and Big Data…Oh my ! By Sebastien Goasguen...
On CloudStack, Docker, Kubernetes, and Big Data…Oh my ! By Sebastien Goasguen...On CloudStack, Docker, Kubernetes, and Big Data…Oh my ! By Sebastien Goasguen...
On CloudStack, Docker, Kubernetes, and Big Data…Oh my ! By Sebastien Goasguen...Radhika Puthiyetath
 
Apache Stratos Incubator - hangout 2
Apache Stratos Incubator - hangout   2Apache Stratos Incubator - hangout   2
Apache Stratos Incubator - hangout 2Nirmal Fernando
 

Was ist angesagt? (20)

OpenStack Tutorial For Beginners | OpenStack Tutorial | OpenStack Training | ...
OpenStack Tutorial For Beginners | OpenStack Tutorial | OpenStack Training | ...OpenStack Tutorial For Beginners | OpenStack Tutorial | OpenStack Training | ...
OpenStack Tutorial For Beginners | OpenStack Tutorial | OpenStack Training | ...
 
Cooking with OpenStack Heat
Cooking with OpenStack HeatCooking with OpenStack Heat
Cooking with OpenStack Heat
 
Red Hat Enteprise Linux Open Stack Platfrom Director
Red Hat Enteprise Linux Open Stack Platfrom DirectorRed Hat Enteprise Linux Open Stack Platfrom Director
Red Hat Enteprise Linux Open Stack Platfrom Director
 
Eric Williams (Rackspace) - Using Heat on OpenStack
Eric Williams (Rackspace) - Using Heat on OpenStackEric Williams (Rackspace) - Using Heat on OpenStack
Eric Williams (Rackspace) - Using Heat on OpenStack
 
OpenStack Orchestration (Heat)
OpenStack Orchestration (Heat)OpenStack Orchestration (Heat)
OpenStack Orchestration (Heat)
 
Understanding AWS with Terraform
Understanding AWS with TerraformUnderstanding AWS with Terraform
Understanding AWS with Terraform
 
Best Practice for Deploying Application with Heat
Best Practice for Deploying Application with HeatBest Practice for Deploying Application with Heat
Best Practice for Deploying Application with Heat
 
Terraform: An Overview & Introduction
Terraform: An Overview & IntroductionTerraform: An Overview & Introduction
Terraform: An Overview & Introduction
 
Spark day 2017 - Spark on Kubernetes
Spark day 2017 - Spark on KubernetesSpark day 2017 - Spark on Kubernetes
Spark day 2017 - Spark on Kubernetes
 
Adam Dagnall: Advanced S3 compatible storage integration in CloudStack
Adam Dagnall: Advanced S3 compatible storage integration in CloudStackAdam Dagnall: Advanced S3 compatible storage integration in CloudStack
Adam Dagnall: Advanced S3 compatible storage integration in CloudStack
 
Introduction openstack horizon
Introduction openstack horizonIntroduction openstack horizon
Introduction openstack horizon
 
Red Hat OpenStack - Open Cloud Infrastructure
Red Hat OpenStack - Open Cloud InfrastructureRed Hat OpenStack - Open Cloud Infrastructure
Red Hat OpenStack - Open Cloud Infrastructure
 
Best Practices of Infrastructure as Code with Terraform
Best Practices of Infrastructure as Code with TerraformBest Practices of Infrastructure as Code with Terraform
Best Practices of Infrastructure as Code with Terraform
 
OpenStack Heat slides
OpenStack Heat slidesOpenStack Heat slides
OpenStack Heat slides
 
Terraform
TerraformTerraform
Terraform
 
Case Study: Using Terraform and Packer to deploy go applications to AWS
Case Study: Using Terraform and Packer to deploy go applications to AWSCase Study: Using Terraform and Packer to deploy go applications to AWS
Case Study: Using Terraform and Packer to deploy go applications to AWS
 
Oracle on kubernetes 101 - Dec/2021
Oracle on kubernetes 101 - Dec/2021Oracle on kubernetes 101 - Dec/2021
Oracle on kubernetes 101 - Dec/2021
 
DevEx | there’s no place like k3s
DevEx | there’s no place like k3sDevEx | there’s no place like k3s
DevEx | there’s no place like k3s
 
On CloudStack, Docker, Kubernetes, and Big Data…Oh my ! By Sebastien Goasguen...
On CloudStack, Docker, Kubernetes, and Big Data…Oh my ! By Sebastien Goasguen...On CloudStack, Docker, Kubernetes, and Big Data…Oh my ! By Sebastien Goasguen...
On CloudStack, Docker, Kubernetes, and Big Data…Oh my ! By Sebastien Goasguen...
 
Apache Stratos Incubator - hangout 2
Apache Stratos Incubator - hangout   2Apache Stratos Incubator - hangout   2
Apache Stratos Incubator - hangout 2
 

Andere mochten auch

Muli Ben-Yehuda, Stratoscale - The Road to a Hyper-Converged OpenStack, OpenS...
Muli Ben-Yehuda, Stratoscale - The Road to a Hyper-Converged OpenStack, OpenS...Muli Ben-Yehuda, Stratoscale - The Road to a Hyper-Converged OpenStack, OpenS...
Muli Ben-Yehuda, Stratoscale - The Road to a Hyper-Converged OpenStack, OpenS...Cloud Native Day Tel Aviv
 
Developing the Stratoscale System at Scale - Muli Ben-Yehuda, Stratoscale - D...
Developing the Stratoscale System at Scale - Muli Ben-Yehuda, Stratoscale - D...Developing the Stratoscale System at Scale - Muli Ben-Yehuda, Stratoscale - D...
Developing the Stratoscale System at Scale - Muli Ben-Yehuda, Stratoscale - D...DevOpsDays Tel Aviv
 
Avishay Traeger & Shimshon Zimmerman, Stratoscale - Deploying OpenStack Cinde...
Avishay Traeger & Shimshon Zimmerman, Stratoscale - Deploying OpenStack Cinde...Avishay Traeger & Shimshon Zimmerman, Stratoscale - Deploying OpenStack Cinde...
Avishay Traeger & Shimshon Zimmerman, Stratoscale - Deploying OpenStack Cinde...Cloud Native Day Tel Aviv
 
Architectural Patterns for Scaling Microservices and APIs - GlueCon 2015
Architectural Patterns for Scaling Microservices and APIs - GlueCon 2015Architectural Patterns for Scaling Microservices and APIs - GlueCon 2015
Architectural Patterns for Scaling Microservices and APIs - GlueCon 2015Lori MacVittie
 
Approaching hyperconvergedopenstack
Approaching hyperconvergedopenstackApproaching hyperconvergedopenstack
Approaching hyperconvergedopenstackIkuo Kumagai
 
Stateless authentication for microservices
Stateless authentication for microservicesStateless authentication for microservices
Stateless authentication for microservicesAlvaro Sanchez-Mariscal
 
From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.Taras Matyashovsky
 
Open API and API Management - Introduction and Comparison of Products: TIBCO ...
Open API and API Management - Introduction and Comparison of Products: TIBCO ...Open API and API Management - Introduction and Comparison of Products: TIBCO ...
Open API and API Management - Introduction and Comparison of Products: TIBCO ...Kai Wähner
 
The Role of Enterprise Integration in Digital Transformation
The Role of Enterprise Integration in Digital TransformationThe Role of Enterprise Integration in Digital Transformation
The Role of Enterprise Integration in Digital TransformationKasun Indrasiri
 

Andere mochten auch (10)

Muli Ben-Yehuda, Stratoscale - The Road to a Hyper-Converged OpenStack, OpenS...
Muli Ben-Yehuda, Stratoscale - The Road to a Hyper-Converged OpenStack, OpenS...Muli Ben-Yehuda, Stratoscale - The Road to a Hyper-Converged OpenStack, OpenS...
Muli Ben-Yehuda, Stratoscale - The Road to a Hyper-Converged OpenStack, OpenS...
 
Stratosphere hotel presentation
Stratosphere hotel presentationStratosphere hotel presentation
Stratosphere hotel presentation
 
Developing the Stratoscale System at Scale - Muli Ben-Yehuda, Stratoscale - D...
Developing the Stratoscale System at Scale - Muli Ben-Yehuda, Stratoscale - D...Developing the Stratoscale System at Scale - Muli Ben-Yehuda, Stratoscale - D...
Developing the Stratoscale System at Scale - Muli Ben-Yehuda, Stratoscale - D...
 
Avishay Traeger & Shimshon Zimmerman, Stratoscale - Deploying OpenStack Cinde...
Avishay Traeger & Shimshon Zimmerman, Stratoscale - Deploying OpenStack Cinde...Avishay Traeger & Shimshon Zimmerman, Stratoscale - Deploying OpenStack Cinde...
Avishay Traeger & Shimshon Zimmerman, Stratoscale - Deploying OpenStack Cinde...
 
Architectural Patterns for Scaling Microservices and APIs - GlueCon 2015
Architectural Patterns for Scaling Microservices and APIs - GlueCon 2015Architectural Patterns for Scaling Microservices and APIs - GlueCon 2015
Architectural Patterns for Scaling Microservices and APIs - GlueCon 2015
 
Approaching hyperconvergedopenstack
Approaching hyperconvergedopenstackApproaching hyperconvergedopenstack
Approaching hyperconvergedopenstack
 
Stateless authentication for microservices
Stateless authentication for microservicesStateless authentication for microservices
Stateless authentication for microservices
 
From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.
 
Open API and API Management - Introduction and Comparison of Products: TIBCO ...
Open API and API Management - Introduction and Comparison of Products: TIBCO ...Open API and API Management - Introduction and Comparison of Products: TIBCO ...
Open API and API Management - Introduction and Comparison of Products: TIBCO ...
 
The Role of Enterprise Integration in Digital Transformation
The Role of Enterprise Integration in Digital TransformationThe Role of Enterprise Integration in Digital Transformation
The Role of Enterprise Integration in Digital Transformation
 

Ähnlich wie Hammock, a Good Place to Rest

Using and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middlewareUsing and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middlewareAlona Mekhovova
 
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングXitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングscalaconfjp
 
Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014Ngoc Dao
 
Into The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerInto The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerOrtus Solutions, Corp
 
Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Ortus Solutions, Corp
 
Terrastore - A document database for developers
Terrastore - A document database for developersTerrastore - A document database for developers
Terrastore - A document database for developersSergio Bossa
 
From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...
From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...
From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...Databricks
 
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiGrâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiJérémy Derussé
 
REST made simple with Java
REST made simple with JavaREST made simple with Java
REST made simple with Javaelliando dias
 
Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaPlay Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaYevgeniy Brikman
 
Presentation on Japanese doc sprint
Presentation on Japanese doc sprintPresentation on Japanese doc sprint
Presentation on Japanese doc sprintGo Chiba
 
Just one-shade-of-openstack
Just one-shade-of-openstackJust one-shade-of-openstack
Just one-shade-of-openstackRoberto Polli
 
Taking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the ExtremeTaking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the Extremeyinonavraham
 
Scale Your Data Tier With Windows Server App Fabric
Scale Your Data Tier With Windows Server App FabricScale Your Data Tier With Windows Server App Fabric
Scale Your Data Tier With Windows Server App FabricChris Dufour
 
Nginx: Accelerate Rails, HTTP Tricks
Nginx: Accelerate Rails, HTTP TricksNginx: Accelerate Rails, HTTP Tricks
Nginx: Accelerate Rails, HTTP TricksAdam Wiggins
 

Ähnlich wie Hammock, a Good Place to Rest (20)

Intro to Rack
Intro to RackIntro to Rack
Intro to Rack
 
Arquitecturas de microservicios - Medianet Software
Arquitecturas de microservicios   -  Medianet SoftwareArquitecturas de microservicios   -  Medianet Software
Arquitecturas de microservicios - Medianet Software
 
Frontend Servers and NGINX: What, Where and How
Frontend Servers and NGINX: What, Where and HowFrontend Servers and NGINX: What, Where and How
Frontend Servers and NGINX: What, Where and How
 
Rack
RackRack
Rack
 
Using and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middlewareUsing and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middleware
 
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングXitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
 
Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014
 
Into The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerInto The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and docker
 
Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018
 
Terrastore - A document database for developers
Terrastore - A document database for developersTerrastore - A document database for developers
Terrastore - A document database for developers
 
From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...
From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...
From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...
 
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiGrâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
 
REST made simple with Java
REST made simple with JavaREST made simple with Java
REST made simple with Java
 
Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaPlay Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and Scala
 
Presentation on Japanese doc sprint
Presentation on Japanese doc sprintPresentation on Japanese doc sprint
Presentation on Japanese doc sprint
 
Just one-shade-of-openstack
Just one-shade-of-openstackJust one-shade-of-openstack
Just one-shade-of-openstack
 
REST made simple with Java
REST made simple with JavaREST made simple with Java
REST made simple with Java
 
Taking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the ExtremeTaking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the Extreme
 
Scale Your Data Tier With Windows Server App Fabric
Scale Your Data Tier With Windows Server App FabricScale Your Data Tier With Windows Server App Fabric
Scale Your Data Tier With Windows Server App Fabric
 
Nginx: Accelerate Rails, HTTP Tricks
Nginx: Accelerate Rails, HTTP TricksNginx: Accelerate Rails, HTTP Tricks
Nginx: Accelerate Rails, HTTP Tricks
 

Kürzlich hochgeladen

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 

Kürzlich hochgeladen (20)

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 

Hammock, a Good Place to Rest

  • 1. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 Hammock A Good Place to REST June, 2016 Eyal Posener eyal@stratoscale.com Software Engineer / Stratoscale
  • 2. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 Agenda ❏ Nice to meet you - I’m Eyal ❏ Software developer at Stratoscale (~2 years) ❏ Why am I presenting Hammock? ❏ Stratoscale has moved to microservices in containers: ❏ Currently 8 internally developed REST services. ❏ Internal & external communication. ❏ Coverage: 1. Creating a simple REST application with Python. 2. What was missing for Stratoscale. 3. Hammock
  • 3. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 Introducing WSGI - (Web Server Gateway Interface)Web Server Gateway Interfa PEP 3333 / PEP 333 Web Server Gateway Interface. ❏ Defines a simple API between the server/gateway and framework(/application). Server/ Gateway Framework WSGI
  • 4. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 Many Many WSGI Players
  • 5. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 Application An application is developed with a specific framework. Server/ Gateway Framework WSGI Application Framework API
  • 6. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 Let’s build a REST Server in Falcon ❏ REpresentational State Transfer ❏ A convention for communication: Path pattern HTTP method Action Status (usually) Response (usually) Request Args Location .../<item>s POST Create new item 201/202 Dict Body .../<item>s GET List all Items 200 List of dicts Query .../<item>s/<item>_id GET Get <item> 200 Dict Query .../<item>s/<item>_id PATCH/PUT Update <item> 202 Dict Body .../<item>s/<item>_id DELETE Delete <item> 204 Nothing Query
  • 7. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 class Files(object): def on_post(self, req, resp): # create pass def on_get(self, req, resp): # list pass class File(object): def on_get(self, req, resp, file_id): # get one pass def on_delete(self, req, resp, file_id): # delete pass def on_patch(self, req, resp, file_id): # update pass app = falcon.API() app.add_route('/files', Files()) app.add_route('/files/{file_id}', File()) Falcon Application Example
  • 8. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 import files # Business logic is here class Files(object): def on_get(self, req, resp): """List files""" # First, extract request arguments path = req.get_param('path', required=True) sort = req.get_param('sort', default='modified') reverse = req.get_param('reverse', default=False) # Convert arguments if a specific type is required reverse = reverse == 'True' # Here we actually do stuff try: result = [f.to_dict for f in files.list(path, sort, reverse)] except OSError: raise falcon.HTTPNotFound('No path {}'.format(path)) # When all ready, prepare the response result_string = json.dumps(result) resp.status = falcon.HTTP_200 resp.body = result_string resp.content_type = 'application/json' Falcon Application Example (cont.)
  • 9. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 WSGI Deficiencies To do the same work: Different framework == different application Once you choose a framework, you are locked in! Server/ Gateway Application2 Application1 Application3 WSGI API 1 API 2 API 3 Application4 API 4
  • 10. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 REST Frameworks: Same Same but Different Same same But Different Methods that do something with request and response objects. ● Some accept request and response objects. ● Some accept requests and return responses. ● Some magically have the request. ● Some accept URL arguments. ● Some convert return value to a response. ● Some can read/write from the resource class methods. Register of Python methods/classes on URLs. ● Some use resource classes. ● Some use resource methods. ● Some use both. ● For some the class is only for a specific URL, for some it is for a resource.
  • 11. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 REST Frameworks: Same Same but Different (cont) Same same But Different Error handling ● Some catch a specific exception types. ● Some need a response object returned. Their own Request/Response object They were made for web serving With REST extensions.
  • 12. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 Hammock
  • 13. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 Hammock 1. Abstraction 2. Built for REST & developer friendly 3. Many cool features
  • 14. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 1. Hammock Abstraction ApplicationHammock Server/ Gateway
  • 15. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 Hammock Abstraction Server/ Gateway Well… to be honest.... ApplicationHammock WIP
  • 16. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 2. Ease of Use: Handlers class Files(hammock.Resource): @hammock.get('/') def list(self, path, sort='modified', reverse=False, type=None): """ List files in directory. :param str path: Path to list files in. :param str type: Show only files of type. :param str sort: Sort files by attribute :param bool[False] reverse: Sort reverse. :return list: List of files. """ try: return [f.to_dict for f in files.list(path, sort, reverse)] except OSError: raise exceptions.NotFound('No path {}'.format(path)) @hammock.get('/{file_id}') def get(self, file_id) ... Don't worry about converting requests to arguments. Don't worry about converting results to responses. Simply write Python functions
  • 17. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 2. Ease of Use: Some Corner Cases Hammock has some reserved arguments. # streams @hammock.post() def func(self, _file): # get octet/stream return open(‘path’, ‘r’) # return octet/stream # headers @hammock.post() def func(self, _headers): # get headers return {‘_headers’: {‘key1’: ‘value1’}} # return headers # when request body is a list @hammock.post() def func(self, _list): # get a list body return [] # return list
  • 18. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 2. Ease of Use: Resource Registering Use a package structure to build URLs: resources/ hotels/ hotels.py /hotels rooms/ rooms.py /hotels/{hotel_id}/rooms reservations.py /hotels/{hotel_id}/rooms/{room_id}/reservations customers.py /customers
  • 19. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 3. Many COOL Features Hammock Free Python client! Free CLIAuthorization enforcement Free API documentation
  • 20. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 How does it work?? At Server Startup: app = hammock.Hammock(‘falcon’, resources) ❏ Iterate over a 'resources' package, collect all decorated route methods into a dict: {path: {method: function}} ❏ Register handlers using a backend API. ❏ The handler is a translator between backend handler to the function. class Files(object): def on_post(self, req, resp): ... class File(object): def on_get(self, req, resp, file_id): ... app.add_route('/files', Files()) app.add_route('/files/{file_id}', File())
  • 21. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 How does it work?? Upon request: Backend Request Backend Response Hammock Request Hammock Response Method Arguments Method Result Backend Framework Decorated Method There is a lot of magic there...
  • 22. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 Future work ❏ More frameworks! (maybe you wanna help?) ❏ Scheme validation. ❏ Combine with swagger/RAML. ❏ Improve unit testing infra. ❏ And much more :-)
  • 23. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 Questions? ❏ Contact: eyal@stratoscale.com ❏ Install: pip install hammock-rest >>> import hammock ❏ Contribute: git clone https://github.com/Stratoscale/hammock.git
  • 24. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 Performance Property Falcon Hammock Ratio Remarks Document Length [bytes] 638 601 1.06 ujson :-) Time taken for tests [seconds] 36.3 38 0.96 Requests per second [#/sec] (mean) 1378.5 1314.6 1.05 Time per request [ms] (mean) 0.725 0.761 0.95 Transfer rate [Kbytes/sec] received 955.8 864 1.11 Small benchmark with Apache bench for 50,000 GET requests that returns the same file list method.
  • 25. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 WSGI def app(environ, start_response): start_response('200 OK', [('Content-type', 'text/plain')]) return ['Hello world!n']
  • 26. ® Copyright Stratoscale www.stratoscale.com @stratoscale +1 877 420 3244 Appendix List of WSGI compliant servers. List of WSGI compliant frameworks.

Hinweis der Redaktion

  1. סטרארטוסקייל מספקת פתרונות ענן פרטי שנותן חויה כמו של הענן הציבורי (למשל AWS) עם OPENSTACK APIS
  2. ה WSGI הוא פרוטוקול שנכתב ב 2003 כדי לקשר בין סרבר לפריימוורק מהו הסרבר ניהול הקונקשנים ניהול הוורקרים הפיכת בתים מ TCP לאובייקטים פייתונים. ותרגום חזרה מאובייקטים פייתונים לבתים ב TCP. מהו הפריימוורק ניהול הראוטים. ניהול שגיאות. הפיכת ה WSGI לידידותי למשתמש. למה האפליקיישן בסוגריים
  3. יש הרבה שחקנים. חלק ממשו את צד הסרבר, חלק את הפריימוורק וחלק את שניהם.
  4. לא להתעכב פה באנו לדבר על מימוש רסט מעל HTTP, לא על ווב. REST זה קונוונציה. יש 5 פעולות עיקריות. לא כולם עוקבים אחרי זה. מפתח לא צריך ללמוד את זה אם יש לך מפתח שלא מכיר, אתה API לא קונסיסטנטי.
  5. בוא ניקח מימוש של 5 הפעולות העיקריות על resource של קבצים בפלקון. הפונקציות האלו נקראות handlers או views. קליק - צריך שתי מחלקות. קליק - לרשום אותם פעמיים לאפליקציה. אוקיי, קליק - בוא נתרכז רגע בפונקציה הזו. - בשקף הבא
  6. דוגמא ל route שמחזיר רשימה של קבצים. קליק - במקום להתעסק רק ב business logic למפתח יש overhead קבוע, עבור כל פונקציה. המפתח מקבל שני אבייקטים, רקווסט ורספונס. בחלק הראשון הוא מתעסק בלהוציא את הארגומנטים מהרקווסט בחלק השני הוא מתעסק בלדחוף נתונים לרספונס.
  7. רובם נועדו לשרת בקשות ווב, והוסיפו להם אקסטנשנז לרסט.
  8. ארגומנטים: פשוט רושמים פונקציה פייתונית. ארגומנטים מנדטורים, אופציונלים, טייפים. מחזירים רשימה/ דיקט. מומר לריספונס אוטומטית. קליק קליק קליק
  9. בכל זאת מדובר ב REST, ועדיין יש כמה דברים שהם לא כמו פונקציות פייתוניות רגילות. השתדלנו להסתיר אותם ככל שאפשר.
  10. משתמשים בהיררכית ספריות בשביל ליצור את ה path.
  11. קליק: דוגמא של FALCON
  12. לתמוך בשפה עשירה יותר של קלטים.