Slide 1

Slide 1 text

Gustavo Pantuza Microservices Challenges

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

Agenda Context Considerations Use cases

Slide 4

Slide 4 text

Monolith

Slide 5

Slide 5 text

Monolith ● Big code base ● Difficult to scale ● Easy to monitor/troubleshoot ● Many responsibilities ● Complex to deploy

Slide 6

Slide 6 text

microservice

Slide 7

Slide 7 text

Microservice ● Small code base ● Single responsibility ● Complex to troubleshoot ● Complex to monitor ● Easier to test and deploy

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

Microservices challenges Step 1 Application example Step 2 Show a problem Step 3 Propose a solution

Slide 11

Slide 11 text

Circuit breaker Step 1

Slide 12

Slide 12 text

Step 2 If the microservices I integrate fail, how can I guarantee my authentication system? Circuit breaker

Slide 13

Slide 13 text

Step 3 If x% of failure send emails to guarantee authentication Circuit breaker

Slide 14

Slide 14 text

Scale Step 1

Slide 15

Slide 15 text

Scale Step 2 How to increase load without saturate computational resources?

Slide 16

Slide 16 text

Scale Step 3 Horizontal auto scale CPU: 50% CPU: 95% CPU: 85% CPU: 50% CPU: 50%

Slide 17

Slide 17 text

Scale Step 3 $> kubectl autoscale \ deployment php-apache \ --cpu-percent=50 \ --min=1 \ --max=10

Slide 18

Slide 18 text

Freshness Step 1

Slide 19

Slide 19 text

Step 2 Content must be updated and ever been shown to end users Freshness

Slide 20

Slide 20 text

Step 3 Cache pipeline Proactive purge Freshness

Slide 21

Slide 21 text

Passo 1 Integration

Slide 22

Slide 22 text

Passo 2 Integration How to add new applications without changing my previous services?

Slide 23

Slide 23 text

Passo 3 Integration ● APIs Agregation ● Enforce availability on BFF BFF - Backend for Front-end

Slide 24

Slide 24 text

Reliability Step 1 API

Slide 25

Slide 25 text

Step 2 If my service becomes unavailable what my clients should do? Reliability

Slide 26

Slide 26 text

Step 3 Retry Backoff Cache Reliability

Slide 27

Slide 27 text

Capacity Step 1 Varnish

Slide 28

Slide 28 text

Capacity Step 2 As traffic grows system starts paginating and denying connections

Slide 29

Slide 29 text

User space Capacity Step 3 Turn off swap TCP/IP tuning Kernel space Operating system Tuning . swapoff --all . sysctl -w net.ipv4.tcp_fin_timeout=15

Slide 30

Slide 30 text

Monitoring Step 1

Slide 31

Slide 31 text

Monitoring Step 2 How to minimize failure detection and recovery time?

Slide 32

Slide 32 text

Monitoring Step 3 ● Zabbix ● cachet Feedback system ● Prometheus ● Graylog

Slide 33

Slide 33 text

Design Step 1

Slide 34

Slide 34 text

Step 2 Software changes should not impact all clients Design

Slide 35

Slide 35 text

Step 3 Tenants Design USD BRL EUR . Extensibility . Customizable

Slide 36

Slide 36 text

Communication Step 1 APIs

Slide 37

Slide 37 text

Passo 2 How to compute votes and minimize response time? Communication

Slide 38

Slide 38 text

Passo 3 Buffer in memory 1000 votes or 10 seconds ... Communication

Slide 39

Slide 39 text

Distribution Step 1

Slide 40

Slide 40 text

Distribution Step 2 How to avoid a single point of failure?

Slide 41

Slide 41 text

Distribution Step 1 Application distribution over network PoDs

Slide 42

Slide 42 text

Availability Step 1 A B C D E F G H Application servers/containers

Slide 43

Slide 43 text

Availability Step 2 How to evenly distribute load over all application servers/containers?

Slide 44

Slide 44 text

Availability Step 3 Load balancing A B C D E F G H ● IPVS ● Neutrino ● HAProxy ● Nginx L4 L7

Slide 45

Slide 45 text

DRY Step 1 A B C D Authentication Authorization

Slide 46

Slide 46 text

Step 2 How to avoid repeating computations on many services? DRY

Slide 47

Slide 47 text

Step 3 API Gateway DRY A B C D G Kong HQ

Slide 48

Slide 48 text

Step 1 Interfaces { "what": "A json example", "test": true, "values": [42, 10, 5.32], "data": { "name": "Test Name", "type": null } }

Slide 49

Slide 49 text

Step 2 How to change my services contracts without breaking my clients integration? Interfaces

Slide 50

Slide 50 text

Step 3 Generic and versioned Interfaces Interfaces . JSON Schema . ProtoBuffers /* Proto Buffers */ message Example { string what = 1; boolean test = 2; repeated int32 values = 3; optional DataMessage data = 4; } message DataMessage { string name = 1; optional string type = 2; }

Slide 51

Slide 51 text

Step 1 Networking

Slide 52

Slide 52 text

Step 2 How to deploy multiple microservices clusters and do not collide sub-networks? Networking

Slide 53

Slide 53 text

Step 3 Overlay networking . KubeRouter . VXLAN . Open vSwitch . IPIP tunnel . GRE Networking Subnet: 10.0.10.0/24 Subnet: 10.0.10.0/24 vRouter: 192.168.0.100/32 vRouter: 192.168.0.200/32

Slide 54

Slide 54 text

Step 1 Filtering Host Hypervisor VMs

Slide 55

Slide 55 text

Step 2 How to filter traffic without overloading network equipments? Filtering

Slide 56

Slide 56 text

Step 3 Software Defined Networking . Open vSwitch . Netfilter/IP tables Filtering Host Hypervisor VMs OvS

Slide 57

Slide 57 text

Step 1 A B C D Tracing

Slide 58

Slide 58 text

Step 2 How to know which service has failed? Tracing

Slide 59

Slide 59 text

Step 3 Tracing X-Request-ID GET /myservice/myresource HTTP/1.1 Host: myservername X-Request-ID: 30f14c6c1fc85cba12bfd093aa8f90e3 Accept: */* A B C D Request Identification

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

Questions? https://blog.pantuza.com https://github.com/pantuza https://twitter.com/gpantuza