DZone
Microservices Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Microservices Zone > 10 Best Practices for Microservice Architectures

10 Best Practices for Microservice Architectures

Make sure you're striving for these microservices best practices in your distributed systems, like monitoring and REST maturity.

Derek Weeks user avatar by
Derek Weeks
·
Jun. 25, 18 · Microservices Zone · Tutorial
Like (47)
Save
Tweet
53.20K Views

Join the DZone community and get the full member experience.

Join For Free

Switching to microservice architecture will solve all of your software architecture problems.

Right? Okay, it won’t. But there is value to be found in the journey.

Hüseyin Babal recently made the point that a microservices based architecture would not solve all problems. However, it is a solid move to modernize your infrastructure. We all know the challenges of sustaining a monolithic architecture over many years, so we seek new alternatives to sustainability, flexibility, and ease of integration. Implementing microservices architecture with a foundation of best practices can drastically improve your software architecture.

Hüseyin is a Chief Software Architect at Aurea and consults for Kloia. His recent talk, Ultimate Guide to Microservice Architecture, covers much of the experiences he works through each day and presents best practices to implement microservice architectures.

In his talk, he uses Spring Boot for application development, Consul for service discovery, Elasticsearch & Kibana for Monitoring, and Docker & Jenkins for Continuous Delivery. He covers each, including numerous code examples, with ten best practices.

Best Practice #1 — Try to Reach the Glory of REST

Screen Shot 2018-05-27 at 8.00.28 AM

Realize the benefits (nay, the glory) of REST APIs. Looking at Leonard Richardson’s Maturity Model, there are four levels of using REST. You can start a level 0, which is soft resources, using one endpoint; then Level 1, which has different resources, but has the same HTTP method; Level 2, which uses different HTTP methods, such as POST, PUT, DELETE, etc.; finally, Level 3 - you have navigational resources on your API responses. Behold, the glory!

Best Practice #2 — Use Spring HATEOAS

This helps you use navigable, restful APIs.

Best Practice #3 — Use Distributed Configuration

This way, you aren’t configuring 50 different configurations one at a time. Consul can be used to keep config at Key/Value.

Screen Shot 2018-05-27 at 8.01.56 AM

Best Practice #4 — Client Code Generation

Hüseyin suggests, “either using Swagger to generate your client code on any supported language or use feign client with a little annotation and client-side load balancing with Ribbon.”

Screen Shot 2018-05-27 at 8.02.37 AM

Best Practice #5 — Continuous Delivery

Hüseyin walks through some examples using Jenkins and Docker.

Screen Shot 2018-05-27 at 8.03.29 AM

Best Practice #6 — Monitor

In fact, monitor everything.

Screen Shot 2018-05-27 at 8.04.09 AM

Best Practice #7 — Logging

Hüseyin points out there are numerous Docker log drivers. He walks through examples with GELF (Graylog Extended Log Format).

Best Practice #8 — APM

Application performance management. This collects extra details to help you troubleshoot issues. Zipkin is an open source option Hüseyin walks through.

Best Practice #9 — API Gateways to Aggregate Data to Specific Clients

Screen Shot 2018-05-27 at 8.04.51 AM

Best Practice #10 — Event Sourcing and CQRS (Command and Query Responsibility Segregation)

A Command alters the state of an object, but does not return data. A Query returns data, but does not alter the state of the object.

You can watch Hüseyin’s full talk here. He walks through technical examples and solutions to each best practice.

Craving more on Modern Infrastructure and DevOps? Binge watch any of the 20 sessions, free of charge, from All Day DevOps here.

Software architecture microservice Best practice

Published at DZone with permission of Derek Weeks, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Message Queuing and the Database: Solving the Dual Write Problem
  • What SREs Can Learn From the Atlassian Nightmare Outage of 2022
  • Exporting and Importing Projects in Eclipse
  • Image Classification Using SingleStore DB, Keras, and Tensorflow

Comments

Microservices Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo