Introduction to Gevent
summary
Gevent is a C-extension networking library that gives cooperative greenlets over an event loop; version 1.0 replaces libevent with libev, uses c-extensions for fast context switching, and provides monkey patching of the stdlib so existing blocking code becomes cooperative. Examples: asynchronous DNS via c-ares, stream server + pool, timeouts, and inability to preempt CPU-bound code. Benchmarks show about 60,000 switches/sec, and real users scale single processes to roughly 10,000 connections successfully.
AI-written summary · about
chapters (17)
- 0:00Introduction
- 0:29What is Gevent
- 3:48Blocking sockets vs async I/O
- 6:58Threading and event loops
- 8:44Coroutines and types
- 10:52Coroutine switching
- 13:03Gevent’s event loop
- 14:28The Hub and sleep
- 16:13Monkey patching
- 18:27Greenlet class and timeouts
- 20:18Greenlet pools
- 21:20Async communication tools
- 22:23Gevent HTTP server
- 23:31Database drivers
- 24:40Real-world use case
- 25:43Summary and future plans
- 26:04Q&A
related talks
30mWhat the heck is gevent?
20mIt's Critical: Concurrent programming as a sane programming model
05mgopy: extending CPython with Go
43mGIL: What's the hassle and... should I care?
45mGo(lang) to Python
15mWhat The GIL Means For Containers
30mFree threaded Python past, present and future
27mgRPC-Python: Major Feature Updates
