SlideShare a Scribd company logo
NATS:
Control Flow for Distributed Systems
Focus
© 2015 Bridgevine. All Rights reserved. December 9, 2015 2
The Transaction Engine
© 2015 Bridgevine. All Rights reserved. December 9, 2015 3
© 2015 Bridgevine. All Rights reserved. December 9, 2015 4
Engine speak
We refer to the outer circles as components, you’ll see
that term later...
Recently started referring to the center as the “queue”. It’s a
combination of NATS and Elasticsearch. More on this later too...
Elasticsearch is also the store used by History Recorder and the
Cache components.
Since everything communicates by messages, we wanted to use the
same message struct format but retain flexibility for the different
types of information the system will pass...
Find your center
© 2015 Bridgevine. All Rights reserved. December 9, 2015 5
© 2015 Bridgevine. All Rights reserved. December 9, 2015 6
The Msg Struct
We share by communicating via a single Msg struct.
We’ve evolved to this format, but expect more changes.
Could end up going with a “net/context” approach, but must retain compiler
advantages.
interface{} and []byte type overuse is disadvantageous.
© 2015 Bridgevine. All Rights reserved. December 9, 2015 7
Pub/Sub Queue - NATS
http://nats.io/
Love the performance focus. Major reason for selection.
Love the simplicity.
Using standard messaging for config updates
Want all instances of an API to get the update
Message Queueing
Only want one instance of component to process.
Employed in request/reply processing.
Avoids duplicate logging.
© 2015 Bridgevine. All Rights reserved. December 9, 2015 8
Central Storage Engine - Elasticsearch
https://www.elastic.co/products/elasticsearch
Initially selected for components providing search
functionality.
Flexibility allows for a variety of use cases.
Used as the key/value store companion to NATS for storing
message payloads.
Want to keep the NATS messages small.
NATS Msg
© 2015 Bridgevine. All Rights reserved. December 9, 2015 9
© 2015 Bridgevine. All Rights reserved. December 9, 2015 10
NATS Msg struct
We will be referring to NATS Msg fields of Subject and Reply in the next few slides…
Here’s what the struct looks like.
Our Msg struct ends up being encrypted and stored in the Data field in the NATS Msg.
We don’t really deal directly with the NATS Msg too much. Client API methods are there
to handle the construction of this struct, but you can do it yourself too.
https://github.com/nats-io/nats/blob/master/nats.go#L1323
Request/Reply
© 2015 Bridgevine. All Rights reserved. December 9, 2015 11
© 2015 Bridgevine. All Rights reserved. December 9, 2015 12
Request/Reply Steps
Origin first subscribes to the reply subject it’s about to ask for. Important
to do this first.
Origin publishes message with a reply subject. The reply subject should
be a unique string.
https://github.com/nats-io/nats/blob/master/nats.go#L1357
Subscriber replies to origin by using origin’s msg.Reply as msg.Subject
in the message it publishes.
Origin will receive the message. That’s it.
Go client simplifies this with Request method.
https://github.com/nats-io/nats/blob/master/nats.go#L1337
Forwarding
© 2015 Bridgevine. All Rights reserved. December 9, 2015 13
© 2015 Bridgevine. All Rights reserved. December 9, 2015 14
Origin Step 1 Step 2
Forwarding Steps
Origin subscribes to reply subject. Important to do this first.
Origin then publishes Request/Reply message.
Step 1 Receives message and produces result.
Step 1 Publishes message with new subject and uses same reply as
the message from Origin.
Step 2 Receives message, processes and publishes using reply from
Step 1’s message as subject.
Origin will receive the message from Step 2.
Subscribe/QueueSubscribe
© 2015 Bridgevine. All Rights reserved. December 9, 2015 15
© 2015 Bridgevine. All Rights reserved. December 9, 2015 16
Subscribe when all subscribers should receive the message.
https://github.com/nats-io/nats/blob/master/nats.go#L1399
Configuration updates drive this use case.
QueueSubscribe when only one of the subscribers should receive the
message.
https://github.com/nats-io/nats/blob/master/nats.go#L1412
So far...everything else/
Limit processing to one instance of a component in a load
balanced environment.
Combo Time!
© 2015 Bridgevine. All Rights reserved. December 9, 2015 17
© 2015 Bridgevine. All Rights reserved. December 9, 2015 18
Combos are good!
Publish + Subscribe
Send configuration update to all instances of a component.
Request/Reply + QueueSubscribe
Can’t control subscribing from publishing side.
Use QueueSubscribe to have only one instance of a component
process the request.
Request/Reply + QueueSubscribe + Forwarding
Start with initial processing component.
Forward message to continue processing
Select components like “Provider Interfaces” always forward.
Select components like “Rules Engine” always reply.
Some depend on subject.
Timeouts
© 2015 Bridgevine. All Rights reserved. December 9, 2015 19
© 2015 Bridgevine. All Rights reserved. December 9, 2015 20
“NATS is a fire-and-forget messaging system. If you need higher
levels of service, you build it into the client”
- http://nats.io/documentation/concepts/nats-pub-sub/
Multiple levels of timeouts to provide higher level of service.
Originating request timeout - overall time we will wait before responding
to requestor.
During requests involving multiple responses - time to return regardless
of the response percentage. Must be less than request timeout.
Processing timeouts - ensure we kill long running processes. These
timeouts will be longer than transaction timeouts. Allows us to still
gather data without hastily throwing away information.
We may need to dynamically adjust to external conditions. If a provider
is experiencing latency issues, it may make more sense to wait a bit
longer than lose orders.
Queue
© 2015 Bridgevine. All Rights reserved. December 9, 2015 21
© 2015 Bridgevine. All Rights reserved. December 9, 2015 22
The rather obvious (now) ...
Wanted to do logging via NATS and started with a dedicated logging
package. Quickly realized this could/should be simplified.
All components use NATS for communication already and wanted
logging done via NATS. Was it as simple as adding a Log method to
our NATS pub/sub code?
Wanted to log the interaction with the central data store.
Store, Load, Delete
Wanted to keep messages small.
Need to provide consumers with a stable API.
Would like to tune cache use without major refactoring efforts.
The birth of Queue
Interfaces are good. Queue should define the interfaces it would need
implementations for to provide Messaging and Caching functionality.
Instance of Queue could be created with references to concrete types
satisfying the interface.
Concerns that were once combined got their own identity.
The Msg struct was now in its own repo and also defined Msg Handler
type. Things are making sense.
The NATS and Elasticsearch repos provided simple wrappers to client
libs. Don’t want to expose Clients to components.
© 2015 Bridgevine. All Rights reserved. December 9, 2015 23
© 2015 Bridgevine. All Rights reserved. December 9, 2015 24
Queue interface definitions
© 2015 Bridgevine. All Rights reserved. December 9, 2015 25
Queue API
Request, Publish, Subscribe, Load, Store, Delete, Log
Don’t force the consumers of the API to do what must be done:
Request, Publish
Store payload.
Set CacheKey on Msg.
Request, Subscribe, QueueSubscribe
If CacheKey present, retrieves payload from Cache
Add Payload to CacheData on Msg.
Load, Store, Delete
Log these events
Log
Use runtime.FuncForPC to get caller information
Close down
© 2015 Bridgevine. All Rights reserved. December 9, 2015 26
© 2015 Bridgevine. All Rights reserved. December 9, 2015 27
Would like to ultimately open source Queue and other potentially useful
packages. Have already started contributing back with some open
source projects:
https://github.com/Bridgevine/soap
https://github.com/Bridgevine/http
https://github.com/Bridgevine/xml
Help us build this and more?
More info on what we are building...
Bridgevine Company Website
Open Positions
Thank you! If you have questions:
andy.stone@bridgevine.com or @stonean

