- Microservices represent the decomposition of monolithic business systems into independently deployable services that each perform a specific function.
- There are three main groups of microservices: stateless services, persistence services, and aggregator services.
- Messaging systems, such as message brokers, allow microservices to communicate asynchronously through message passing. Common examples are RabbitMQ, Apache Kafka, and Amazon SQS.
- Aggregator microservices depend on other microservices, handle network communication, and may involve disk I/O. An example is a device data collector that collects data from multiple devices and processors and stores it in a database.
9. Tree Groups of Microservices
- Stateless
- Persistence
- Aggregator
9
10. Stateless Microservices
- Simple processors: converters, translators, etc
- No dependence on other services
- No local data storage (disk I/O)
- Easy to replace
- Easy to scale up
10
13. Aggregator Microservice
13
Devices Device Data
Collector MS
Device Data
Processor
DB
Alert
Generator
HB/IC Data ~1KB HB/IC Data ~1KB Event
sync request
sync response
microservices
Number devices: 5 000 – 50 000
Request frequency: every 5 minutes
Number req./sec: 17 – 170
Stored data for 2 hours: 35 – 350 MB
14. Aggregator Microservice
14
Devices Device Data
Collector MS
Device Data
Processor
DB
Alert
Generator
HB/IC Data ~1KB Event
sync request
sync response
microservices
Number devices: 5 000 – 50 000
Request frequency: every 5 minutes
Number req./sec: 17 – 170
Stored data for 2 hours: 35 – 350 MB
17. Async message-passing systems
17
● Direct communication
○ TCP, one-to-one
○ Without broker: UDP, ZeroMQ (over TCP), Webhooks (HTTP Callbacks)
● Message brokers
○ JMS, AMQP, RabitMQ, ActiveMQ, HornetQ, Qpid, TIBCO Enterprise Message, IBM
MQ, Azure Service Bus, Google Cloud Pub/Sub, SQS
● Log-based message brokers
○ Aache Kafka, Amazon Kinesis Streams, Twitter DistributedLog
18. HTTP Callbacks with Payload
18
[W3C Standards – https://www.w3.org/TR/websub]
Subscriber Publisher Hub
Subscribers discover the hub of a topic URL
makes a POST the HUB to subscribe to updates about topic
HUB verifies the subscription attempt with a GET
Publisher notifies the HUB of a new content
HUB delivers the contents of a topic to each subscriber with a POST
19. Logs Based Message Storage
19
Partition 0
Partition 1
Partition 0
Partition 1
Partition 2
Offset for P0 = 6
Offset for P1 = 7
Offset for P2 = 3
Topic 1
Topic 2
Producer
Producer
Consumer
Consumer
20. Release Scope
Graph theory provides a simple formula
n – number of changes
Limit the number of changes in each release to increase the safety of each
release
20
( 1)
2
n n
I
[Microservice Architecture – Irakli Nadareishvili, Ronnie Mitra]