01 logo

Microservices Power Tools

Most important libraries, frameworks, and tools support the implementation of Microservices-based Applications

By Haitham RaikPublished 2 years ago Updated 10 months ago 9 min read
3
Power Tools for Great Microservices-based Applications

In the previous article, we have listed more than 75 patterns for Microservices-based architectures combined from three different schools. While building the microservices applications, you will find yourself in situations requiring using one or more of these patterns.

Most of the Public Cloud Environments (such as Microsoft Azure and Amazon AWS) provide out-of-the-box tools to support most of these patterns, especially the deployment patterns (e.g., Containerization, Serverless deployment, Sidecar, etc.).

But if you need to implement your microservice-based application on-premise, you must consider these things yourself. In addition, you may not find out-of-box tools for all the required patterns, even for Public Cloud environments.

Although the Microservices-Architecture Style is relatively new, it becomes, in no time, rich with the mature tools, libraries, and frameworks that support most of the previously described patterns.

In the following mind map, we will show the different patterns grouped according to their categories and map them with the most supportive open source tools (whenever applicable):

Microservices Power Tools Mind map (Click here for full resolution)

For better visibility, the mind map has been divided into a set of sub-maps according to the category:

Utility Patterns

Utility Power Tools

Externalized Configuration

Spring Cloud Config Server can be an external server for application configuration management. Spring Cloud Config Server needs a repository to store the configurations' values which can be fulfilled using one of the following repositories: Etcd, Eureka, Consul, Zookeeper, or K8s ConfigMap, and in case of secret values, can use it with either K8s Secret or Vault as secure repositories.

You can use Spring Boot to integrate your application with Spring Cloud Config Server for Java applications. But for the .Net applications, you can use Steeltoe.

Microservices Chassis

Tools such as Spring Boot, Spring Cloud, Dropwizard (for Java), Gizmo, Go kit (for GO), and Steeltoe (for .Net) can support the team in creating and setup quickly a maintainable code for a production-ready service.

The above tools assemble and configure a collection of up-to-date frameworks and libraries that handles common concerns such as configuration, security, logging, metrics, health check, tracing, etc., allowing the development team to focus more on what really matters, the business logic.

Service Template

A service template is a runnable service built using the Chassis and handles the required common concerns without considering any business-related logic. Templates must be cloneable to support quicker development for new microservices.

Building tools such as Maven, Gradle, and Nuget can support the build for the service's templates.

If the microservices are expected to be containerized, Docker composer can be used to speed up the containerization requirements. In the case of virtualization (the use of VMs), then Packer and Vagrant can be used to build, prepare and configure the VMs.

Generated templates, VM, and container images can be shared with other developers using a centralized repository, such as; Artifactory, ProGet, PyPI, or Archiva.

Decomposition Patterns

Decomposition Power Tools

In this category, it is uncommon to find tools to support its implementation, as most of them are decision-related patterns about how you want to decompose your logic.

For CQRS only, we can find tools that can support the publish for the events from the Command Domain to the Query Domain.

Kafka, RabbitMQ, ActiveMQ, and AnypointMQ can be used as messaging middleware.

Debezium can detect changes in the command domain database and publish them automatically to the query domain database.

Eventuate is a framework that can be used to publish events from within the command domain code.

Data Management Patterns

Data Management Power Tools

Database per Service

Any database can be used and assigned for a single service only; nothing special here.

Shared Database

Any database that supports schemas can be used here. Most commercial relational databases support schemas and can be used as a shared database.

For the open source databases, we found MySQL and PostgreSQL.

Materialized View

Materialized Views are common in commercial relational databases. But it is rare to find an open source relational database or NoSQL database that supports the materialized views.

Materialized views can be found in PostgreSQL, MongoDB, and Cassandra.

Sharding

Most of the NoSQL databases support Sharding (a.k.a. Partitioning). In addition, MySQL and PostgreSQL are supporting it also.

Event Sourcing

Event sourcing is a different way of storing the data and changes by inserting the cause of the change (the command event in an append-only mode).

Any database can be used to store the events, and any data access framework such as Spring Data, JPA, or .Net Entity Framework can store and retrieve the events.

Eventuate can also simplify the insertion and retrieval of the events.

Communication Patterns

Communication Power Tools

For external APIs, you can use Spring Cloud Gateway, Netflix API Gateway, Netflix Zuul, NGINX, and Ingress to protect, route, and compose backend services.

For Asynchronous messaging, you can use Spring AMQP, Spring Cloud Stream, and Steeltoe Stream as development frameworks, along with Rabbit MQ, ActiveMQ, and AnypointMQ as messaging middleware.

For Event-Driven Messaging, Spring Cloud Stream and Steeltoe Stream can be used as development frameworks, along with Kafka, Rabbit MQ, ActiveMQ, and AnypointMQ as messaging middleware.

Transaction Management Patterns

Transactions Management Power Tools

Transaction Management usually depends on database capabilities such as providing log trailing (e.g., binlog in MySQL).

In distributed processing world (the case with microservices), transactions need to be handled manually between the different microservices, but in general, the following tools can be supportive for maintaining the (eventual) consistency between the involved microservices;

  • Debezuim, which captures the changes on the database and triggers events for the other microservices to get consistent. Debezuim requires Kafka to stream the events
  • Quartz Scheduler that can arrange for a set of operations as a single unit of work. If any process fails, the scheduler needs to handle the failure by compensating the transaction or retrying after a while.