More Related Content

What's hot

NATS Connect Live | NATS as a Service Mesh
NATS Connect Live | NATS as a Service MeshNATS Connect Live | NATS as a Service Mesh
NATS Connect Live | NATS as a Service Mesh
NATS
 
NATS for Modern Messaging and Microservices
NATS for Modern Messaging and MicroservicesNATS for Modern Messaging and Microservices
NATS for Modern Messaging and Microservices
Apcera
 
API World: The service-mesh landscape
API World: The service-mesh landscapeAPI World: The service-mesh landscape
API World: The service-mesh landscape
Christian Posta
 
How Greta uses NATS to revolutionize data distribution on the Internet
How Greta uses NATS to revolutionize data distribution on the InternetHow Greta uses NATS to revolutionize data distribution on the Internet
How Greta uses NATS to revolutionize data distribution on the Internet
Apcera
 
MRA AMA Part 6: Service Mesh Models
MRA AMA Part 6: Service Mesh ModelsMRA AMA Part 6: Service Mesh Models
MRA AMA Part 6: Service Mesh Models
NGINX, Inc.
 
Microservice design patterns
Microservice design patternsMicroservice design patterns
Microservice design patterns
Hugh McKee
 
Microservices
MicroservicesMicroservices
Microservices
Meysam Javadi
 
Understanding the New Enterprise Multi-Cloud Backbone for DevOps Engineers
Understanding the New Enterprise Multi-Cloud Backbone for DevOps EngineersUnderstanding the New Enterprise Multi-Cloud Backbone for DevOps Engineers
Understanding the New Enterprise Multi-Cloud Backbone for DevOps Engineers
DevOps.com
 
Kubernetes Ingress to Service Mesh (and beyond!)
Kubernetes Ingress to Service Mesh (and beyond!)Kubernetes Ingress to Service Mesh (and beyond!)
Kubernetes Ingress to Service Mesh (and beyond!)
Christian Posta
 
Keynote - Oleg Barenboim - ManageIQ Design Summit 2016
Keynote - Oleg Barenboim - ManageIQ Design Summit 2016Keynote - Oleg Barenboim - ManageIQ Design Summit 2016
Keynote - Oleg Barenboim - ManageIQ Design Summit 2016
ManageIQ
 
