Upgrade to Pro — share decks privately, control downloads, hide ads and more …

From Monolith to Microservices and back again. ...

From Monolith to Microservices and back again. Twice.

The benefits of a microservice architecture to a growing organisation have been discussed by many, many people at conferences, in books, and on video. As an industry, we’re good at waxing lyrical about the gains in agility, productivity and reliability that such an architecture can provide. The problem is that very few organisations get this right, certainly not the first time, and certainly not without some serious pain along the way.

At ShopKeep we’ve been down this road. We’ve tried, and failed, to break our monolith apart and move towards the wonderful world of microservice nirvana. This talk is an adventure in failure and eventual recovery. I explore the transitions we made, the reasons why, the bad decisions, and the silly mistakes we made along the way. It’s not hopeless, there is light at the end of the tunnel, and hope for a glorious microservicey future for all of us.

Sharing our experiences of failure helps us all to build better, more reliable systems.

Avatar for Patrick Carey

Patrick Carey

June 10, 2017

Other Decks in Technology

Transcript

  1. $whoami • Paddy Carey • Lead Engineer, ShopKeep • I

    do meetup stuff • @paddycarey everywhere that matters
  2. $whoami • Paddy Carey • Lead Engineer, ShopKeep • I

    do meetup stuff (sometimes) • @paddycarey everywhere that matters
  3. Goals • Break out reporting functionality in a new service

    • Use the tools we already know to build something familiar • Build something scalable that'll allow us to grow our reporting functionality along with our user base for the next $NUM years
  4. Architecture/Decisions • Rails/Sidekiq stack • EC2/Capistrano • Amazon Redshift •

    Lives behind our existing monolith • Invisible to callers/clients
  5. Goals • Break out reporting functionality in a new service

    whilst providing a foundation for ShopKeep's future growth on the backend. • Use the best-in-class tools to build something scalable and manageable • Build something scalable that'll allow us to grow our reporting functionality along with our user base for the next $NUM years
  6. Architecture/Decisions • Go microservices • Radical decomposition • Heterogeneous datastores

    ◦ PostgreSQL ◦ Cassandra ◦ Elasticsearch ◦ Kinesis for shuffling data around • Protobufs everywhere • Docker/Marathon/Mesos (originally we used Deis) • New set of client-facing APIs • Lives behind our existing monolith
  7. Goals • Break out reporting functionality in a new service

    that can consolidate our previous attempts at this functionality. • Initially replace only our existing reports. • Use the best-in-class tools to build something scalable and manageable • Build something scalable that'll allow us to grow our reporting functionality along with our user base for the next $NUM years • Prototype multiple approaches to validate our thinking before committing to a long intensive build
  8. Architecture/Decisions • A small handful of Python services • A

    message queue for shuffling data between systems asynchronously • CQRS(ish) • Initially SNS/SQS based (now Kafka)
  9. Conclusion • Microservices are hard • You'll probably get it

    wrong the first time ◦ that's totally OK, so long as you learn from it ◦ in fact, unless you make these mistakes yourself, you're unlikely to appreciate the subtlety and pain of some of the decisions you're making • Don't be afraid of failure, embrace it, iterate where you need to • You can always start over