Pinterest has changed the way we present information on the visual Web. But Pinterest itself hasn’t changed much since its beginning.
That is, on a coding level. Jon Jenkins, Pinterest’s head of engineering, recently revealed that the image-sharing community is still running on its original codebase.
“For many web companies that hit massive scale, it's common practice to replace their whole architecture—sometimes several times,” he said. “We've chosen to instead evolve our early stack into its present-day stack without dramatic change, and grow it alongside our company.”
An Unconventional Decision
By codebase and architecture, Jenkins means the underlying technologies that make Pinterest run. As a website grows, engineers won't just conduct visual redesigns to keep the look and feel of the site fresh, but they will revamp the codebase with new technologies that help it to run more efficiently. Tumblr is especially notorious for overhauling its codebase on a regular basis, leading to periods of unpleasant but necessary user downtime.
One of the most public contrasts to this practice is LinkedIn. During Project Inversion, LinkedIn's engineering team froze development of new features for two months while it re-wrote its entire codebase. This measure was drastic, to be sure, but LinkedIn and its investors alike consider it to have been essential, a vital measure to support LinkedIn's growing influence.
"We recognized that the platform's rapid growth, and our desire to keep releasing innovative products, required shifting from a feature-branch-based way of developing and deploying software to a continuous deployment system," a LinkedIn spokesperson said.
However, Pinterest has never made such a transition, not even with its hockey-stick growth curve. Jenkins said the basic building blocks, including Python web servers, a mySQL database, open-source data structure service Redis and caching daemon Memcache, still make up the bulk of the code on which Pinterest is built. The team regularly improves on pieces of the codebase with in-place rewrites.
“In other words, we evolved things, not replaced them,” said Jenkins.
How Explosive Growth Shaped A Code Legacy
It helps that the three engineers responsible for building Pinterest’s original codebase—Yash Nelapati, Marty Weiner and Ryan Probasco—still work there today, and can oversee the codebase’s lengthy history.
According to Weiner, it wasn’t originally a conscious choice to retain the same codebase Pinterest had in early 2011, but one born out of necessity.
“The site began moving and 2011 was spent in rapid-growth mode,” he said. “There was no time to think about a major re-architecture. Every day was spent trying to fix the one or two things that were on fire for those 12 to 24 hours, and maybe get ahead on what we thought would break in the next 12 hours.”
But as tweaks built upon tweaks, Pinterest’s architecture became increasingly unscalable when faced with the site’s unrelenting growth. When they noticed these edits—cobbled together from a variety of technologies—were making the codebase unstable, they had two options. They could replace the codebase with other technical solutions. Or, they could rewrite and strengthen the original building blocks.
"We made a snap decision to put all the cards on the table and rethink," said Weiner. "We chose a few technologies that worked consistently well—MySQL, Python, Memcache, Redis and a few others. What we ended up with was a new beginning that we've evolved ever since."
Nobody can deny the sleek look Pinterest presents to users, but for developers trawling Pinterest’s storied codebase, there are certainly a few surprising ancient Easter Eggs.
“We still use invite code written in 2010,” said Weiner. “My favorite file still around is our original notes.txt file which was our ‘Apollo 13 checklist’ of how to bring up boxes or fix certain problems.”
Photo of Jon Jenkins courtesy of O'Reilly Conferences on Flickr.