NGINX MRA Fabric Model Release and Ask Me Anything Part 4
NGINX MRA Fabric Model Release and Ask Me Anything Part 4NGINX MRA Fabric Model Release and Ask Me Anything Part 4
NGINX MRA Fabric Model Release and Ask Me Anything Part 4
NGINX, Inc.
 
Orchestration Patterns for Microservices with Messaging by RabbitMQ
Orchestration Patterns for Microservices with Messaging by RabbitMQOrchestration Patterns for Microservices with Messaging by RabbitMQ
Orchestration Patterns for Microservices with Messaging by RabbitMQ
VMware Tanzu
 
The Truth About the Service Mesh Data Plane
The Truth About the Service Mesh Data PlaneThe Truth About the Service Mesh Data Plane
The Truth About the Service Mesh Data Plane
Christian Posta
 
MANTL Data Platform, Microservices and BigData Services
MANTL Data Platform, Microservices and BigData ServicesMANTL Data Platform, Microservices and BigData Services
MANTL Data Platform, Microservices and BigData Services
Cisco DevNet
 
Multicluster Kubernetes and Service Mesh Patterns
Multicluster Kubernetes and Service Mesh PatternsMulticluster Kubernetes and Service Mesh Patterns
Multicluster Kubernetes and Service Mesh Patterns
Christian Posta
 
Microservices Architecture
Microservices ArchitectureMicroservices Architecture
Microservices Architecture
Srinivasan Nanduri
 
O'Reilly 2017: "Introduction to Service Meshes"
O'Reilly 2017: "Introduction to Service Meshes"O'Reilly 2017: "Introduction to Service Meshes"
O'Reilly 2017: "Introduction to Service Meshes"
Daniel Bryant
 
Service mesh
Service meshService mesh
Service mesh
Arnab Mitra
 
Microservices With Istio Service Mesh
Microservices With Istio Service MeshMicroservices With Istio Service Mesh
Microservices With Istio Service Mesh
Natanael Fonseca
 

What's hot (19)

NATS Connect Live | NATS as a Service Mesh
NATS Connect Live | NATS as a Service MeshNATS Connect Live | NATS as a Service Mesh
NATS Connect Live | NATS as a Service Mesh
 
NATS for Modern Messaging and Microservices
NATS for Modern Messaging and MicroservicesNATS for Modern Messaging and Microservices
NATS for Modern Messaging and Microservices
 
API World: The service-mesh landscape
API World: The service-mesh landscapeAPI World: The service-mesh landscape
API World: The service-mesh landscape
 
How Greta uses NATS to revolutionize data distribution on the Internet
How Greta uses NATS to revolutionize data distribution on the InternetHow Greta uses NATS to revolutionize data distribution on the Internet
How Greta uses NATS to revolutionize data distribution on the Internet
 
MRA AMA Part 6: Service Mesh Models
MRA AMA Part 6: Service Mesh ModelsMRA AMA Part 6: Service Mesh Models
MRA AMA Part 6: Service Mesh Models
 
Microservice design patterns
Microservice design patternsMicroservice design patterns
Microservice design patterns
 
Microservices
MicroservicesMicroservices
Microservices
 
Understanding the New Enterprise Multi-Cloud Backbone for DevOps Engineers
Understanding the New Enterprise Multi-Cloud Backbone for DevOps EngineersUnderstanding the New Enterprise Multi-Cloud Backbone for DevOps Engineers
Understanding the New Enterprise Multi-Cloud Backbone for DevOps Engineers
 
Kubernetes Ingress to Service Mesh (and beyond!)
Kubernetes Ingress to Service Mesh (and beyond!)Kubernetes Ingress to Service Mesh (and beyond!)
Kubernetes Ingress to Service Mesh (and beyond!)
 
Keynote - Oleg Barenboim - ManageIQ Design Summit 2016
Keynote - Oleg Barenboim - ManageIQ Design Summit 2016Keynote - Oleg Barenboim - ManageIQ Design Summit 2016
Keynote - Oleg Barenboim - ManageIQ Design Summit 2016
 
NGINX MRA Fabric Model Release and Ask Me Anything Part 4
NGINX MRA Fabric Model Release and Ask Me Anything Part 4NGINX MRA Fabric Model Release and Ask Me Anything Part 4
NGINX MRA Fabric Model Release and Ask Me Anything Part 4
 
Orchestration Patterns for Microservices with Messaging by RabbitMQ
Orchestration Patterns for Microservices with Messaging by RabbitMQOrchestration Patterns for Microservices with Messaging by RabbitMQ
Orchestration Patterns for Microservices with Messaging by RabbitMQ
 
The Truth About the Service Mesh Data Plane
The Truth About the Service Mesh Data PlaneThe Truth About the Service Mesh Data Plane
The Truth About the Service Mesh Data Plane
 
MANTL Data Platform, Microservices and BigData Services
MANTL Data Platform, Microservices and BigData ServicesMANTL Data Platform, Microservices and BigData Services
MANTL Data Platform, Microservices and BigData Services
 
Multicluster Kubernetes and Service Mesh Patterns
Multicluster Kubernetes and Service Mesh PatternsMulticluster Kubernetes and Service Mesh Patterns
Multicluster Kubernetes and Service Mesh Patterns
 
