XOR Media

Coding, Operations, Etc.

High Performance Web: Asynchronous HTTP

Async-What

The secret to building high performance sites which depend on external web services is asynchronous HTTP. The trick to asynchronous HTTP (or anything with the exception of UI) is to avoid callback hell. Enter futures/promise objects. When used correctly they make doing substantial asynchronous IO, relatively straightforward.

It ...

(more)

High Performance Web: Reducing Database Round Trips

Background

There are two main sources of latency in the backend of web applications: rendering (HTML templating or data serialization) and IO (database or external service calls.) Today we'll look at the latter and more specifically focus getting rid of extraneous database round trips. The fastest query possible is ...

(more)
In code, tagged: db, examples, performance, and sql.

Efficiently Querying for Nearby Things

It's a fairly common use case to have a latitude and longitude and want to find the closest objects to a given point. While there are heavyweight solutions: MySQL Spatial Extensions, PostGIS, they can be more trouble than they're worth especially if you're making use of an ...

(more)
In code, tagged: algorithms, db, examples, geo, mysql, performance, and sql.

Keeping Track with Graphite and Statsd

I recently gave a presentation on graphite and statsd to the East Bay Django meetup It's more about the importance of stats in general when running services, web or otherwise. The slides are available and embedded here. There's also a related demo project that turned out to be ...

(more)
In ops, tagged: django, performance, python, and stats.

Useful Latency Numbers

I ran across this gist on Hacker News which has a quick rundown of the latencies of various operations. It's nothing earth shattering, but if you compare the intra-data center round-trip (0.5ms) to reading 1MB of data from disk (20ms) you can pretty quickly see why systems like ...

(more)