SlideShare a Scribd company logo
1 of 33
Download to read offline
HTTP API in Action
Max Neunhöffer, ArangoDB
Jörg Schad, Mesosphere
© 2016 Mesosphere, Inc. All Rights Reserved. 2
Jörg Schad
Distributed Systems Engineer,
Mesosphere
@joerg_schad
Max Neunhöffer
Senior Software Architect
ArangoDB
@neunhoef
© 2016 Mesosphere, Inc. All Rights Reserved. 3
HTTP v1 APIs
● Mesos 1.0 Milestone
● Actually multiple APIs
○ Framework
■ Scheduler
■ Executor
○ Operator
● RPC-based HTTP API
● Language independent
schedulers!
© 2016 Mesosphere, Inc. All Rights Reserved. 4
In the beginning
there was libmesos
© 2016 Mesosphere, Inc. All Rights Reserved. 5
The old
days…
● Not portable
● Hard to
debug
● Upgrade
Dependency
● No
Versioning
Scheduler
Java
Library
Native
Library
mesos.jar libmesos.so
Mesos Master
© 2016 Mesosphere, Inc. All Rights Reserved. 6
Networking
● Container?
● Firewall
Scheduler
Java
Library
Native
Library
mesos.jar libmesos.so
Mesos Master
© 2016 Mesosphere, Inc. All Rights Reserved. 7
Let us break down
walls….
© 2015 Mesosphere, Inc. All Rights Reserved.
Mesos APIs
8
Scheduler Master Agent Executor
Scheduler API Executor API
Framework API
Master API Agent API
Operator
Operator API
Internal API
© 2016 Mesosphere, Inc. All Rights Reserved. 9
But then business
demanded
FAST DATALet us build something new!
© 2016 Mesosphere, Inc. All Rights Reserved. 10
API V1 Goals
● Work inside firewalls / containers
● Allow pure language client libraries
● API versioning
● Backwards compatible API evolution
● Well documented
FRAMEWORK PROTOCOL
• Every call is a HTTP POST request
• Content-Type: application/json or application/x-protobuf
• Successful SUBSCRIBE call results in a “200 OK” streaming response
• Record-IO formatted events
• Persistent connection
• All successful non-SUBSCRIBE calls result in “202 Accepted”
•
WORKFLOW
Scheduler Master
SUBSCRIBE
POST /api/v1/scheduler HTTP/1.1
{
"type" : "SUBSCRIBE",
"subscribe" : {
"framework_info" : {
"user" : "foo",
"name" : "Example HTTP Framework"
}
}
}
WORKFLOW
SUBSCRIBE
Scheduler Master
WORKFLOW
HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked
Mesos-Stream-Id: 130ae4e3-6b13-4ef4-baa9-9f2e85c3e9af
<event length>{
"type": "SUBSCRIBED",
"subscribed": {
"framework_id": {
"value": "12220-3440-12532-2345"
},
"heartbeat_interval_seconds": 15
}
}<more events>
<more events>
SUBSCRIBE
Streaming Response
MasterScheduler
WORKFLOW
Scheduler Master
Offers Event
<event-length>
{
"type" : "OFFERS",
"offers" : [
{
"offer_id":{"value": "12214-23523-O235235"},
"framework_id":{"value": "12124-235325-32425"},
"agent_id":{"value": "12325-23523-S23523"},
"hostname":"agent.host",
"resources":[...],
"attributes":[...],
"executor_ids":[]
}
]
}
Agent
WORKFLOW
Scheduler Master
ACCEPT
POST /api/v1/scheduler HTTP/1.1
Mesos-Stream-Id: 130ae4e3-6b13-4ef4-baa9-9f2e85c3e9af
{
"framework_id" : {"value" : "12220-3440-12532-2345"},
"type" : "ACCEPT",
"accept" : {
"offer_ids" : [
{"value" : "12220-3440-12532-O12"},
{"value" : "12220-3440-12532-O12"}
],
"operations" : [ {"type" : "LAUNCH", "launch" : {...}} ],
"filters" : {...}
}
}
Agent
Scheduler Master
WORKFLOW
ACCEPT
Response
HTTP/1.1 202 Accepted
Agent
WORKFLOW
Scheduler Master
ACCEPT
Launch Task
Agent
WORKFLOW
Scheduler Master
Launch Task
Executor
SUBSCRIBE
Agent
ACCEPT
SCHEDULER DISCONNECTIONS & PARTITIONS
• Master tracks the persistent subscription connection
• Reconnect within framework failover timeout
• Periodic HEARTBEAT events sent by master
Operator API
• Master and Agent API
• Human Operator
•
• Event Stream
• Avoid Polling /state_summary
• RecordIO format
•
21
POST /api/v1/executor HTTP/1.1
Host: agenthost:5051
Content-Type: application/json
Accept: application/json
{
"type": "SUBSCRIBE",
}
Operator API
• Master and Agent API
• Human Operator
•
• Event Stream
• RecordIO format
•
22
<event-length>
{
"type": "TASK_UPDATED",
"task_updated": {
"task_id": {
"value": "42154f1b-adcd-4421-bf13-8bd11adfafaf"
},
"framework_id": {
"value": "49154f1b-8cf6-4421-bf13-8bd11dccd1f1"
},
"agent_id": {
"value": "2915adf-8aff-4421-bf13-afdafaf1f1"
},
"executor_id": {
"value": "adfaf-adff-2421-bf13-adf23tafa21"
},
"state" : "TASK_RUNNING"
}
}
Versioning
• Corresponding major versions
• API compatibility
• Protobuf like
http://localhost:5050/api/v1/scheduler
http://localhost:5051/api/v2/executor
API STATUS
• Scheduler API & Executor API : Stable
• Operator API : Experimental
• Client library implementations
© 2015 Mesosphere, Inc. All Rights Reserved. 25
● multimodel
Database
● extensible
© 2016 Mesosphere, Inc. All Rights Reserved. 26
Writing a framework scheduler for a stateful service is hard:
● A part of the scheduling happens in the framework (accepting offers).
● Getting the scheduling logic right is difficult
● A framework needs to be resilient (use zookeeper)
● The ArangoDB framework consists of 5140 SLOC in C++
● It handles
● deployment,
● dealing with persistent volumes,
● a part of the failover, and
● a part of the up and down scaling.
ArangoDB Mesos Framework
© 2016 Mesosphere, Inc. All Rights Reserved. 27
libmesos makes it challenging to develop frameworks:
● The framework executable is usually deployed as Docker image.
● There are two connections needed between framework and Mesos master in
different directions (network isolation problems).
● One is limited to C++, Java or Python.
● The libmesos source is huge: 190K SLOC
● A Docker image to build a framework with libmesos needs >3GB
● Documentation is mostly hidden in the source.
● Debugging is a challenge (Docker, Mesos, binary messages, network issues).
Motivation ArangoDB
© 2016 Mesosphere, Inc. All Rights Reserved. 28
Solution: Use a SDK that works via the HTTP protocol.
The HTTP protocol provides the following advantages:
● any language works that can to HTTP/JSON
● JSON is clear-text and easier to debug
● using an SDK removes the amount of boilerplate code
● do not need libmesos
● much smaller footprint
Prototype: Mesos framework SDK for node.js
Still: scheduling and failure management
HTTP based ArangoDB
Writing Stateful Frameworks - Ken Sipe & Jörg Schad
Saturday, 10:25
© 2016 Mesosphere, Inc. All Rights Reserved. 29
Challenges
● State Abstraction missing (MESOS-2916)
● Mesos-framework
● Persistent Volumes
● Failover
● Scaling
● Operations (e.g., Updates)
© 2016 Mesosphere, Inc. All Rights Reserved. 30
● Shim
● Switch between old/new API
● Independent code
● Mesos-framework
● JS based SDK
● Not production!
● DC/OS SDK
How to get started?
var scheduler = new Scheduler({
"masterUrl": "172.17.10.103", // If Mesos DNS is used this would be
"leader.mesos", otherwise use the actual IP address of the leading master
"port": 5050,
"frameworkName": "My first Command framework",
"logging": {
"level": "debug" // Set log Level to debug (default is info)
},
"restartStates": ["TASK_FAILED", "TASK_KILLED", "TASK_LOST",
"TASK_ERROR", "TASK_FINISHED"], // Overwrite the restartStates (by default,
TASK_FINISHED tasks are NOT restarted!)
"tasks": {
"sleepProcesses": {
"priority": 1,
"instances": 3,
"commandInfo": new Mesos.CommandInfo(
"sleep 10;"
),
"resources": {
"cpus": 0.2,
"mem": 128,
"ports": 1,
"disk": 0
}}}
Writing Stateful Frameworks - Ken Sipe & Jörg Schad
Saturday, 10:25
© 2016 Mesosphere, Inc. All Rights Reserved. 31
● Use libraries
● Shim for easy switching
● Persistent Connection
● Connection: keep-alive
● Transfer-Encoding: chunked
● HTTP Pipelining
● React to heart beats
● Implement authentication schema
Best Practices
© 2016 Mesosphere, Inc. All Rights Reserved. 32
Thank You!
Learn more by visiting dcos.io and arangodb.com.
© 2016 Mesosphere, Inc. All Rights Reserved.
THANK YOU!
33

More Related Content

Viewers also liked

Creating data centric microservices
Creating data centric microservicesCreating data centric microservices
Creating data centric microservicesArangoDB Database
 
Polyglot Persistence & Multi-Model Databases (FullStack Toronto)
Polyglot Persistence & Multi-Model Databases (FullStack Toronto)Polyglot Persistence & Multi-Model Databases (FullStack Toronto)
Polyglot Persistence & Multi-Model Databases (FullStack Toronto)ArangoDB Database
 
Processing large-scale graphs with Google(TM) Pregel
Processing large-scale graphs with Google(TM) PregelProcessing large-scale graphs with Google(TM) Pregel
Processing large-scale graphs with Google(TM) PregelArangoDB Database
 
Performance comparison: Multi-Model vs. MongoDB and Neo4j
Performance comparison: Multi-Model vs. MongoDB and Neo4jPerformance comparison: Multi-Model vs. MongoDB and Neo4j
Performance comparison: Multi-Model vs. MongoDB and Neo4jArangoDB Database
 
Handling Billions of Edges in a Graph Database
Handling Billions of Edges in a Graph DatabaseHandling Billions of Edges in a Graph Database
Handling Billions of Edges in a Graph DatabaseArangoDB Database
 
Polyglot Persistence & Multi-Model Databases
Polyglot Persistence & Multi-Model DatabasesPolyglot Persistence & Multi-Model Databases
Polyglot Persistence & Multi-Model DatabasesArangoDB Database
 
Efficient HTTP Apis
Efficient HTTP ApisEfficient HTTP Apis
Efficient HTTP ApisAdrian Cole
 
Creating Fault Tolerant Services on Mesos
Creating Fault Tolerant Services on MesosCreating Fault Tolerant Services on Mesos
Creating Fault Tolerant Services on MesosArangoDB Database
 
Why Plone Will Die
Why Plone Will DieWhy Plone Will Die
Why Plone Will DieAndreas Jung
 
Why we love ArangoDB. The hunt for the right NosQL Database
Why we love ArangoDB. The hunt for the right NosQL DatabaseWhy we love ArangoDB. The hunt for the right NosQL Database
Why we love ArangoDB. The hunt for the right NosQL DatabaseAndreas Jung
 
Spark Summit EU talk by Jorg Schad
Spark Summit EU talk by Jorg SchadSpark Summit EU talk by Jorg Schad
Spark Summit EU talk by Jorg SchadSpark Summit
 
Introduction to column oriented databases
Introduction to column oriented databasesIntroduction to column oriented databases
Introduction to column oriented databasesArangoDB Database
 
Introduction and overview ArangoDB query language AQL
Introduction and overview ArangoDB query language AQLIntroduction and overview ArangoDB query language AQL
Introduction and overview ArangoDB query language AQLArangoDB Database
 
Spark Summit EU talk by Mike Percy
Spark Summit EU talk by Mike PercySpark Summit EU talk by Mike Percy
Spark Summit EU talk by Mike PercySpark Summit
 
The Cloud Native Stack
The Cloud Native StackThe Cloud Native Stack
The Cloud Native StackQAware GmbH
 
Powering Predictive Mapping at Scale with Spark, Kafka, and Elastic Search: S...
Powering Predictive Mapping at Scale with Spark, Kafka, and Elastic Search: S...Powering Predictive Mapping at Scale with Spark, Kafka, and Elastic Search: S...
Powering Predictive Mapping at Scale with Spark, Kafka, and Elastic Search: S...Spark Summit
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsVikash Singh
 

Viewers also liked (20)

Guacamole
GuacamoleGuacamole
Guacamole
 
Creating data centric microservices
Creating data centric microservicesCreating data centric microservices
Creating data centric microservices
 
Polyglot Persistence & Multi-Model Databases (FullStack Toronto)
Polyglot Persistence & Multi-Model Databases (FullStack Toronto)Polyglot Persistence & Multi-Model Databases (FullStack Toronto)
Polyglot Persistence & Multi-Model Databases (FullStack Toronto)
 
Processing large-scale graphs with Google(TM) Pregel
Processing large-scale graphs with Google(TM) PregelProcessing large-scale graphs with Google(TM) Pregel
Processing large-scale graphs with Google(TM) Pregel
 
Performance comparison: Multi-Model vs. MongoDB and Neo4j
Performance comparison: Multi-Model vs. MongoDB and Neo4jPerformance comparison: Multi-Model vs. MongoDB and Neo4j
Performance comparison: Multi-Model vs. MongoDB and Neo4j
 
ArangoDB
ArangoDBArangoDB
ArangoDB
 
Handling Billions of Edges in a Graph Database
Handling Billions of Edges in a Graph DatabaseHandling Billions of Edges in a Graph Database
Handling Billions of Edges in a Graph Database
 
Polyglot Persistence & Multi-Model Databases
Polyglot Persistence & Multi-Model DatabasesPolyglot Persistence & Multi-Model Databases
Polyglot Persistence & Multi-Model Databases
 
Efficient HTTP Apis
Efficient HTTP ApisEfficient HTTP Apis
Efficient HTTP Apis
 
Creating Fault Tolerant Services on Mesos
Creating Fault Tolerant Services on MesosCreating Fault Tolerant Services on Mesos
Creating Fault Tolerant Services on Mesos
 
Why Plone Will Die
Why Plone Will DieWhy Plone Will Die
Why Plone Will Die
 
NoSQL meets Microservices
NoSQL meets MicroservicesNoSQL meets Microservices
NoSQL meets Microservices
 
Why we love ArangoDB. The hunt for the right NosQL Database
Why we love ArangoDB. The hunt for the right NosQL DatabaseWhy we love ArangoDB. The hunt for the right NosQL Database
Why we love ArangoDB. The hunt for the right NosQL Database
 
Spark Summit EU talk by Jorg Schad
Spark Summit EU talk by Jorg SchadSpark Summit EU talk by Jorg Schad
Spark Summit EU talk by Jorg Schad
 
Introduction to column oriented databases
Introduction to column oriented databasesIntroduction to column oriented databases
Introduction to column oriented databases
 
Introduction and overview ArangoDB query language AQL
Introduction and overview ArangoDB query language AQLIntroduction and overview ArangoDB query language AQL
Introduction and overview ArangoDB query language AQL
 
Spark Summit EU talk by Mike Percy
Spark Summit EU talk by Mike PercySpark Summit EU talk by Mike Percy
Spark Summit EU talk by Mike Percy
 
The Cloud Native Stack
The Cloud Native StackThe Cloud Native Stack
The Cloud Native Stack
 
Powering Predictive Mapping at Scale with Spark, Kafka, and Elastic Search: S...
Powering Predictive Mapping at Scale with Spark, Kafka, and Elastic Search: S...Powering Predictive Mapping at Scale with Spark, Kafka, and Elastic Search: S...
Powering Predictive Mapping at Scale with Spark, Kafka, and Elastic Search: S...
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 

More from ArangoDB Database

ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....
ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....
ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....ArangoDB Database
 
Machine Learning + Graph Databases for Better Recommendations V2 08/20/2022
Machine Learning + Graph Databases for Better Recommendations V2 08/20/2022Machine Learning + Graph Databases for Better Recommendations V2 08/20/2022
Machine Learning + Graph Databases for Better Recommendations V2 08/20/2022ArangoDB Database
 
Machine Learning + Graph Databases for Better Recommendations V1 08/06/2022
Machine Learning + Graph Databases for Better Recommendations V1 08/06/2022Machine Learning + Graph Databases for Better Recommendations V1 08/06/2022
Machine Learning + Graph Databases for Better Recommendations V1 08/06/2022ArangoDB Database
 
ArangoDB 3.9 - Further Powering Graphs at Scale
ArangoDB 3.9 - Further Powering Graphs at ScaleArangoDB 3.9 - Further Powering Graphs at Scale
ArangoDB 3.9 - Further Powering Graphs at ScaleArangoDB Database
 
GraphSage vs Pinsage #InsideArangoDB
GraphSage vs Pinsage #InsideArangoDBGraphSage vs Pinsage #InsideArangoDB
GraphSage vs Pinsage #InsideArangoDBArangoDB Database
 
Webinar: ArangoDB 3.8 Preview - Analytics at Scale
Webinar: ArangoDB 3.8 Preview - Analytics at Scale Webinar: ArangoDB 3.8 Preview - Analytics at Scale
Webinar: ArangoDB 3.8 Preview - Analytics at Scale ArangoDB Database
 
Graph Analytics with ArangoDB
Graph Analytics with ArangoDBGraph Analytics with ArangoDB
Graph Analytics with ArangoDBArangoDB Database
 
Getting Started with ArangoDB Oasis
Getting Started with ArangoDB OasisGetting Started with ArangoDB Oasis
Getting Started with ArangoDB OasisArangoDB Database
 
Custom Pregel Algorithms in ArangoDB
Custom Pregel Algorithms in ArangoDBCustom Pregel Algorithms in ArangoDB
Custom Pregel Algorithms in ArangoDBArangoDB Database
 
Hacktoberfest 2020 - Intro to Knowledge Graphs
Hacktoberfest 2020 - Intro to Knowledge GraphsHacktoberfest 2020 - Intro to Knowledge Graphs
Hacktoberfest 2020 - Intro to Knowledge GraphsArangoDB Database
 
A Graph Database That Scales - ArangoDB 3.7 Release Webinar
A Graph Database That Scales - ArangoDB 3.7 Release WebinarA Graph Database That Scales - ArangoDB 3.7 Release Webinar
A Graph Database That Scales - ArangoDB 3.7 Release WebinarArangoDB Database
 
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?ArangoDB Database
 
ArangoML Pipeline Cloud - Managed Machine Learning Metadata
ArangoML Pipeline Cloud - Managed Machine Learning MetadataArangoML Pipeline Cloud - Managed Machine Learning Metadata
ArangoML Pipeline Cloud - Managed Machine Learning MetadataArangoDB Database
 
ArangoDB 3.7 Roadmap: Performance at Scale
ArangoDB 3.7 Roadmap: Performance at ScaleArangoDB 3.7 Roadmap: Performance at Scale
ArangoDB 3.7 Roadmap: Performance at ScaleArangoDB Database
 
Webinar: What to expect from ArangoDB Oasis
Webinar: What to expect from ArangoDB OasisWebinar: What to expect from ArangoDB Oasis
Webinar: What to expect from ArangoDB OasisArangoDB Database
 
ArangoDB 3.5 Feature Overview Webinar - Sept 12, 2019
ArangoDB 3.5 Feature Overview Webinar - Sept 12, 2019ArangoDB 3.5 Feature Overview Webinar - Sept 12, 2019
ArangoDB 3.5 Feature Overview Webinar - Sept 12, 2019ArangoDB Database
 
Webinar: How native multi model works in ArangoDB
Webinar: How native multi model works in ArangoDBWebinar: How native multi model works in ArangoDB
Webinar: How native multi model works in ArangoDBArangoDB Database
 
An introduction to multi-model databases
An introduction to multi-model databasesAn introduction to multi-model databases
An introduction to multi-model databasesArangoDB Database
 
Running complex data queries in a distributed system
Running complex data queries in a distributed systemRunning complex data queries in a distributed system
Running complex data queries in a distributed systemArangoDB Database
 

More from ArangoDB Database (20)

ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....
ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....
ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....
 
Machine Learning + Graph Databases for Better Recommendations V2 08/20/2022
Machine Learning + Graph Databases for Better Recommendations V2 08/20/2022Machine Learning + Graph Databases for Better Recommendations V2 08/20/2022
Machine Learning + Graph Databases for Better Recommendations V2 08/20/2022
 
Machine Learning + Graph Databases for Better Recommendations V1 08/06/2022
Machine Learning + Graph Databases for Better Recommendations V1 08/06/2022Machine Learning + Graph Databases for Better Recommendations V1 08/06/2022
Machine Learning + Graph Databases for Better Recommendations V1 08/06/2022
 
ArangoDB 3.9 - Further Powering Graphs at Scale
ArangoDB 3.9 - Further Powering Graphs at ScaleArangoDB 3.9 - Further Powering Graphs at Scale
ArangoDB 3.9 - Further Powering Graphs at Scale
 
GraphSage vs Pinsage #InsideArangoDB
GraphSage vs Pinsage #InsideArangoDBGraphSage vs Pinsage #InsideArangoDB
GraphSage vs Pinsage #InsideArangoDB
 
Webinar: ArangoDB 3.8 Preview - Analytics at Scale
Webinar: ArangoDB 3.8 Preview - Analytics at Scale Webinar: ArangoDB 3.8 Preview - Analytics at Scale
Webinar: ArangoDB 3.8 Preview - Analytics at Scale
 
Graph Analytics with ArangoDB
Graph Analytics with ArangoDBGraph Analytics with ArangoDB
Graph Analytics with ArangoDB
 
Getting Started with ArangoDB Oasis
Getting Started with ArangoDB OasisGetting Started with ArangoDB Oasis
Getting Started with ArangoDB Oasis
 
Custom Pregel Algorithms in ArangoDB
Custom Pregel Algorithms in ArangoDBCustom Pregel Algorithms in ArangoDB
Custom Pregel Algorithms in ArangoDB
 
Hacktoberfest 2020 - Intro to Knowledge Graphs
Hacktoberfest 2020 - Intro to Knowledge GraphsHacktoberfest 2020 - Intro to Knowledge Graphs
Hacktoberfest 2020 - Intro to Knowledge Graphs
 
A Graph Database That Scales - ArangoDB 3.7 Release Webinar
A Graph Database That Scales - ArangoDB 3.7 Release WebinarA Graph Database That Scales - ArangoDB 3.7 Release Webinar
A Graph Database That Scales - ArangoDB 3.7 Release Webinar
 
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
 
ArangoML Pipeline Cloud - Managed Machine Learning Metadata
ArangoML Pipeline Cloud - Managed Machine Learning MetadataArangoML Pipeline Cloud - Managed Machine Learning Metadata
ArangoML Pipeline Cloud - Managed Machine Learning Metadata
 
ArangoDB 3.7 Roadmap: Performance at Scale
ArangoDB 3.7 Roadmap: Performance at ScaleArangoDB 3.7 Roadmap: Performance at Scale
ArangoDB 3.7 Roadmap: Performance at Scale
 
Webinar: What to expect from ArangoDB Oasis
Webinar: What to expect from ArangoDB OasisWebinar: What to expect from ArangoDB Oasis
Webinar: What to expect from ArangoDB Oasis
 
ArangoDB 3.5 Feature Overview Webinar - Sept 12, 2019
ArangoDB 3.5 Feature Overview Webinar - Sept 12, 2019ArangoDB 3.5 Feature Overview Webinar - Sept 12, 2019
ArangoDB 3.5 Feature Overview Webinar - Sept 12, 2019
 
3.5 webinar
3.5 webinar 3.5 webinar
3.5 webinar
 
Webinar: How native multi model works in ArangoDB
Webinar: How native multi model works in ArangoDBWebinar: How native multi model works in ArangoDB
Webinar: How native multi model works in ArangoDB
 
An introduction to multi-model databases
An introduction to multi-model databasesAn introduction to multi-model databases
An introduction to multi-model databases
 
Running complex data queries in a distributed system
Running complex data queries in a distributed systemRunning complex data queries in a distributed system
Running complex data queries in a distributed system
 

Recently uploaded

#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
[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
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
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
 
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
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
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
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 

Recently uploaded (20)

#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
[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
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
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
 
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...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
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
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 

HTTP API In Action by Max Neunhöffer, ArangoDB and Jörg Schad, Mesosphere

  • 1. HTTP API in Action Max Neunhöffer, ArangoDB Jörg Schad, Mesosphere
  • 2. © 2016 Mesosphere, Inc. All Rights Reserved. 2 Jörg Schad Distributed Systems Engineer, Mesosphere @joerg_schad Max Neunhöffer Senior Software Architect ArangoDB @neunhoef
  • 3. © 2016 Mesosphere, Inc. All Rights Reserved. 3 HTTP v1 APIs ● Mesos 1.0 Milestone ● Actually multiple APIs ○ Framework ■ Scheduler ■ Executor ○ Operator ● RPC-based HTTP API ● Language independent schedulers!
  • 4. © 2016 Mesosphere, Inc. All Rights Reserved. 4 In the beginning there was libmesos
  • 5. © 2016 Mesosphere, Inc. All Rights Reserved. 5 The old days… ● Not portable ● Hard to debug ● Upgrade Dependency ● No Versioning Scheduler Java Library Native Library mesos.jar libmesos.so Mesos Master
  • 6. © 2016 Mesosphere, Inc. All Rights Reserved. 6 Networking ● Container? ● Firewall Scheduler Java Library Native Library mesos.jar libmesos.so Mesos Master
  • 7. © 2016 Mesosphere, Inc. All Rights Reserved. 7 Let us break down walls….
  • 8. © 2015 Mesosphere, Inc. All Rights Reserved. Mesos APIs 8 Scheduler Master Agent Executor Scheduler API Executor API Framework API Master API Agent API Operator Operator API Internal API
  • 9. © 2016 Mesosphere, Inc. All Rights Reserved. 9 But then business demanded FAST DATALet us build something new!
  • 10. © 2016 Mesosphere, Inc. All Rights Reserved. 10 API V1 Goals ● Work inside firewalls / containers ● Allow pure language client libraries ● API versioning ● Backwards compatible API evolution ● Well documented
  • 11. FRAMEWORK PROTOCOL • Every call is a HTTP POST request • Content-Type: application/json or application/x-protobuf • Successful SUBSCRIBE call results in a “200 OK” streaming response • Record-IO formatted events • Persistent connection • All successful non-SUBSCRIBE calls result in “202 Accepted” •
  • 13. POST /api/v1/scheduler HTTP/1.1 { "type" : "SUBSCRIBE", "subscribe" : { "framework_info" : { "user" : "foo", "name" : "Example HTTP Framework" } } } WORKFLOW SUBSCRIBE Scheduler Master
  • 14. WORKFLOW HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Mesos-Stream-Id: 130ae4e3-6b13-4ef4-baa9-9f2e85c3e9af <event length>{ "type": "SUBSCRIBED", "subscribed": { "framework_id": { "value": "12220-3440-12532-2345" }, "heartbeat_interval_seconds": 15 } }<more events> <more events> SUBSCRIBE Streaming Response MasterScheduler
  • 15. WORKFLOW Scheduler Master Offers Event <event-length> { "type" : "OFFERS", "offers" : [ { "offer_id":{"value": "12214-23523-O235235"}, "framework_id":{"value": "12124-235325-32425"}, "agent_id":{"value": "12325-23523-S23523"}, "hostname":"agent.host", "resources":[...], "attributes":[...], "executor_ids":[] } ] } Agent
  • 16. WORKFLOW Scheduler Master ACCEPT POST /api/v1/scheduler HTTP/1.1 Mesos-Stream-Id: 130ae4e3-6b13-4ef4-baa9-9f2e85c3e9af { "framework_id" : {"value" : "12220-3440-12532-2345"}, "type" : "ACCEPT", "accept" : { "offer_ids" : [ {"value" : "12220-3440-12532-O12"}, {"value" : "12220-3440-12532-O12"} ], "operations" : [ {"type" : "LAUNCH", "launch" : {...}} ], "filters" : {...} } } Agent
  • 20. SCHEDULER DISCONNECTIONS & PARTITIONS • Master tracks the persistent subscription connection • Reconnect within framework failover timeout • Periodic HEARTBEAT events sent by master
  • 21. Operator API • Master and Agent API • Human Operator • • Event Stream • Avoid Polling /state_summary • RecordIO format • 21 POST /api/v1/executor HTTP/1.1 Host: agenthost:5051 Content-Type: application/json Accept: application/json { "type": "SUBSCRIBE", }
  • 22. Operator API • Master and Agent API • Human Operator • • Event Stream • RecordIO format • 22 <event-length> { "type": "TASK_UPDATED", "task_updated": { "task_id": { "value": "42154f1b-adcd-4421-bf13-8bd11adfafaf" }, "framework_id": { "value": "49154f1b-8cf6-4421-bf13-8bd11dccd1f1" }, "agent_id": { "value": "2915adf-8aff-4421-bf13-afdafaf1f1" }, "executor_id": { "value": "adfaf-adff-2421-bf13-adf23tafa21" }, "state" : "TASK_RUNNING" } }
  • 23. Versioning • Corresponding major versions • API compatibility • Protobuf like http://localhost:5050/api/v1/scheduler http://localhost:5051/api/v2/executor
  • 24. API STATUS • Scheduler API & Executor API : Stable • Operator API : Experimental • Client library implementations
  • 25. © 2015 Mesosphere, Inc. All Rights Reserved. 25 ● multimodel Database ● extensible
  • 26. © 2016 Mesosphere, Inc. All Rights Reserved. 26 Writing a framework scheduler for a stateful service is hard: ● A part of the scheduling happens in the framework (accepting offers). ● Getting the scheduling logic right is difficult ● A framework needs to be resilient (use zookeeper) ● The ArangoDB framework consists of 5140 SLOC in C++ ● It handles ● deployment, ● dealing with persistent volumes, ● a part of the failover, and ● a part of the up and down scaling. ArangoDB Mesos Framework
  • 27. © 2016 Mesosphere, Inc. All Rights Reserved. 27 libmesos makes it challenging to develop frameworks: ● The framework executable is usually deployed as Docker image. ● There are two connections needed between framework and Mesos master in different directions (network isolation problems). ● One is limited to C++, Java or Python. ● The libmesos source is huge: 190K SLOC ● A Docker image to build a framework with libmesos needs >3GB ● Documentation is mostly hidden in the source. ● Debugging is a challenge (Docker, Mesos, binary messages, network issues). Motivation ArangoDB
  • 28. © 2016 Mesosphere, Inc. All Rights Reserved. 28 Solution: Use a SDK that works via the HTTP protocol. The HTTP protocol provides the following advantages: ● any language works that can to HTTP/JSON ● JSON is clear-text and easier to debug ● using an SDK removes the amount of boilerplate code ● do not need libmesos ● much smaller footprint Prototype: Mesos framework SDK for node.js Still: scheduling and failure management HTTP based ArangoDB Writing Stateful Frameworks - Ken Sipe & Jörg Schad Saturday, 10:25
  • 29. © 2016 Mesosphere, Inc. All Rights Reserved. 29 Challenges ● State Abstraction missing (MESOS-2916) ● Mesos-framework ● Persistent Volumes ● Failover ● Scaling ● Operations (e.g., Updates)
  • 30. © 2016 Mesosphere, Inc. All Rights Reserved. 30 ● Shim ● Switch between old/new API ● Independent code ● Mesos-framework ● JS based SDK ● Not production! ● DC/OS SDK How to get started? var scheduler = new Scheduler({ "masterUrl": "172.17.10.103", // If Mesos DNS is used this would be "leader.mesos", otherwise use the actual IP address of the leading master "port": 5050, "frameworkName": "My first Command framework", "logging": { "level": "debug" // Set log Level to debug (default is info) }, "restartStates": ["TASK_FAILED", "TASK_KILLED", "TASK_LOST", "TASK_ERROR", "TASK_FINISHED"], // Overwrite the restartStates (by default, TASK_FINISHED tasks are NOT restarted!) "tasks": { "sleepProcesses": { "priority": 1, "instances": 3, "commandInfo": new Mesos.CommandInfo( "sleep 10;" ), "resources": { "cpus": 0.2, "mem": 128, "ports": 1, "disk": 0 }}} Writing Stateful Frameworks - Ken Sipe & Jörg Schad Saturday, 10:25
  • 31. © 2016 Mesosphere, Inc. All Rights Reserved. 31 ● Use libraries ● Shim for easy switching ● Persistent Connection ● Connection: keep-alive ● Transfer-Encoding: chunked ● HTTP Pipelining ● React to heart beats ● Implement authentication schema Best Practices
  • 32. © 2016 Mesosphere, Inc. All Rights Reserved. 32 Thank You! Learn more by visiting dcos.io and arangodb.com.
  • 33. © 2016 Mesosphere, Inc. All Rights Reserved. THANK YOU! 33