Microservices Architecture
Microservices ArchitectureMicroservices Architecture
Microservices Architecture
 
O'Reilly 2017: "Introduction to Service Meshes"
O'Reilly 2017: "Introduction to Service Meshes"O'Reilly 2017: "Introduction to Service Meshes"
O'Reilly 2017: "Introduction to Service Meshes"
 
Service mesh
Service meshService mesh
Service mesh
 
Microservices With Istio Service Mesh
Microservices With Istio Service MeshMicroservices With Istio Service Mesh
Microservices With Istio Service Mesh
 

Similar to NATS: Control Flow for Distributed Systems

MuleSoft Meetup Singapore #8 March 2021
MuleSoft Meetup Singapore #8 March 2021MuleSoft Meetup Singapore #8 March 2021
MuleSoft Meetup Singapore #8 March 2021
Julian Douch
 
MuleSoft Surat Virtual Meetup#18 - Persistent Queue, Object Store and Persist...
MuleSoft Surat Virtual Meetup#18 - Persistent Queue, Object Store and Persist...MuleSoft Surat Virtual Meetup#18 - Persistent Queue, Object Store and Persist...
MuleSoft Surat Virtual Meetup#18 - Persistent Queue, Object Store and Persist...
Jitendra Bafna
 
Sf bay area Kubernetes meetup dec8 2016 - deployment models
Sf bay area Kubernetes meetup dec8 2016 - deployment modelsSf bay area Kubernetes meetup dec8 2016 - deployment models
Sf bay area Kubernetes meetup dec8 2016 - deployment models
Peter Ss
 
Cloud by dev
Cloud by devCloud by dev
Cloud by dev
Devdutta Chakrabarti
 
RTBkit Meetup - Developer Spotlight, Behind the Scenes of RTBkit and Intro to...
RTBkit Meetup - Developer Spotlight, Behind the Scenes of RTBkit and Intro to...RTBkit Meetup - Developer Spotlight, Behind the Scenes of RTBkit and Intro to...
RTBkit Meetup - Developer Spotlight, Behind the Scenes of RTBkit and Intro to...
Datacratic
 
Who's Who in Container Land
Who's Who in Container LandWho's Who in Container Land
Who's Who in Container Land
Mike Kavis
 
Azure + DataStax Enterprise (DSE) Powers Office365 Per User Store
Azure + DataStax Enterprise (DSE) Powers Office365 Per User StoreAzure + DataStax Enterprise (DSE) Powers Office365 Per User Store
Azure + DataStax Enterprise (DSE) Powers Office365 Per User Store
DataStax Academy
 
DAY1- DAY2Netweaver gateway
DAY1- DAY2Netweaver gatewayDAY1- DAY2Netweaver gateway
DAY1- DAY2Netweaver gatewayGaurav Ahluwalia
 
stupid-simple-kubernetes-final.pdf
stupid-simple-kubernetes-final.pdfstupid-simple-kubernetes-final.pdf
stupid-simple-kubernetes-final.pdf
DaniloQueirozMota
 
Introduction to MANTL Data Platform
Introduction to MANTL Data PlatformIntroduction to MANTL Data Platform
Introduction to MANTL Data Platform
Cisco DevNet
 
Deploy prometheus on kubernetes
Deploy prometheus on kubernetesDeploy prometheus on kubernetes
Deploy prometheus on kubernetes
Cloud Technology Experts
 
Containerized Storage for Containers
Containerized Storage for ContainersContainerized Storage for Containers
Containerized Storage for Containers
Murat Karslioglu
 
Containerized Storage for Containers
Containerized Storage for ContainersContainerized Storage for Containers
Containerized Storage for Containers
OpenEBS
 
Multi-Tenancy
Multi-TenancyMulti-Tenancy
Multi-Tenancy
Halil İbrahim Kalkan
 
Understanding Platform as a Service
Understanding Platform as a ServiceUnderstanding Platform as a Service
Understanding Platform as a Service
Paul Fremantle
 
Seven Criteria for Building an AWS Global Transit Network
Seven Criteria for Building an AWS Global Transit NetworkSeven Criteria for Building an AWS Global Transit Network
Seven Criteria for Building an AWS Global Transit Network
Khash Nakhostin
 
See Inside the Middleware Black Box
See Inside the Middleware Black Box See Inside the Middleware Black Box
See Inside the Middleware Black Box
CA Technologies
 
modern-guide-to-container-monitoring-and-orchestration.pdf
modern-guide-to-container-monitoring-and-orchestration.pdfmodern-guide-to-container-monitoring-and-orchestration.pdf
modern-guide-to-container-monitoring-and-orchestration.pdf
Guillaume Kpotufe
 
Ymens - Bouncing off clouds - Rapid Development for Cloud Ready Applications...
Ymens - Bouncing off clouds - Rapid Development for Cloud Ready Applications...Ymens - Bouncing off clouds - Rapid Development for Cloud Ready Applications...
Ymens - Bouncing off clouds - Rapid Development for Cloud Ready Applications...
Vlad Mihnea
 
