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

Concurrency to Channels

Concurrency to Channels

My keynote from Python Brasil 13 (2017).

Andrew Godwin

October 08, 2017
Tweet

More Decks by Andrew Godwin

Other Decks in Programming

Transcript

  1. Hi, I’m Andrew Godwin • Django core developer • Senior

    Software Engineer at • South, Django migrations, Channels
  2. This is why they are more efficient No overheads of

    cookies, headers and TCP handshake
  3. Thread 1 Thread 2 if self.funds[..] < .. if self.funds[..]

    < .. self.funds[..] += .. self.funds[..] -= .. self.funds[..] += .. self.funds[..] -= .. {"a": 20, "b": 0} {"a": 0, "b": 20} {"a": -20, "b": 40}
  4. Thread 1 Thread 2 get lock a get lock b

    release lock b release lock a get lock b get lock a release lock a release lock b
  5. More threads = more problems And hard to find in

    development when you have no users
  6. Channels 1: Can’t write async code too Have to write

    it separate outside of Channels framework
  7. Make Python the best place for these Even if it

    doesn’t end up being Django.