Friday, September 25, 2015

Making a success of microservices

I've been reading quite a lot on microservices architecture, especially the team and organisational culture required for this approach to be a success. More specifically, I found it just as interesting to see when NOT to use this approach, than when it's appropriate. 

So without further ado, let's run through some findings and thoughts, followed up by reading material for your perusal.

Essential rules of thumb

In order for you, your team and your organisation to even think about, let alone succeed, with microservices, think about the following.

  1. Know when it's appropriate to apply it: microservices architecture isn't a one-size-fits-all solution and can actually hurt you, if you don't apply it with eyes wide open. Sometimes monoliths are quite appropriate;
  2. Know your team culture: your team need to be willing to do what it takes, and be patient. Microservices architecture ride heavily on team maturity, tooling and techniques to be able to deliver it effectively;
  3. Know your organisational culture: Conway's Law states "organizations which design systems ... are constrained to produce designs which are copies of the communication structures of these organizations". Essentially, your organisation's structure and culture should be able to, or willing to, give autonomy to teams and have less governance. The more red tape, the less likely microservices are to succeed; 
  4. Be willing to trial-and-error, and grow into it rather than big-bang: companies like Google, Amazon and more didn't start off with microservices as an architectural approach; they all started with a monolithic approach and grew into it, to solve real architectural and business challenges. 

Tips on your road to success

To get you on your way, here are some tips and tricks gathered from the experts (see the list at the bottom). 

Make sure it's a fit for your project(s)

Before you apply this architectural style to a project, make sure:
  • you're not applying it because it's the latest cool kid on the block. Sometimes a monolithic approach is a perfectly good solution.
  • it will meet your client's needs in terms of performance, functionality and effort required;
  • you have a real customer problem or business case that is hard to solve in a monolith, and apply microservices architecture there.


Team and culture

Your team must be willing to own a product (one or more microservices) top-to-bottom and be mature enough to be able to do the following.
  • Decide on the technology to use with little or no governance, and be autonomous as far as possible;
  • Have cross-cutting skills in the team, so the team can address from the database right through to the UI if need be;
  • Your team should either be willing to, be moving towards, or already be doing Continuous Deployment. Microservices imply you're going to have lots of them, so you really need to be efficient with how you develop, test and deploy them;
  • The team must be held (and want to be held) accountable for that product and own it right up to production support (DevOps).


Deploy, Refactor, Reuse Recycle

Microservices need to be boxed (see Domain Driven Design's bounded context) and simple to reason about.
  1. You must be willing to retire, add and modify them separately and often. This means you need to be on top of your versioning game;
  2. Reuse other teams' microservices before you build your own. This means strong collaboration between teams;
  3. Use Domain Driven Design, paying special attention to the Bounded Context principle, where appropriate, to make sure your microservices don't end up being semi-monoliths.

So, when does it make sense to use microservices as an architectural approach?

I found some tips from Adrian Trenman (Gilt) very informative. Use microservices as an architectural approach when
  1. you can isolate a piece of domain functionality that a single service can “own”;
  2. the service can fully own read and write access to its own data store;
  3. multiple teams are contributing to a monolithic system but keep on stepping on each other’s toes;
  4. you want to implement continuous deployment;
  5. you favor an emergent architecture rather than atop-down design.

Conclusion

The take-home from this article, if  you remember nothing else, is that you need to be mature as a team before embarking on the microservices journey. It requires trust from your team and organisation for it to be successful.
In addition, you also need to understand that it is a tool in the toolbox of architectures, and not a magic bullet. 
Lastly, don't rush it. Be OK with trial-and-error and make sure your organisation understands that.

References

Thank you to the following resources and contributors to those resources. I highly recommend you read up on these articles if you want to know more.

 InfoQ microservices architecture e-book where most of my info comes from. People like Eric Evans, Martin Fowler and Randy Shoup (plus some others from Gilt) were contributors.

From monolyth to microservices by Randy Shoup (slideshare).

InfoWorld's article on how to succeed with microservices.

SmartBear's article on what is microservices architecture.

1 comment:

  1. Microservices must be autonomously deployable, whereas SOA services are often implemented in deployment. Microservices add a bit to the grouping concept, defining a service over all application layers, including the UI. So people already doing SOA may gain technology liberation and an alternative to mature technologies, because individual services within an application can be progressively swapped out for those based on more-modern technologies, without having to replace the entire application.

    Microservices is not an substitute to SOA, but rather as a way to restore suppleness that may have been lost in SOAs that became too rigid.

    I see prospective for microservices as a way to shift from a top-down to a bottom-up approach to SOA. As an example, where legacy applications must be replaced or reimplemented by a more modern solution a microservices architecture can provide a basis for a holistic SOA approach.

    In the end, it all comes down to business value. Many people build “functional services” that create architectural bottlenecks in a SOA. If the platform lacks a feature, you should create a library, not a runtime service. We as developers and architects should be busy building business services that offer specific value to the organization. Microservices could offer the means to deliver that value.

    ReplyDelete