Blocking Across The Wire

35761e3936deba2f8189c2d20982c771?s=47 Kyle Simpson
November 15, 2015

Blocking Across The Wire

If you're writing high-performance async code, blocking is the worst thing you can do, right? Except, what if blocking on remote (across the wire) processes is exactly what you want to do!?

CSP (Communicating Sequential Processes) is a channel-based async concurrency pattern that's built on "blocking" semantics. This talk is a wild experiment into upending and rethinking asynchronous programming. We'll explore practical applications of CSP in JS and then look at how we can extend it to work across the wire between browser and server.

35761e3936deba2f8189c2d20982c771?s=128

Kyle Simpson

November 15, 2015
Tweet

Transcript

  1. kyle simpson @getify http://getify.me blocking across the wire

  2. concurrency

  3. async

  4. None
  5. event loop

  6. 1 2 3 4 1 2 3

  7. 1 2 3 4 1 2 3 done! done!

  8. parallel

  9. None
  10. coordination

  11. None
  12. None
  13. synchronous async

  14. generator

  15. *caveat emptor generators + promises

  16. *caveat emptor generators + promises ?

  17. *caveat emptor * s

  18. generators

  19. None
  20. None
  21. CSP content security policy communicating sequential processes

  22. CSP: go, cljs @swannodette @jlongster

  23. channel-based concurrency

  24. None
  25. channel: stream with buffer=1 back pressure

  26. blocking...

  27. None
  28. github.com/getify/a-tale-of-three-lists

  29. None
  30. asynquence github.com/getify/asynquence

  31. ...across the wire!? blocking... (localized)

  32. server client

  33. remote channel github.com/getify/remote-csp-channel *extremely alpha does NOT require asynquence

  34. one last thing

  35. ...across all the threads! blocking...

  36. wait. what?

  37. yep. multi-threading. in javascript.

  38. browser-web worker browser-browser browser-server server-child process ...

  39. CSP is a powerful, simple pattern for distributed, coordinated concurrency

  40. thanks! kyle simpson @getify http://getify.me