how to avoid microservice pitfalls

Download How to avoid microservice pitfalls

If you can't read please download the document

Post on 24-Jan-2017




1 download

Embed Size (px)


How To AvoidMicroservice Pitfalls


Jeffrey Palermo@jeffreypalermojeffrey@clear-measure.comCEO, Clear Measure

Justin Self@thejustinselfjustin.self@clear-measure.comPrincipal Solution Architect, Clear Measure

David Boike@davidboikedavid.boike@particular.netSolution Architect, Particular

What is and isnt a microservice?It IS a service that encapsulates one capability or function.It ISNT a service that has multiple responsibilities.


Microservice PitfallsAnd how to get around them

Pitfall: More than one microservice in a repositoryDifficult to enforce complete separationCI/CD and Build chains become complicatedIntroduces more codeClutters the repo historyDifficult to segregate team responsibilities


Guidance: One microservice per repo

Its generally freeSimplified CI/CD pipelineFocused historyEasy to hold the entire repo in your mindPromotes best tool for job

David: Segregate team responsibilitiesTalk about Particular maintainer groups, organizationally multiple repos is a good idea anyway.


Pitfall: More than one microservice per databaseData ownership becomes muddledAllows for cross dependencies between other microservicesLeads to using one storage hammer for all storage needsComplicates deploymentsDatabase and service code are coupledForced to scale and shard all data at the same time

Guidance: Each microservice gets at least one private datastore

Pick the right data storage for the given requirementExpose APIs for querying important dataUse NServiceBus events to propagate data between services if neededAvoid schema only abstractionsAutomate all database migrations and interactionsSQL QueriesDocument patchesIndex creationsEtc.

Demo of AliasQL8

Pitfall: Making everything publicPromotes a tangled mess of dependencies2016 version of dependency hellVersioning becomes difficultExposing all commands is like making all methods public

Guidance: Create boundaries

Group your microservices by capabilitiesShare events, not commands outside of the boundariesAPIs could act as boundaries

Source: @adrianco

David - Talk about deploying messages with MyGet10

Pitfall: Coupled deploymentsLockstep deploymentsNo versioning scheme for APIsHard coding service locations


Guidance: Make them independent

Version APIs from day oneDont HTTP all the thingsPass messages unless you shouldntUse service discovery tools and proxiesConsulNGINXDNS


Pitfall: Automation as an afterthoughtWaiting to implement CI/CDSnowflake serversPets vs cattle approachNo iteration zero repoNo centralized logging and monitoring

More details on snowflake services13

Guidance: Automate all the things

Forces a level of consistency among all servicesConfiguration as codeLog, log and log some moreImplement consistent health checkingEmbrace build tools and taskspsakeCakeBatch files

David :This is the approach we use at Particular as wellWe automate everything we canConventions based on the endpoint name


Pitfall:Thinking microservices are a panacea


Guidance:Approach microservices like buying a horse

David :Ive seen plenty of examples of companies thinking microservices should be used for everything, or that its a quick fix.Its a way to deliberately build systems that are maintainable for the long term



Thank You