~/talk

Python Sockets at Scale: I/O Multiplexing and Asyncio

Talkat PyCon India 2025 · 2025-09-12..09-15· [python, concurrency]
slides:none on file

Shows that per-connection threads hit the GIL so they run concurrently not parallel, then demos using the OS readiness syscalls (select/poll/epoll/kqueue) and Python’s selectors module to multiplex sockets in one thread. Builds an echo server and a large-file sender where default blocking sockets stall other clients, switching sockets to non‑blocking yields partial writes you must track yourself, and asyncio Streams is presented as the layer that keeps per-connection pending buffers and uses writer.drain to flush reliably.

AI-written summary · about

  1. 0:00Introduction
  2. 0:20What is I/O Multiplexing
  3. 1:46Synchronous vs threading approach
  4. 2:52Understanding the GIL
  5. 3:53Threading server demo
  6. 4:36Asyncio for true concurrency
  7. 5:21Sockets as file descriptors
  8. 6:46Blocking vs non-blocking I/O
  9. 7:52Non-blocking stdin with select
  10. 9:15File descriptor readiness
  11. 12:29Selectors API overview
  12. 13:35Non-blocking file descriptor monitoring
  13. 14:42Monitoring stdin and socket
  14. 15:47Select server demo
  15. 16:53Why use asyncio
  16. 17:57Select-based socket server
  17. 19:05Echo server demo
  18. 20:12Blocking socket issue
  19. 21:36Non-blocking sockets explained
  20. 23:01Socket buffer and blocking
  21. 24:51Pending data management
  22. 25:55Asyncio streams advantage
  23. 27:23Drain method in asyncio
~/search
type to search 6,518 conferences, 143,918 speakers and 192,133 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.