2 ms·
Here are some lessons you might learn: 1. Load before forking. 2. Remember that green threads tend to have problems with fairness of scheduling. 3. JSON deco
by kragen 7y ago
Here are some lessons you might learn:
1. Load before forking.
2. Remember that green threads tend to have problems with fairness of scheduling.
3. JSON decoding gobbles CPU.
4. Scheduling fairness problems increase response time variance.
4½. Green threads also increase it.
5. Don't forget about retries of timed-out requests into account in protocol design; idempotence is the simplest solution when you can use it.
6. Wake-one semantics to avoid the thundering herd are important for performance when you have multiple threads, and Gunicorn has that thundering herd problem, so you probably don't want to be running it this way on a 64-core box with hyperthreading. (The problem is of course less severe than it was for Apache because the green threads don't thunder.)
7. Gevent uses epoll, not select, poll, or RT signals
8. EAGAIN and SIGPIPE if you didn't know about those. (Somebody is in today's lucky ten thousand.)
9. What kinds of mechanisms “tend to show up given time in a battle-tested [network server] system.”
10. Your systems don't have to be fragile pieces of shit.
- rachelbythebay 7y agoVery nice. Thank you.
- kragen 7y agoI'm not sure whether the person I was replying to is The One to whom all these things are too obvious to be worth mentioning, or if these were too implicit for them to notice, or a combination. Either way, no, thank you for writing it.