Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Moving to production

Moving to production

Avatar for Fabian Król

Fabian Król

August 05, 2016

Other Decks in Programming

Transcript

  1. project • simple proxy: chat window <—> main chat server

    • http <—> protobuf • rewrite existing component
  2. traffic requirements • 6M req/min • 700M MAU • 1.9

    Gbps (95 percentile) • 3 Gbps DDoS
  3. it’s ready • 9 months of development • 1 student

    • 204 commits • 9260 insertions(+)
  4. #1: test • from • no tests • to •

    few unit test for critical functions • public api integration testing • CI on every commit (travis)
  5. #2: release • release quick and release often • independent

    builds • easy to track • easy to rebuild old versions • one line deployment • master + develop + build from tag
  6. #4: monitoring • system level monitoring (erld) • erlang vm

    is not really unix-friendly • zabbix • os level monitoring • app level alerting • graphite • app level metrics
  7. how to replace existing system • step 1: 2% of

    traffic with sticky session • •
  8. how to replace existing system • step 1: 2% of

    traffic with sticky session • step 2: 2% of traffic without sticky session •
  9. how to replace existing system • step 1: 2% of

    traffic with sticky session • step 2: 2% of traffic without sticky session • step 3: 0% of traffic for 1.5 month
  10. - PreparedBody = re:replace(lists:droplast(Body), "\"", "\\\\\"", [global]), + Body1 =

    lists:droplast(Body), + Body2 = re:replace(Body1, "\\\\", "\\\\\\\\", [global]), + PreparedBody = re:replace(Body2, "\"", "\\\\\"", [global]),
  11. hosts • hardware √ | cloud • virtualization √ |

    bare metal • 4 √ | 8 | 16 | 32 cpus
  12. hosts: tunning • hardware √ | cloud • virtualization |

    bare metal √ • 4 | 8 √ | 16 | 32 cpus
  13. hardware comparison • 1.3x more cpus to handle traffic •

    (we can go up to 1.16) • memory is not important
  14. erlang pros • it’s easy to write code • small

    codebase • it’s easy to collect metric (?) • it allows to debug and trace on live production host
  15. schedulers • one per vm thread (one per cpu) •

    does it owns memory management • reductions: • process is re-scheduled after N reductions • no process can block the system
  16. ⚡