6. Monolithic architecture problems
● Large codebase
● Hard to scale
● Redeploy the entire application on each update
● Bug in any module can potentially bring down the entire process
● Has a barrier to adopting new technologies
● Continuous deployment is difficult
14. SOA architecture problems
● Adds a complexity to the project
● Partitioned database architecture
● Difficult to implement changes that span multiple services
● Complex testing process
● Service discovery
● Configuration
● Deployment
15. SOA architecture problems
● Adds a complexity to the project
● Partitioned database architecture
● Difficult to implement changes that span multiple services
● Complex testing process
● Service discovery
● Configuration
● Deployment
16. Problem: Load Balancing
Shop app
Node 1
Node 2
Node 3
Orders service
Ensure that requests are balanced across instances
17. Solution: Load Balancer for internal services
Shop app
Node 1
Node 2
Node 3
Orders service
Loadbalancer
20. Problems with internal load balancers
Yet another infrastructure to run and maintain
Load grows with the numbers of service instances
Single point of failure
LB configuration management and reload
Require health probing
21. Solution: Consul
Consul is a distributed service mesh
to connect, secure, and configure
services across any runtime platform
and public or private cloud
26. Consul: DNS interface
$ dig @127.0.0.1 -p 8600 orders.service.consul
...
;; QUESTION SECTION:
;orders.service.consul. IN A
;; ANSWER SECTION:
orders.service.consul. 0 IN A 172.20.20.10
orders.service.consul. 0 IN A 172.20.20.11
orders.service.consul. 0 IN A 172.20.20.12
27. Consul: DNS interface
$ dig @127.0.0.1 -p 8600 orders.service.consul SRV
...
;; QUESTION SECTION:
;orders.service.consul. IN SRV
;; ANSWER SECTION:
orders.service.consul. SRV 1 1 8000 foobar-0.node.dc1.consul.
orders.service.consul. SRV 1 1 8001 foobar-2.node.dc1.consul.
orders.service.consul. SRV 1 1 8002 foobar-3.node.dc1.consul.
;; ADDITIONAL SECTION:
foobar-0.node.dc1.consul. 0 IN A 172.20.20.10
foobar-1.node.dc1.consul. 0 IN A 172.20.20.11
foobar-2.node.dc1.consul. 0 IN A 172.20.20.12
29. Service discovery and DNS
Zero touch integration with nearly any existing software
Look up as “orders.service.consul”
Shuffled results - ditch the load balancer
30. Failure detection
State of the world is as fresh as possible
Automatically pull failed instances out of service
Immediately put healthy new instances into service
37. Consul KV as a feature toggle
Write flag value to consul
$ consul kv put search/elastic true
38. Consul KV as a feature toggle
Read flag value from application
if consul.Get("search/elastic") == "true" {
// use elastic search
}
39. Consul KV as a feature toggle
Enables “dark mode” features
Easy way to disable without needing a code deploy
40.
41. Solution: Consul template
Retrieves keys and services from Consul and renders them into a template
$ consul-template -template "in.tpl:out.txt:command"
43. How it works
Consul template performs blocking query against the KV store
Stores the value in the file when key is updated
Runs the specified command after the update
49. Manual overrides
Override service address to “orders.service.eu.consul” or “172.30.20.10”
Not transparent
Need config fiddling and may need app restarts
50. Consul prepared queries
Centrally managed policies that allow dynamic behaviour for service lookups
without any knowledge from applications
Define which service to look up, and rules for what to do if none are not
available in the local datacenter
Can be executed via DNS or HTTP
52. Consul prepared query
$ dig @127.0.0.1 -p 8600 orders.query.consul
...
;; QUESTION SECTION:
;orders.query.consul. IN A
;; ANSWER SECTION:
orders.query.consul. 0 IN A 172.20.20.10
orders.query.consul. 0 IN A 172.20.20.11
orders.query.consul. 0 IN A 172.20.20.12
54. Consul prepared query: Name + tags
$ dig @127.0.0.1 -p 8600 master.db.query.consul
...
;; QUESTION SECTION:
;master.db.query.consul. IN A
;; ANSWER SECTION:
master.db.query.consul. 0 IN A 172.30.30.10
55. Single line config for geo failover
Local service discovery: “orders.service.consul”
Local + geo failover: “orders.query.consul”
75. Solution: Terraform
Terraform enables you to safely and
predictably create, change, and
improve infrastructure as code to
increase operator productivity and
transparency.
77. Terraform features
Configuration can be stored in version control, shared, and collaborated on by
teams of operators
Track the complete history of infrastructure versions
Manage resources across all major infrastructure providers (AWS, GCP, Azure,
DigitalOcean, OpenStack, VMware, and more)