Page 1
High Performance Architecture Patterns
Celso Crivelaro @celsocrivelaro
Page 2
$ whoami > Celso Crivelaro- Engineer and MSc in Computer Engineering- Dev Ruby / Python / Java
@celsocrivelaro
http://crivelaro.me
Page 5
SMTP Locaweb- Transaction email platform- Fast and high quality email sending- Live reports- Integration by SMTP Protocol and HTTP API
- 2,5 Millions of messages per day- + 2 years
Page 12
High Availability
Page 13
Resource Consumption
Page 15
Disk
Memory
Band-width
Processor time
Logs
GC
Open Connections
Deadlocks
Stop all disk activities
Swap
Slowness
Services stop responding
Queues Amount Workers Slowness
Page 17
Integrations always fails!
Page 18
Integration Fails alwaysInternal
External
DB API Storage Network
API ISP HopCloud
Page 19
Map hidden integrations
E.g. DNS
Page 21
Failing Fast reduces transient errors
Page 23
Never trust in default timeouts
Page 24
Threads Timeouts to get rid of deadlocls
Internal Little timeout
External Depends: The least possible
Page 26
1 2 3 5 8 n
Fibonacci Proportion
...
Page 27
Isolate Critical Components
Page 28
Panel / API
Painel Web Internal API - HTTP
Resources
Connection Pool App Server Business
Rules Integrations
Page 29
App Internal APIApp Panel
Painel Web API - HTTP
Resources
Conn. Pool
App Server
Business Rules Integrations
Resources
Conn. Pool
App Server
Business Rules Integrations
Page 30
Less Components ==
Less Problems
Page 38
Availability
ConsistencyTolerance to network partition
Page 39
Availability
Consistency
Partition Tolerance to network partition
whether system is available or not
Page 40
Availability
ConsistencyTolerance to network partition
Same data in all nodes
Page 41
Availability
ConsistencyTolerance to network partition
Tolerante when a network fails
Page 42
Availability
Consistency Partition Tolerance
Postgres
Page 43
Availability
Consistency Partition Tolerance
DNS
Page 44
Availability
Consistency Partition Tolerance
Protocols
Page 45
Evaluate which one is acceptable to your
platform
Page 46
Pool of Resources
Page 47
App
Connection
Resource
Connection
Connection
Connection
Connection
Page 48
Controlled Timeouts
Controlled Resource Consumption
Avoid opening/closing connections overhead
Page 50
Make your data closer to your app
Page 51
When use cache
App API
DB
Page 52
Default Cache Strategy
App
Cache
Source
1
2
3
Page 53
Hot Cache Strategy
App Cache Source2 1
Page 55
LB
App
App
App
App
Page 56
Load Balance Strategy matters!
Page 57
Decoupled Architecture
Page 58
Slow Processing
Fast processing
Asynchronous Processing
Authentication Message Transformation MTA ProvidersUser
Message Persistence Consolidation
Page 59
Background jobs
Messaging frameworks
Page 60
How to discover bottlenecks?
Page 61
Test your limits...
Load Test
Stress Test
Peak Test
Page 64
Grafana + InfluxDB
Page 65
Other scalabity patterns
Page 72
http://use-the-index-luke.com
Page 74
Thank you!
Celso Crivelaro@celsocrivelaro
[email protected]