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

Scaling Django with Distributed Systems

Scaling Django with Distributed Systems

A talk I gave at PyCon Ukraine 2017.

Andrew Godwin

April 07, 2017
Tweet

More Decks by Andrew Godwin

Other Decks in Programming

Transcript

  1. If a request writes to a table it must be

    pinned there, so later reads do not get old data
  2. Both Users 0 - 2 Users 3 - 5 Users

    6 - 8 Users 9 - A Events 0 - 2 Events 3 - 5 Events 6 - 8 Events 9 - A Tickets 0 - 2 Tickets 3 - 5 Tickets 6 - 8 Tickets 9 - A
  3. Both plus caching Users 0 - 2 Users 3 -

    5 Users 6 - 8 Users 9 - A Events 0 - 2 Events 3 - 5 Events 6 - 8 Events 9 - A Tickets 0 - 2 Tickets 3 - 5 Tickets 6 - 8 Tickets 9 - A User Cache Event Cache Ticket Cache
  4. Users 0 - 2 Users 3 - 5 Users 6

    - 8 Users 9 - A Events 0 - 2 Events 3 - 5 Events 6 - 8 Events 9 - A Tickets 0 - 2 Tickets 3 - 5 Tickets 6 - 8 Tickets 9 - A User Cache Event Cache Ticket Cache User Service Event Service Ticket Service
  5. A single point of failure is not always bad -

    if the alternative is multiple, fragile ones
  6. Failure Mode At most once Messages either do not arrive,

    or arrive once. At least once Messages arrive once, or arrive multiple times
  7. Guarantees vs. Latency Low latency Messages arrive very quickly but

    go missing more Low loss rate Messages are almost never lost but arrive slower
  8. Queuing Type First In First Out Consistent performance for all

    users First In Last Out Hides backlogs but makes them worse