~/talk

Downloading a Billion Files in Python

Talkat EuroPython 2019 · 2019-07-08..07-14· [python, web-performance]
links:none on file
slides:none on file

Single-machine setup (16 cores, 64 GB) downloads one billion ~100‑byte files from a paginated REST API. Synchronous requests cost ~3 ms/request (~35 days). Multithreading adds overhead and is slower. Multiprocessing with concurrent.futures drops to ~0.32 ms/request (~3.7 days). Asyncio with aiohttp + uvloop sits between. A hybrid design uses processes each running an event loop plus a thread bridge, reduces IPC by sending pagination tokens instead of per-file tasks, and achieves ~30 μs/request (~8.4 hours). use multiprocessing for core parallelism hybrid (process+async+thread) yields best raw speed

AI-written summary · about

  1. 0:00Introduction
  2. 0:29The Task
  3. 1:00Understanding the Task
  4. 1:23Network Latency
  5. 1:38File Size
  6. 2:10The API
  7. 3:08The Get API
  8. 3:30Disclaimers
  9. 4:38Synchronous
  10. 7:12Multithreading
  11. 8:48Coding
  12. 9:13Main Loop
  13. 9:56Performance
  14. 10:37Why is this happening
  15. 11:22Things to keep in mind
  16. 12:58Multiprocessing
  17. 13:45Multiprocessing code
  18. 14:48Iterating over pages
  19. 15:15Downloader
  20. 16:28Speed Improvements
  21. 17:31Async IO
  22. 17:46List Call
  23. 18:00Async IO Task
  24. 18:59Different Libraries
  25. 19:25Setup
  26. 20:07IO HTTP
  27. 20:32ItAll Files
  28. 20:49Download Files
  29. 22:36Summary
  30. 23:06Multi Processing
  31. 23:29Threading
  32. 23:51Workflow
  33. 25:57Interprocess communication overhead
  34. 26:25Combo results
  35. 26:43The real summary
  36. 27:01Lessons learned
  37. 27:39Thank you
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 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
?
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.