So, You Want to Move to Microservices?

As I reflected back on my time at LinkedIn, I put together a brief history of its scaling story. We had done the (now) classic migration from monolith to microservices. Just like oh I dunno, Amazon, Google, eBay, Twitter, Netflix, and my current employer Uber (to name a few). And why not? Microservices are a great way to scale your traffic as you scale your engineering headcount.

So clearly every company should do it, right?

Microservices absolutely have advantages, but everything in life is a tradeoff. Let’s dive into some of the pros and cons of microservices. And if you’re still convinced, let’s tackle what you need to get right before embarking on the microservice journey.


Microservice Pros and Cons

Pros:

Cons:

So, what should I do?

Those cons above are nasty and represent only a glimpse of the world of microservices. You don’t want to get into that too early. It’s better to start with a monolith as your company or team is small and move toward microservices when it becomes painful to add new features or scale your system.

Almost all the successful microservice stories have started with a monolith that got too big and was broken up — Martin Fowler, Monolith First

In LinkedIn’s case, the first “service” in their move towards microservices was one that maintained their member connection graph. The usage profile was different from other parts of the site, they wanted it to live in-memory for performance, and even their DB queries were different. So it made sense to be standalone.

What do I need to get right before embarking on a microservice migration?

In short, you need to understand and address the tradeoffs you are making in the “cons” of microservices. Here’s a list I often think about:


Conclusion

Doing microservices right is hard (sadly, many end up with a distributed monolith instead). Start with a monolith especially if the team is small. Find that successful product market fit. The time will present itself. Start with one new service. Get the tooling / infrastructure in place. Then add more. Eventually you’ll have the confidence to migrate the rest.

Update Nov 2016: A nice video of the realities of migrating to microservices from one of Uber’s lead engineers mirrors many of these points.

« PREVIOUS
Code Reviews by Phase and Expectations
NEXT »
Don't Ask for Feedback, Ask for Advice