RTI Connext 5.2.0
RTI Connext 5.2.0RTI Connext 5.2.0
RTI Connext 5.2.0
Jan Van Bruaene
 

Similar to NATS: Control Flow for Distributed Systems (20)

MuleSoft Meetup Singapore #8 March 2021
MuleSoft Meetup Singapore #8 March 2021MuleSoft Meetup Singapore #8 March 2021
MuleSoft Meetup Singapore #8 March 2021
 
MuleSoft Surat Virtual Meetup#18 - Persistent Queue, Object Store and Persist...
MuleSoft Surat Virtual Meetup#18 - Persistent Queue, Object Store and Persist...MuleSoft Surat Virtual Meetup#18 - Persistent Queue, Object Store and Persist...
MuleSoft Surat Virtual Meetup#18 - Persistent Queue, Object Store and Persist...
 
Sf bay area Kubernetes meetup dec8 2016 - deployment models
Sf bay area Kubernetes meetup dec8 2016 - deployment modelsSf bay area Kubernetes meetup dec8 2016 - deployment models
Sf bay area Kubernetes meetup dec8 2016 - deployment models
 
Cloud by dev
Cloud by devCloud by dev
Cloud by dev
 
RTBkit Meetup - Developer Spotlight, Behind the Scenes of RTBkit and Intro to...
RTBkit Meetup - Developer Spotlight, Behind the Scenes of RTBkit and Intro to...RTBkit Meetup - Developer Spotlight, Behind the Scenes of RTBkit and Intro to...
RTBkit Meetup - Developer Spotlight, Behind the Scenes of RTBkit and Intro to...
 
Who's Who in Container Land
Who's Who in Container LandWho's Who in Container Land
Who's Who in Container Land
 
Azure + DataStax Enterprise (DSE) Powers Office365 Per User Store
Azure + DataStax Enterprise (DSE) Powers Office365 Per User StoreAzure + DataStax Enterprise (DSE) Powers Office365 Per User Store
Azure + DataStax Enterprise (DSE) Powers Office365 Per User Store
 
DAY1- DAY2Netweaver gateway
DAY1- DAY2Netweaver gatewayDAY1- DAY2Netweaver gateway
DAY1- DAY2Netweaver gateway
 
stupid-simple-kubernetes-final.pdf
stupid-simple-kubernetes-final.pdfstupid-simple-kubernetes-final.pdf
stupid-simple-kubernetes-final.pdf
 
Introduction to MANTL Data Platform
Introduction to MANTL Data PlatformIntroduction to MANTL Data Platform
Introduction to MANTL Data Platform
 
Deploy prometheus on kubernetes
Deploy prometheus on kubernetesDeploy prometheus on kubernetes
Deploy prometheus on kubernetes
 
Containerized Storage for Containers
Containerized Storage for ContainersContainerized Storage for Containers
Containerized Storage for Containers
 
Containerized Storage for Containers
Containerized Storage for ContainersContainerized Storage for Containers
Containerized Storage for Containers
 
Multi-Tenancy
Multi-TenancyMulti-Tenancy
Multi-Tenancy
 
Understanding Platform as a Service
Understanding Platform as a ServiceUnderstanding Platform as a Service
Understanding Platform as a Service
 
Seven Criteria for Building an AWS Global Transit Network
Seven Criteria for Building an AWS Global Transit NetworkSeven Criteria for Building an AWS Global Transit Network
Seven Criteria for Building an AWS Global Transit Network
 
See Inside the Middleware Black Box
See Inside the Middleware Black Box See Inside the Middleware Black Box
See Inside the Middleware Black Box
 
modern-guide-to-container-monitoring-and-orchestration.pdf
modern-guide-to-container-monitoring-and-orchestration.pdfmodern-guide-to-container-monitoring-and-orchestration.pdf
modern-guide-to-container-monitoring-and-orchestration.pdf
 
Ymens - Bouncing off clouds - Rapid Development for Cloud Ready Applications...
Ymens - Bouncing off clouds - Rapid Development for Cloud Ready Applications...Ymens - Bouncing off clouds - Rapid Development for Cloud Ready Applications...
Ymens - Bouncing off clouds - Rapid Development for Cloud Ready Applications...
 
RTI Connext 5.2.0
RTI Connext 5.2.0RTI Connext 5.2.0
RTI Connext 5.2.0
 

More from Apcera

Gopher fest 2017: Adding Context To NATS
Gopher fest 2017: Adding Context To NATSGopher fest 2017: Adding Context To NATS
Gopher fest 2017: Adding Context To NATS
Apcera
 
How Clarifai uses NATS and Kubernetes for Machine Learning
How Clarifai uses NATS and Kubernetes for Machine LearningHow Clarifai uses NATS and Kubernetes for Machine Learning
How Clarifai uses NATS and Kubernetes for Machine Learning
Apcera
 
Modernizing IT in the Platform Era
Modernizing IT in the Platform EraModernizing IT in the Platform Era
Modernizing IT in the Platform Era
Apcera
 
Debugging Network Issues
Debugging Network IssuesDebugging Network Issues
Debugging Network Issues
Apcera
 
