SETH VARGO
SERVICE
ORIENTED
SOA PRIMER
Autonomous
Limited Scope
ORDER
PROCESSING
WEB APP
HISTORY
ORDER
ORDER
PROCESSING
WEB APP
DISCOVERY
ORDER
PROCESSING
WEB APP
LOAD BALANCING
How to ensure request leveling across providers?
NODE 1 NODE 2 NODE N
ORDER
PROCESSING
WEB APP
ANTI-‐PATTERN
Load Balancer is a Single Point of Failure (SPOF)
NODE 1 NODE 2 NODE N LOAD
ORDER
PROCESSING
WEB APP
HEALTH CHECKING
How to avoid routing to unhealthy hosts?
NODE 1 NODE 2 NODE 3 LOAD
WEB APP
CONFIGURATION
How to efficiently push dynamic configuration?
WEB 1 WEB 2 WEB N maintenance: false feature_a: true role: "web"
SERVICE
DISCOVERY BALANCINGLOAD CHECKINGHEALTH CONFIGURATIONKEY-‐VALUE
ZOOKEEPER ETCD SENSU SMART STACK
EXISTING "SOLUTIONS"
Service Discovery
HTTP + DNS
; <<>> DiG 9.8.3-P1 <<>> web-frontend.service.consul. ANY ;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29981
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;web-frontend.service.consul. IN ANY ;; ANSWER SECTION: web-frontend.service.consul. 0 IN A 10.0.3.83 web-frontend.service.consul. 0 IN A 10.0.1.109
CLIENT CLIENT CLIENT CLIENT CLIENT CLIENT
SERVER SERVER SERVER
REPLICATION REPLICATION
RPC
RPC LAN GOS
CLIENT CLIENT CLIENT CLIENT CLIENT CLIENT
SERVER SERVER SERVER
REPLICATION REPLICATION RPC RPC LAN GOS SIP SERVER SERVER SERVER REPLICATION REPLICATION
CLIENT CLIENT CLIENT CLIENT CLIENT CLIENT
SERVER SERVER SERVER
REPLICATION REPLICATION RPC RPC LAN GOS SIP SERVER SERVER SERVER REPLICATION REPLICATION
Host & Service
> listen http-in bind *:8000 server web-0 127.0.0.1:80 server web-1 127.0.0.1:80 server web-2 127.0.0.1:80
demo master consul-template -template="example.ctmpl" -dry
> listen http-in bind *:8000 server web-0 127.0.0.1:80 server web-1 127.0.0.1:80 server web-2 127.0.0.1:80
demo master consul-template -template="example.ctmpl" -dry
>
listen http-in bind *:8000
server web-1 127.0.0.1:80 server web-2 127.0.0.1:80
demo master consul-template -template="example.ctmpl" -dry
> listen http-in bind *:8000 server web-0 127.0.0.1:80 server web-1 127.0.0.1:80 server web-2 127.0.0.1:80
demo master consul-template -template="example.ctmpl" -dry
K/V Store
HTTP API
true
true
demo master curl -X PUT -d 'bar' http://localhost:8500/v1/kv/foo
[ { "CreateIndex": 100, "ModifyIndex": 200, "Key": "foo", "Flags": 0, "Value": "YmFy" } ]
HEALTH
CHECKS
WHAT IS A CHECK?
WHAT IS A CHECK?
Any command that returns an exit code
0
PASSING1
WARNING__
FAILINGWHAT IS A CHECK?
Output is captured as a "note" for inspection
curl: (7) Failed to connect to 127.0.0.1 port 4455: Connection refused $ curl http://127.0.0.1:4455/_health
CREATING A CHECK
Use a custom script
{
"check": {
"id": "mem-util",
"name": "Memory utilization",
"script": "/usr/local/bin/check_mem.py", "interval": "10s"
} }
CREATING A CHECK
Use a built-in check type
{
"check": {
"id": "api",
"name": "HTTP API on port 4455",
"http": "http://localhost:4455/_health", "interval": "10s",
"timeout": "1s" }
MONITORING
SERVICE
TRADITIONAL MONITORING
Pushes information into a silo
WEB 1 WEB 2 WEB N
MONITORING
SERVICE
TRADITIONAL MONITORING
Pushes information into a silo
WEB 1 WEB 2 WEB N
MONITORING
SERVICE
TRADITIONAL MONITORING
Pushes information into a silo
WEB 1 WEB 2 WEB N
MONITORING
SERVICE
TRADITIONAL MONITORING
Pushes information into a silo
WEB 1 WEB 2 WEB N
MONITORING
SERVICE
TRADITIONAL MONITORING
Pushes information into a silo
WEB 1 WEB 2 WEB N
MONITORING
SERVICE
TRADITIONAL MONITORING
Pushes information into a silo
WEB 1 WEB 2 WEB N
U
MONITORING
SERVICE
TRADITIONAL MONITORING
Pushes information into a silo
WEB 1 WEB 2 WEB N
U
CONSUL
CONSUL MONITORING
Removes unhealthy nodes from service discovery layer
WEB 1 WEB 2 WEB N
CONSUL
CONSUL MONITORING
Removes unhealthy nodes from service discovery layer
WEB 1 WEB 2 WEB N
CONSUL
CONSUL MONITORING
Removes unhealthy nodes from service discovery layer
WEB 1 WEB 2 WEB N dig web.service.consul 10.0.1.4 10.0.1.5 10.0.1.6
CONSUL
CONSUL MONITORING
Removes unhealthy nodes from service discovery layer
WEB 1 WEB 2 WEB N dig web.service.consul 10.0.1.4 10.0.1.5 10.0.1.6
CONSUL
CONSUL MONITORING
Removes unhealthy nodes from service discovery layer
WEB 1 WEB 2 WEB N dig web.service.consul 10.0.1.5 10.0.1.6
CONSUL
CONSUL MONITORING
Removes unhealthy nodes from service discovery layer
WEB 1 WEB 2 WEB N dig web.service.consul 10.0.1.5 10.0.1.6 host: web.service.consul
CONSUL
CONSUL MONITORING
Removes unhealthy nodes from service discovery layer
WEB 1 WEB 2 WEB N dig web.service.consul 10.0.1.5 10.0.1.6 host: web.service.consul
CONSUL
CONSUL MONITORING
Removes unhealthy nodes from service discovery layer
WEB 1 WEB 2 WEB N dig web.service.consul 10.0.1.5 10.0.1.6 host: web.service.consul
CONSUL
CONSUL MONITORING
Removes unhealthy nodes from service discovery layer
WEB 1 WEB 2 WEB N dig web.service.consul 10.0.1.5 10.0.1.6 host: web.service.consul
CONSUL
CONSUL MONITORING
Removes unhealthy nodes from service discovery layer
WEB 1 WEB 2 WEB N dig web.service.consul 10.0.1.4 10.0.1.5 10.0.1.6 host: web.service.consul
CONSUL MONITORING
Unhealthy nodes are not returned from DNS queries
CONSUL MONITORING
Unhealthy nodes are not returned from HTTP API
CONSUL LOCK
Allows for a new kind of "HA"
CONSUL LOCK
Making standby HA much simpler
CONSUL
VAULT 1 VAULT 2 VAULT 3
CONSUL LOCK
Making standby HA much simpler
CONSUL
VAULT 1 VAULT 2 VAULT 3L
L
CONSUL LOCK
Making standby HA much simpler
CONSUL
VAULT 1 VAULT 2 VAULT 3
CONSUL LOCK
Making standby HA much simpler
CONSUL
VAULT 1 VAULT 2 VAULT 3L
LEADER ELECTION
CONSUL LOCK
Making standby HA much simpler
CONSUL
VAULT 1 VAULT 2 VAULT 3L
GET /secret/foo REQUESTCONSUL LOCK
Making standby HA much simpler
CONSUL
VAULT 1 VAULT 2 VAULT 3L
GET /secret/foo REQUESTCONSUL LOCK
Making standby HA much simpler
CONSUL
VAULT 1 VAULT 2 VAULT 3L
GET /secret/foo REQUESTCONSUL LOCK
Making standby HA much simpler
CONSUL
VAULT 1 VAULT 2 VAULT 3
CONSUL LOCK
Making standby HA much simpler
CONSUL
VAULT 1 VAULT 2 VAULT 3
CONSUL LOCK
Making standby HA much simpler
CONSUL
VAULT 1 VAULT 2
CONSUL LOCK
Making standby HA much simpler
CONSUL
VAULT 1 VAULT 2
CONSUL LOCK
Making standby HA much simpler
VAULT 1 VAULT 2 VAULT 3 GET /secret/foo REQUEST
CONSUL
L
CONSUL LOCK
Making standby HA much simpler
VAULT 1 VAULT 2 VAULT 3 GET /secret/foo REQUEST
CONSUL
L
CONSUL LOCK
CONSUL LOCK
MONITORING
SERVICE
TRADITIONAL MONITORING
Notifies/polls all statuses
WEB 1 WEB 2 WEB N
"I'm healthy"
"Good,
thanks for a
MONITORING
SERVICE
TRADITIONAL MONITORING
Notifies/polls all statuses
WEB 1 WEB 2
WEB 1,000
1,000'S OF
REQUESTS
MONITORING
SERVICE
TRADITIONAL MONITORING
Notifies/polls all statuses
WEB 1 WEB 2 WEB 1,000
1,000'S OF
REQUESTS
HA
CONSUL
WEB 1 WEB 2 WEB N My status ha s changedCONSUL MONITORING
CONSUL
CONSUL MONITORING
Notifies on status changes
WEB 1 WEB 2
WEB 1,000
10'S OF
SERVICE
DISCOVERY BALANCINGLOAD CHECKINGHEALTH CONFIGURATIONKEY-‐VALUE
9
H
G
L
RESPONSIVE LEADER
ELECTION SEMAPHORE LOCKING SCALABLE