No SQL or DynamoDB: Airbnb goes with Memcached for Neighborhoods feature

One of Airbnb’s neat features, Neighborhoods, shows people elegant pages on neighborhoods within big cities that can help them choose exactly where to stay. Actual homes where visitors can stay the night are directly tied to the neighborhood pages. The idea sounds obvious, but it took some engineering tinkering to figure out how to make it all work accurately and quickly.

On the Airbnb Nerd Blog on Thursday, engineers Andy Kramolisch and Ben Hughes, who worked on Neighborhoods and previously founded NabeWise, a neighborhood guide for American cities, explained the back-end process of aligning locations with neighborhoods.

Behind the scenes, Kramolisch said, a cartographer carves out the borders of neighborhoods. Then it’s time to match up hosts’ homes with the neighborhoods listed on Airbnb. On the site’s back end, Kramolisch said, the latitude and longitude of available homes are regularly associated with the various neighborhoods in a given city, if those neighborhoods are represented on Airbnb, through an internal system called Glop, short for Genome Location Pipeline. “For example, say you list your place, which is located at (12.333568650219718, 45.43647998034738). The next time Glop runs, it will correctly identify your listing as being in San Marco,” he said.

It’s not as if Neighborhoods works with “insane amounts of data,” Kramolisch said. Still, up-to-date data on places to stay in neighborhoods needs to be served up quickly, so users aren’t kept waiting in front of their screens. Data changes fast, and an SQL database wouldn’t work because of “mass updates,” Kramolisch said. So an internal NoSQL database in cooperation with Amazon Web Services’ managed DynamoDB NoSQL database service was considered. But DynamoDB couldn’t handle Airbnb’s storage needs. So the engineers turned to the Memcached key-value store for quickly serving up data by keeping it in memory.

In going with Memcached, Airbnb is making the same choice as Facebook, Etsy and other companies that operate at webscale. Location is the top criterion for Airbnb travelers, Kramolisch says, and the fast service Memcached enables — 35 milliseconds on average, to be precise — is the kind of solution that could help Airbnb focus on giving customers more of what they want from the site, when they want it.