Formalization and Verification of RocketMQ Using CSP

Yiwen Liu, Hongyan Mao, Na Qin, Kai Chen · 2023

With the development of cloud serverless and microservices architectures, RocketMQ recently has emerged as a compelling pattern of service-to-service communication for them. Nowadays, due to its features of high performance, high reliability, low latency, many companies use the open source version of RocketMQ in their business. The existing works are mainly the applications of RocketMQ to realize the program communications, however there are few formalized models for RocketMQ. It is essential to model and verify the RocketMQ system abstracted from its architecture in a formal method to ensure the messaging reliability. In this paper, we focus on the data messaging in production and consumption mechanism to facilitate the overall modeling. Six communication components are extracted including Producer, Consumer, Master Broker, Slave Broker, NameServer, and Clock for describing the temporal process. Then we formalize and model the RocketMQ system using Communicating Sequential Processes (CSP) to describe communicating process among those components. Furthermore, we implement the model of RocketMQ and verify six properties, such as Deadlock Freedom, Consistency, Parallelism, Fault Tolerance, Sequentiality and HeartBeat Mechanism based on the model checker Process Analysis Toolkit (PAT). Finally, our verification results show that the model can satisfy these properties, indicating its messaging reliability can be guaranteed.

Read the paper · More papers on PaperTik