Instagram Engineering’s 3 rules to a scalable cloud application architecture

A timeline of Instagram scale

3.5 billion likes. Billion with a ‘b’. Every single day. Instagram has been a runaway success from day 1. With the Instagram Engineering team solving challenge after challenge, to now serve up 80 million photos or videos daily.

When Kevin Systrom and Mike Krieger created Burbn, the Instagram of today was the furthest thing from what they could have imagined. What they saw in Burbn, a location-based check-in system akin to Foursquare, was the success of one thing, photos. So, they boldly striped, simplified, and focused the app to what mattered most.

This decision process wasn’t standalone to their application, but Mike, their tech lead, diffused those same principles into their engineering culture. Doing so, Instagram managed to create a scalable cloud application architecture with little prior experience, amidst hyper growth by keeping true to these 3 rules.

3. Go with proven and solid technologies when you can

‘What are the experts using?’ Instagram began back in 2010 by asking this question and looking at what technologies the foremost experts had used to reach successful scale. Makes sense, right? Mike specifically holds up Facebook, Netflix, and Twitter on his list of envious architectures.

Take a look at these companies and you will notice a reoccurring theme — a shift from the old school, monolithic architecture of yesteryear to what some of us would consider today’s modern stack. A stack based on microservices and the need for polygot persistance, more simplified as choosing the right tool for the job. This gives the teams at Netflix more control and flexibility to leverage the strengths of each at the tradeoff of time, or filling knowledge gaps.

Instagram’s stack (source)

Take a look at Instagram’s architecture and you’ll see examples of this throughout. At the database layer you’ll see a combination of NoSQL, in-memory, and relational databases; taking advantage of each tech’s strength per use case.

2. Don’t re-invent the wheel

Facebook had a great, custom infrastructure for Instagram to leverage — we all can’t be so lucky — but there is a lesson here. What do you really want to do? Manage your infrastructure… or create real features and data-driven experiences your end users will enjoy.

We’ve seen it become the norm with cloud providers and fundamental database decisions and the continuing transformation towards DevOps. Technologies should be helping, or freeing you to build what’s next, not left for you to babysit making sure it is ready to handle your next wave of users.

Moral of the story: use what you already have at your disposal. Be it a nice collection of libraries, a helpful community, or existing internal knowledge to your advantage.

1. Keep it very simple

With each decision comes the opportunity for complexity and the need to fight that complexity. Mike and his team have time and again hit on this need for simplicity throughout the years, and have made decisions to achieve their required global scale.

In 2012 Instagram faced the fatal word: DOWNTIME. Leading them to re-think their architecture after reaching 30 million MAU.

Upon doing so, the team huddled together and stuck to their 3 commandments. Doing things like opting to move their activity feed to Apache Cassandra for it’s proven linear scale and simple masterless architecture.

Instagram has surpassed Twitter in MAU in millions (source)

Now, today Instagram is a top 10 site at 400 million monthly active users, even surpassing one of Mike Krieger’s architecture mentors, Twitter. All made possible because of a series of decisions based on their team’s core philosophies leading to creating a scalable architecture that holds up at epic scale. Instagram has laid out appropriate philosophy for any startup to be ready to scale their cloud applications for when the opportunity for success strikes. What are yours?

To hear more about Instagram and specifically their Cassandra story check out Rick Branson’s talk, Apache Cassandra at Instagram, from Cassandra Summit.

Apache Cassandra at Instagram from Cassandra Summit