IT Modernization Doesn’t Mean You Leave Your Legacy Apps Behind
IT Modernization Doesn’t Mean You Leave Your Legacy Apps BehindIT Modernization Doesn’t Mean You Leave Your Legacy Apps Behind
IT Modernization Doesn’t Mean You Leave Your Legacy Apps Behind
Apcera
 
Simple and Scalable Microservices: Using NATS with Docker Compose and Swarm
Simple and Scalable Microservices: Using NATS with Docker Compose and SwarmSimple and Scalable Microservices: Using NATS with Docker Compose and Swarm
Simple and Scalable Microservices: Using NATS with Docker Compose and Swarm
Apcera
 
The Zen of High Performance Messaging with NATS
The Zen of High Performance Messaging with NATSThe Zen of High Performance Messaging with NATS
The Zen of High Performance Messaging with NATS
Apcera
 
Implementing Microservices with NATS
Implementing Microservices with NATSImplementing Microservices with NATS
Implementing Microservices with NATS
Apcera
 
Actor Patterns and NATS - Boulder Meetup
Actor Patterns and NATS - Boulder MeetupActor Patterns and NATS - Boulder Meetup
Actor Patterns and NATS - Boulder Meetup
Apcera
 
Simple Solutions for Complex Problems - Boulder Meetup
Simple Solutions for Complex Problems - Boulder MeetupSimple Solutions for Complex Problems - Boulder Meetup
Simple Solutions for Complex Problems - Boulder Meetup
Apcera
 
Patterns for Asynchronous Microservices with NATS
Patterns for Asynchronous Microservices with NATSPatterns for Asynchronous Microservices with NATS
Patterns for Asynchronous Microservices with NATS
Apcera
 
NATS vs HTTP
NATS vs HTTPNATS vs HTTP
NATS vs HTTP
Apcera
 
Micro on NATS - Microservices with Messaging
Micro on NATS - Microservices with MessagingMicro on NATS - Microservices with Messaging
Micro on NATS - Microservices with Messaging
Apcera
 
Simple Solutions for Complex Problems
Simple Solutions for Complex Problems Simple Solutions for Complex Problems
Simple Solutions for Complex Problems
Apcera
 
KURMA - A Containerized Container Platform - KubeCon 2016
KURMA - A Containerized Container Platform - KubeCon 2016KURMA - A Containerized Container Platform - KubeCon 2016
KURMA - A Containerized Container Platform - KubeCon 2016
Apcera
 
Kubernetes, The Day After
Kubernetes, The Day AfterKubernetes, The Day After
Kubernetes, The Day After
Apcera
 
Policy-based Cloud Storage: Persisting Data in a Multi-Site, Multi-Cloud World
Policy-based Cloud Storage: Persisting Data in a Multi-Site, Multi-Cloud WorldPolicy-based Cloud Storage: Persisting Data in a Multi-Site, Multi-Cloud World
Policy-based Cloud Storage: Persisting Data in a Multi-Site, Multi-Cloud World
Apcera
 
Integration Patterns for Microservices Architectures
Integration Patterns for Microservices ArchitecturesIntegration Patterns for Microservices Architectures
Integration Patterns for Microservices Architectures
Apcera
 
Microservices: Notes From The Field
Microservices: Notes From The FieldMicroservices: Notes From The Field
Microservices: Notes From The Field
Apcera
 
Docker + App Container = ocp
Docker + App Container = ocpDocker + App Container = ocp
Docker + App Container = ocp
Apcera
 

More from Apcera (20)

Gopher fest 2017: Adding Context To NATS
Gopher fest 2017: Adding Context To NATSGopher fest 2017: Adding Context To NATS
Gopher fest 2017: Adding Context To NATS
 
How Clarifai uses NATS and Kubernetes for Machine Learning
How Clarifai uses NATS and Kubernetes for Machine LearningHow Clarifai uses NATS and Kubernetes for Machine Learning
How Clarifai uses NATS and Kubernetes for Machine Learning
 
Modernizing IT in the Platform Era
Modernizing IT in the Platform EraModernizing IT in the Platform Era
Modernizing IT in the Platform Era
 
Debugging Network Issues
Debugging Network IssuesDebugging Network Issues
Debugging Network Issues
 
IT Modernization Doesn’t Mean You Leave Your Legacy Apps Behind
IT Modernization Doesn’t Mean You Leave Your Legacy Apps BehindIT Modernization Doesn’t Mean You Leave Your Legacy Apps Behind
IT Modernization Doesn’t Mean You Leave Your Legacy Apps Behind
 
Simple and Scalable Microservices: Using NATS with Docker Compose and Swarm
Simple and Scalable Microservices: Using NATS with Docker Compose and SwarmSimple and Scalable Microservices: Using NATS with Docker Compose and Swarm
Simple and Scalable Microservices: Using NATS with Docker Compose and Swarm
 
The Zen of High Performance Messaging with NATS
The Zen of High Performance Messaging with NATSThe Zen of High Performance Messaging with NATS
The Zen of High Performance Messaging with NATS
 
Implementing Microservices with NATS
Implementing Microservices with NATSImplementing Microservices with NATS
Implementing Microservices with NATS
 
