Dev

How Facebook built out its new location features

Earlier this week, Facebook launched a boatload of new features for third-party apps. If you want a look under the hood, you’re in for a treat this morning.

In a new blog post, Facebook engineer Karan Mangla explains how the new features came to be.

To recap the new features and corresponding APIs, Facebook gave third-party developers the ability to add location and friends as properties to any update, photo, or link. To accomplish this feat, the social network rolled out a whole herd of new APIs and documentation. You have your location-setting API, your friend-tagging API, your improved places search API, and your location-reading API.

Mangla said the company has been working hard on beefing up Places and other location functionality for the past year and a half. Location-tagging is now a universal feature for all photos and statuses, and there’s even a new map view for Timeline, so you can see your activities represented geographically rather than chronologically, if you choose.

Creating that map was a special challenge. Without the “lazy load” type of scrolling action in a chronological Timeline page, all location data from a user had to be fetched and presented at once, which Mangal said created a huge data load for Facebook to process. To handle the issue, the team “created infrastructure to farm out data fetching to multiple servers,” Mangal wrote. “On every page load, a single server fetches the IDs of all pieces of content that can be displayed for the current user. This server then breaks up this data into smaller chunks, and each chunk is sent in a request to another server to actually fetch the data and do privacy checks. The responses from these servers [are] then combined to create the timeline map display.”

Also, to make location features more accessible, particularly to GPS-lacking feature phone users, the team built out a new location search feature that took into account places a user was likely to be that also matched up with the first three letters in a search query.

“Developing the universal search infrastructure allowed us to work around this issue and provide users the ability to search for places on any phone, improving search quality with location if it’s available,” Mangal wrote. “This significantly increased the set of users who could check in to a place via their mobile phones.”

You can check out the rest of Mangla’s comments on the Facebook Engineering Blog

Image courtesy of Anneka, Shutterstock


Mobile developer or publisher? VentureBeat is studying mobile app analytics. Fill out our 5-minute survey, and we'll share the data with you.