This talk looks at the science of building web services, thinking about APIs from their most basic primitives, and the lessons learned at Twilio and Runscope for supporting APIs at massive scale. (Presented at Silicon Valley Code Camp 2013)
“The largest architectural change we made was to move from our monolithic Ruby application to one that is more services oriented.” https://blog.twitter.com/2013/new-tweets-per-second-record-and-how
PUT import requests retries = 3 for i in range(retries): resp = requests.put(“http://127.0.0.1/buckets/1234”, data={ ... }) if resp.ok: return resp.json()
Redis as a Queue import redis r = redis.StrictRedis() def queue_item(item): r.lpush(“work_queue”, item) def get_item(): return r.rpop(“work_queue”) class Worker(Greenlet): def _run(): while True: item = get_item() if item: # do work else: sleep(1)