Design and implementation of a decentralized message bus for microservices

Pakorn Kookarinrat, Yaowadee Temtanapat · 2016

A new software architecture, known as microservices, becomes rapidly popular recently. Microservices could help developers cope well with the problems of software complexity and demands on an adaptive development process that needs to respond to changes quickly. In this architecture, a single monolithic large application would be divided into small multiple isolated services. They are separately deployed and communicated to other services via remote calls. This architectural style allows any changes on one service not affecting the others. However, if services directly make remote calls, it would create interdependencies and tight couplings between them. To remove such problem, this paper proposes a decentralized message bus to use as a communication tool between services. Our message bus provides a framework for services to collaborate. It divides into four main components, public API, message bus, messaging and service discovery. The API uses the HTTP and RESTful style of communication. We use decentralized service discovery to avoid a single point of failure of the system. The messaging uses a simple TCP connection with only a header and body in its message. We also define three necessary communication messages for the services, viz. request/response, notification and publish/subscribe. The proposed framework is implemented and tested with a real-world scenario. It works correctly without any problem. Also, to realize how it could be scaled, we run the system continuously with incremental services and traffics. From the observation on the resource consumption of CPU, memory and network I/O, we found that the network consumption grows linearly while the CPU and memory usages have little change in consumption.

Read the paper · More papers on PaperTik