A guide by Dayne Jones
I’m Dayne. I try to make martech better.
I. A bit about AddShoppers
II. What is asynchronous
A. In general
B. In python
III. Why does it matter?
A. Are there benefits?
B. Is it worth using?
IV. How do I use it?
A. Which libraries should I use?
B. What kind of support can I
How are we using
asynchronous Python at
● ### million requests per day, ####
● Hanes, American Giant, Jockey,
● ## app servers (all tornado), ## db,
## cache, ## queue
● ## data pipeline servicing ~ ### rps
● Hiring? Yes, please.
● The CPU very often context switches at non deterministic intervals.
● Allows the programmer to mark context switches
● Single threaded (don’t use synchronous code in your thread)
response = requests.get(url) # takes 1 second
async_requests.get(url, callback=print_resp) # still takes 1 second
● Long lived connections
● Mostly idle
Common Use Cases
● Real-time web. Anything that requires long lived, mostly idle connections from
● Network I/O. Waiting for HTTP requests to return.
● Database calls. Waiting for a database to return a query.
● Filesystem. Waiting for a disk.
● Anything else non CPU bound.
How do I write asynchronous
programs in Python?
● Tornado Web
● Twisted (Event driven networking engine)
● Gevent (Networking library)
● Cyclone (Tornado API on top of Twisted)