Microservice Patterns | Design Patterns | Micro Scatter-Gather


Microservice and Containerization Patterns > Containerization Patterns > Micro Scatter-Gather
Home > Design Patterns > Micro Scatter-Gather

Micro Scatter-Gather (Erl, Naserpour)

How can a microservice carry out high-performance composition logic that can include composing specific microservice instances?

Micro Scatter-Gather

Problem

A high-performance task needs to be completed that would need to involve the composition of multiple microservices, as well as the composition of specific microservice instances. The systems programming required to build such composition logic is complex.

Solution

A root container is utilized with special distributor and aggregator microservices designed to compose and interact with multiple microservices and microservice instances, thereby carrying out the necessary high-performance composition logic.

Application

The distributor microservice accepts the task from the service consumer and segregates it into micro tasks that are assigned to the appropriate microservices or microservice instances. A separate aggregator service collects the results and aggregates them into one single response back to the service consumer. Distributor and aggregator services are deployed in isolation in a special root container that exposes APIs to the service consumer and the composed microservices.

A container is established and assigned the role of root container for the distributed composition system. The root container hosts distributor and aggregator microservices. The distributor is responsible for breaking down a greater task into granular tasks and distributing those tasks to other microservices or microservice instances. The aggregator is responsible for aggregating the results from the composed microservices or microservice instances.

Micro Scatter-Gather: The microservice instances send their task results to the root container and its distributor service. The distributor forwards the results to the aggregator. The aggregator sends back the aggregated result to the distributor and the distributor returns the aggregated results to the service consumer. 

The microservice instances send their task results to the root container and its distributor service. The distributor forwards the results to the aggregator. The aggregator sends back the aggregated result to the distributor and the distributor returns the aggregated results to the service consumer.

This pattern can be applied by determining the number of instances of the root container that may be required, as explained in the complete pattern description.

Module 10: Advanced Microservice Architecture & Containerization.

This pattern is covered in Module 10: Advanced Microservice Architecture & Containerization..

For more information regarding microservice and containerization courses and accreditation,
visit the Microservice Architect Certification program page..