$30 off During Our Annual Pro Sale. View Details »

Microservices Challenges

Microservices Challenges

This presentation approaches many challenges moving forward Microservices

Gustavo Pantuza

April 01, 2019
Tweet

More Decks by Gustavo Pantuza

Other Decks in Programming

Transcript

  1. Gustavo Pantuza
    Microservices Challenges

    View Slide

  2. View Slide

  3. Agenda
    Context Considerations Use cases

    View Slide

  4. Monolith

    View Slide

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

    View Slide

  6. microservice

    View Slide

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

    View Slide

  8. View Slide

  9. View Slide

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

    View Slide

  11. Circuit breaker
    Step 1

    View Slide

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

    View Slide

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

    View Slide

  14. Scale
    Step 1

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  18. Freshness
    Step 1

    View Slide

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

    View Slide

  20. Step 3
    Cache pipeline
    Proactive purge
    Freshness

    View Slide

  21. Passo 1
    Integration

    View Slide

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

    View Slide

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

    View Slide

  24. Reliability
    Step 1
    API

    View Slide

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

    View Slide

  26. Step 3
    Retry Backoff Cache
    Reliability

    View Slide

  27. Capacity
    Step 1
    Varnish

    View Slide

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

    View Slide

  29. 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

    View Slide

  30. Monitoring
    Step 1

    View Slide

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

    View Slide

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

    View Slide

  33. Design
    Step 1

    View Slide

  34. Step 2
    Software changes should not
    impact all clients
    Design

    View Slide

  35. Step 3
    Tenants
    Design
    USD BRL EUR
    . Extensibility
    . Customizable

    View Slide

  36. Communication
    Step 1
    APIs

    View Slide

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

    View Slide

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

    View Slide

  39. Distribution
    Step 1

    View Slide

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

    View Slide

  41. Distribution
    Step 1
    Application distribution over network PoDs

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  45. DRY
    Step 1
    A B
    C D
    Authentication
    Authorization

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  50. 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;
    }

    View Slide

  51. Step 1
    Networking

    View Slide

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

    View Slide

  53. 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

    View Slide

  54. Step 1
    Filtering
    Host
    Hypervisor
    VMs

    View Slide

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

    View Slide

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

    View Slide

  57. Step 1
    A B
    C D
    Tracing

    View Slide

  58. Step 2
    How to know which service has failed?
    Tracing

    View Slide

  59. 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

    View Slide

  60. View Slide

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

    View Slide