Testing Patterns

Testing Power Tools

Service Component Test

It aims to automate end-to-end testing by using test doubles.

Mountebank is an open source that can double any service. Spring Cloud Contract can be used as well.

Consumer-driven Contract Test

Spring Cloud Contract, Pact, and Pacto can be used to test the exposed APIs and ensure they meet the consumers' expectations.

Consumer-side Contract Test

This is to test if the consumer can call the API. Unit testing tools can be used on the consumer side to test the API reachability.

Deployment Patterns

Deployment Power Tools

Tools such as Docker and VM machines can host and isolate your services.

Once the application development is completed and you are ready for service deployment, you usually need to follow the below process:

Deployment Process

It will be manageable to handle the above process manually if there are few containers and VMs. But, the Microservices applications are expected to depend on hundreds of containers and VMs. The management and deployment of them manually will be complicated and error-prone. For that purpose, a set of supportive tools are required to automate the whole process of deployment:

  1. Provision Infrastructure: Tools such as Terraform and Ansible can be used to automate the provisioning of the infrastructure.
  2. Build Image: Docker Compose can be used for Containers, while Packer and Vagrant can be used to build VMs.
  3. Configure Image: For Containers, Docker Compose can also be used to configure the image with all required software and configurations, while, Ansible, Puppet, or Chef can be used to configure VMs. The image can be published to the centralized artifacts repository (such as Artifactory, ProGet, PyPI, or Archiva) at this stage.
  4. Deployment and Management: Platforms such as Docker Swarm, Kubernetes, or Openshift support building a private cloud that deploys, updates, runs, tracks the containers, and distributes workloads. For VMs, you can use Nomad to make your private cloud of Virtual machines.

Finally, it is essential to use a tool for DevOps processes such as Jenkins that ties the development processes (development, code quality checks, unit testing, integration testing, etc.) with the above deployment process.

Service Discovery Patterns

Service Discovery Power Tools

Microservices instances and containers can be dynamically created and destroyed based on the demands.

Microservices should be discoverable by registering them in a single repository that can be consulted before invoking any service.

Consult, Eureka, Zookeeper, and Etcd can be used as registries. Spring Cloud, Steeltoe can be used for service self-registration. Prana, Registrator, and Kubernetes Services can be used for 3rd party registration.

Service discovery can be achieved using Spring Cloud Discovery, Steeltoe Discovery, Feign, and Ribbon Eureka.

Reliability & Efficiency Patterns

Reliability & Efficiency Power Tools

Platforms such as Kubernetes and Openshift provide dynamic load balancing, scalability, and leader election capabilities.

Frameworks such as Spring Retry, Resilience4j, Polly, Hystrix, and Steeltoe simplify the implementation of the circuit breaker, bulkhead, retry, and throttling.

Redis and Memcached can be used as cache-aside.

The index table is implementable by any relational or NoSQL database.

Security Patterns

Security Power Tools

Keycloak, OpenAM, Gluu, and IdentityServer are Identity providers that maintain the users' identities, generate access tokens, and support federated identities.

Spring Security, .Net Security Core, And All the API Gateways and gatekeepers discussed in the Communication Patterns validate and enforce the access tokens generated by the identity providers.

Observability Patterns

Observability Power Tools

Distributed tracing

You need to generate a correlation Id using UUID/GUID to track a transaction across multiple services.

The transactions must be logged using Spring Cloud Sleuth, Steeltoe Logging, SL4J, and Spring MDC (Mapped Diagnostic Context).

Zipkin and Dapper can correlate the distributed transactions using the correlation id and track them visually.

Log Aggregation

To aggregate the logs from the distributed microservices, you need tools such as Logstash, Filebeat, or FluentD to collect and push them to a central repository such as Elasticsearch. The logs in the central repository can be visualized using tools such as Kabana.

Application Metrics

To collect metrics about the application performance and the response time, code must be instrumented with tools, APIs, and SDKs to generate, collect, and export measures about the behavior of the critical components and integrations.

Libraries such as Spring Boot Actuator, Steeltoe, Dropwizard Metrics, OpenTelemetry, Hystrix, and Micrometer can be used to collect application metrics.

Tools such as Prometheus can collect and store the distributed metrics in a central repository.

Tools such as Grafana can be used to access the Prometheus repository, fetch the metrics and visualize them.

Exception Tracking

Require Distributed tracing capabilities and tools as well as logging aggregation capabilities and tools.

Health check API

Each microservice must provide an API (usually /health) that returns the health of itself, allowing the monitoring tools to detect unhealthy services where the traffic must be re-routed and an alert must be triggered.

UI Patterns

UI Power Tools

Summary

As we saw, we have 75+ design patterns mapped with 110+ tools, libraries, and frameworks, proving that the microservices world is rich with the tools that can support you while building your applications. Implementing any of the above patterns by yourself is an undesirable reinventing of the wheel because it will be a tedious, time-consuming, and error-prone exercise.

how to
3

About the Creator

Haitham Raik

I have 20 years of experience in Software development and Software Architecture. In this page, I will share with you topics based on my expertise related to software development and architecture

Reader insights

Be the first to share your insights about this piece.

How does it work?

Add your insights

Comments (1)

Sign in to comment
  • Alaa Jaser2 years ago

    What a state of art

Find us on social media

Miscellaneous links

  • Explore
  • Contact
  • Privacy Policy
  • Terms of Use
  • Support

© 2024 Creatd, Inc. All Rights Reserved.