Actor Patterns and NATS - Boulder Meetup
Actor Patterns and NATS - Boulder MeetupActor Patterns and NATS - Boulder Meetup
Actor Patterns and NATS - Boulder Meetup
 
Simple Solutions for Complex Problems - Boulder Meetup
Simple Solutions for Complex Problems - Boulder MeetupSimple Solutions for Complex Problems - Boulder Meetup
Simple Solutions for Complex Problems - Boulder Meetup
 
Patterns for Asynchronous Microservices with NATS
Patterns for Asynchronous Microservices with NATSPatterns for Asynchronous Microservices with NATS
Patterns for Asynchronous Microservices with NATS
 
NATS vs HTTP
NATS vs HTTPNATS vs HTTP
NATS vs HTTP
 
Micro on NATS - Microservices with Messaging
Micro on NATS - Microservices with MessagingMicro on NATS - Microservices with Messaging
Micro on NATS - Microservices with Messaging
 
Simple Solutions for Complex Problems
Simple Solutions for Complex Problems Simple Solutions for Complex Problems
Simple Solutions for Complex Problems
 
KURMA - A Containerized Container Platform - KubeCon 2016
KURMA - A Containerized Container Platform - KubeCon 2016KURMA - A Containerized Container Platform - KubeCon 2016
KURMA - A Containerized Container Platform - KubeCon 2016
 
Kubernetes, The Day After
Kubernetes, The Day AfterKubernetes, The Day After
Kubernetes, The Day After
 
Policy-based Cloud Storage: Persisting Data in a Multi-Site, Multi-Cloud World
Policy-based Cloud Storage: Persisting Data in a Multi-Site, Multi-Cloud WorldPolicy-based Cloud Storage: Persisting Data in a Multi-Site, Multi-Cloud World
Policy-based Cloud Storage: Persisting Data in a Multi-Site, Multi-Cloud World
 
Integration Patterns for Microservices Architectures
Integration Patterns for Microservices ArchitecturesIntegration Patterns for Microservices Architectures
Integration Patterns for Microservices Architectures
 
Microservices: Notes From The Field
Microservices: Notes From The FieldMicroservices: Notes From The Field
Microservices: Notes From The Field
 
Docker + App Container = ocp
Docker + App Container = ocpDocker + App Container = ocp
Docker + App Container = ocp
 

Recently uploaded

How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 

Recently uploaded (20)

How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 

NATS: Control Flow for Distributed Systems

  • 1. NATS: Control Flow for Distributed Systems
  • 2. Focus © 2015 Bridgevine. All Rights reserved. December 9, 2015 2
  • 3. The Transaction Engine © 2015 Bridgevine. All Rights reserved. December 9, 2015 3
  • 4. © 2015 Bridgevine. All Rights reserved. December 9, 2015 4 Engine speak We refer to the outer circles as components, you’ll see that term later... Recently started referring to the center as the “queue”. It’s a combination of NATS and Elasticsearch. More on this later too... Elasticsearch is also the store used by History Recorder and the Cache components. Since everything communicates by messages, we wanted to use the same message struct format but retain flexibility for the different types of information the system will pass...
  • 5. Find your center © 2015 Bridgevine. All Rights reserved. December 9, 2015 5
  • 6. © 2015 Bridgevine. All Rights reserved. December 9, 2015 6 The Msg Struct We share by communicating via a single Msg struct. We’ve evolved to this format, but expect more changes. Could end up going with a “net/context” approach, but must retain compiler advantages. interface{} and []byte type overuse is disadvantageous.
  • 7. © 2015 Bridgevine. All Rights reserved. December 9, 2015 7 Pub/Sub Queue - NATS http://nats.io/ Love the performance focus. Major reason for selection. Love the simplicity. Using standard messaging for config updates Want all instances of an API to get the update Message Queueing Only want one instance of component to process. Employed in request/reply processing. Avoids duplicate logging.
  • 8. © 2015 Bridgevine. All Rights reserved. December 9, 2015 8 Central Storage Engine - Elasticsearch https://www.elastic.co/products/elasticsearch Initially selected for components providing search functionality. Flexibility allows for a variety of use cases. Used as the key/value store companion to NATS for storing message payloads. Want to keep the NATS messages small.
  • 9. NATS Msg © 2015 Bridgevine. All Rights reserved. December 9, 2015 9
  • 10. © 2015 Bridgevine. All Rights reserved. December 9, 2015 10 NATS Msg struct We will be referring to NATS Msg fields of Subject and Reply in the next few slides… Here’s what the struct looks like. Our Msg struct ends up being encrypted and stored in the Data field in the NATS Msg. We don’t really deal directly with the NATS Msg too much. Client API methods are there to handle the construction of this struct, but you can do it yourself too. https://github.com/nats-io/nats/blob/master/nats.go#L1323
  • 11. Request/Reply © 2015 Bridgevine. All Rights reserved. December 9, 2015 11
  • 12. © 2015 Bridgevine. All Rights reserved. December 9, 2015 12 Request/Reply Steps Origin first subscribes to the reply subject it’s about to ask for. Important to do this first. Origin publishes message with a reply subject. The reply subject should be a unique string. https://github.com/nats-io/nats/blob/master/nats.go#L1357 Subscriber replies to origin by using origin’s msg.Reply as msg.Subject in the message it publishes. Origin will receive the message. That’s it. Go client simplifies this with Request method. https://github.com/nats-io/nats/blob/master/nats.go#L1337
  • 13. Forwarding © 2015 Bridgevine. All Rights reserved. December 9, 2015 13
  • 14. © 2015 Bridgevine. All Rights reserved. December 9, 2015 14 Origin Step 1 Step 2 Forwarding Steps Origin subscribes to reply subject. Important to do this first. Origin then publishes Request/Reply message. Step 1 Receives message and produces result. Step 1 Publishes message with new subject and uses same reply as the message from Origin. Step 2 Receives message, processes and publishes using reply from Step 1’s message as subject. Origin will receive the message from Step 2.
  • 15. Subscribe/QueueSubscribe © 2015 Bridgevine. All Rights reserved. December 9, 2015 15
  • 16. © 2015 Bridgevine. All Rights reserved. December 9, 2015 16 Subscribe when all subscribers should receive the message. https://github.com/nats-io/nats/blob/master/nats.go#L1399 Configuration updates drive this use case. QueueSubscribe when only one of the subscribers should receive the message. https://github.com/nats-io/nats/blob/master/nats.go#L1412 So far...everything else/ Limit processing to one instance of a component in a load balanced environment.
  • 17. Combo Time! © 2015 Bridgevine. All Rights reserved. December 9, 2015 17
  • 18. © 2015 Bridgevine. All Rights reserved. December 9, 2015 18 Combos are good! Publish + Subscribe Send configuration update to all instances of a component. Request/Reply + QueueSubscribe Can’t control subscribing from publishing side. Use QueueSubscribe to have only one instance of a component process the request. Request/Reply + QueueSubscribe + Forwarding Start with initial processing component. Forward message to continue processing Select components like “Provider Interfaces” always forward. Select components like “Rules Engine” always reply. Some depend on subject.
  • 19. Timeouts © 2015 Bridgevine. All Rights reserved. December 9, 2015 19
  • 20. © 2015 Bridgevine. All Rights reserved. December 9, 2015 20 “NATS is a fire-and-forget messaging system. If you need higher levels of service, you build it into the client” - http://nats.io/documentation/concepts/nats-pub-sub/ Multiple levels of timeouts to provide higher level of service. Originating request timeout - overall time we will wait before responding to requestor. During requests involving multiple responses - time to return regardless of the response percentage. Must be less than request timeout. Processing timeouts - ensure we kill long running processes. These timeouts will be longer than transaction timeouts. Allows us to still gather data without hastily throwing away information. We may need to dynamically adjust to external conditions. If a provider is experiencing latency issues, it may make more sense to wait a bit longer than lose orders.
  • 21. Queue © 2015 Bridgevine. All Rights reserved. December 9, 2015 21
  • 22. © 2015 Bridgevine. All Rights reserved. December 9, 2015 22 The rather obvious (now) ... Wanted to do logging via NATS and started with a dedicated logging package. Quickly realized this could/should be simplified. All components use NATS for communication already and wanted logging done via NATS. Was it as simple as adding a Log method to our NATS pub/sub code? Wanted to log the interaction with the central data store. Store, Load, Delete Wanted to keep messages small. Need to provide consumers with a stable API. Would like to tune cache use without major refactoring efforts.
  • 23. The birth of Queue Interfaces are good. Queue should define the interfaces it would need implementations for to provide Messaging and Caching functionality. Instance of Queue could be created with references to concrete types satisfying the interface. Concerns that were once combined got their own identity. The Msg struct was now in its own repo and also defined Msg Handler type. Things are making sense. The NATS and Elasticsearch repos provided simple wrappers to client libs. Don’t want to expose Clients to components. © 2015 Bridgevine. All Rights reserved. December 9, 2015 23
  • 24. © 2015 Bridgevine. All Rights reserved. December 9, 2015 24 Queue interface definitions
  • 25. © 2015 Bridgevine. All Rights reserved. December 9, 2015 25 Queue API Request, Publish, Subscribe, Load, Store, Delete, Log Don’t force the consumers of the API to do what must be done: Request, Publish Store payload. Set CacheKey on Msg. Request, Subscribe, QueueSubscribe If CacheKey present, retrieves payload from Cache Add Payload to CacheData on Msg. Load, Store, Delete Log these events Log Use runtime.FuncForPC to get caller information
  • 26. Close down © 2015 Bridgevine. All Rights reserved. December 9, 2015 26
  • 27. © 2015 Bridgevine. All Rights reserved. December 9, 2015 27 Would like to ultimately open source Queue and other potentially useful packages. Have already started contributing back with some open source projects: https://github.com/Bridgevine/soap https://github.com/Bridgevine/http https://github.com/Bridgevine/xml Help us build this and more? More info on what we are building... Bridgevine Company Website Open Positions Thank you! If you have questions: andy.stone@bridgevine.com or @stonean