Processing requests with hierarchical nature of shared resources
- Authors: Kirilov V.S.1
-
Affiliations:
- Issue: No 3 (2025)
- Pages: 45-58
- Section: Articles
- URL: https://journals.rcsi.science/2454-0714/article/view/359341
- DOI: https://doi.org/10.7256/2454-0714.2025.3.72892
- EDN: https://elibrary.ru/OHCZAE
- ID: 359341
Cite item
Full Text
Abstract
The subject of this research is the development and analysis of a data structure and algorithm for managing parallel message execution in a microservice architecture without a message broker. In the context of the transition to a microservice architecture and asynchronous messaging, especially in the absence of a centralized broker, there is a need for effective methods to ensure the order of processing messages that affect shared resources. The problem lies in the fact that traditional methods, such as segmentation, do not guarantee compliance with the order of message processing during parallel execution and become more complicated when it is necessary to synchronize access to resources. As an alternative to traditional approaches, a method using a shared queue and a thread pool is being considered. The paper explores and proposes a data structure that provides the possibility of parallel message processing provided there are no lock conflicts, thereby ensuring the correct order of operations related to shared resources and avoiding mutual locks. The main goal is to create resource access control mechanisms adapted to the microservice architecture, without complicating the message processing logic and avoiding problems associated with multithreading. The paper uses an analytical approach to the development of a data structure and algorithm based on the formalization of the synchronization problem, as well as a theoretical analysis of the algorithmic complexity and correctness of the proposed solution. The scientific novelty of the work lies in the proposal of a new data structure using ordered sets and waiting lists for effective management of parallel processing of asynchronous messages in microservice architectures, especially where there is no message broker. The proposed algorithm allows to dynamically determine the locks associated with messages, as well as separate blocking and non-blocking messages, which makes it possible to execute them in parallel. The proposed data structure and algorithm make it possible to change the granularity of blocked resources without complicating message processing procedures, and simplify multithreaded programming by allowing each message processing procedure to be considered as single-threaded. The algorithm does not have the problem of mutual blocking of resources, which increases the overall fault tolerance of the system. The identified shortcomings related to resource blocking are proposed to be eliminated in further research.
Keywords
References
Asynchronous Request-Reply pattern. URL: https://learn.microsoft.com/en-us/azure/architecture/patterns/async-request-reply Microservices: Asynchronous Request Response Pattern. URL: https://medium.com/@pulkitswarup/microservices-asynchronous-request-response-pattern-6d00ab78abb6 Request/Response Pattern with Spring AMQP. URL: https://reflectoring.io/amqp-request-response/ Richardson C. Microcervices Patterns. – 2019. Hohpe G., Woolf B. Enterprise Integration Patterns: Designing, Building, and Deploying Messaging Solutions. – 20. Fowler M., Rice D., Foemmel M., Hieatt E., Mee R., Stafford R. Patterns of Enterprise Application Architecture. – 2004. Sadalage P., Fowler M. NoSQL Distilled: A Brief Guide to the Emerging World of Polyglot Persistence. – 2012. Wang G., Shi Zhijie J., Nixon M., Han S. SoK: Sharding on Blockchain. // AFT '19: Proceedings of the 1st ACM Conference on Advances in Financial Technologies. – 2019. – С. 41-61. URL: https://dl.acm.org/doi/abs/10.1145/3318041.3355457 Introducing Elastic Scale preview for Azure SQL Database. URL: https://azure.microsoft.com/en-us/blog/introducing-elastic-scale-preview-for-azure-sql-database Tasks and Parallelism: The New Wave of Multithreading. // [Электронный ресурс] URL: https://www.codemag.com/article/1211071/Tasks-and-Parallelism-TheNew-Wave-of-Multithreadin Coroutine Is a New Thread. URL: https://medium.com/globant/coroutine-is-a-new-thread-934d9956ce2e Threads vs Coroutines in Kotlin. URL: https://www.baeldung.com/kotlin/threads-coroutines Christudas B. Query by Slice, Parallel Execute, and Join: A Thread Pool Pattern in Java. URL: https://web.archive.org/web/20080207124322/http://today.java.net/pub/a/today/2008/01/31/query-by-slice-parallel-execute-join-thread-pool-pattern.html Programming the Thread Pool in the .NET Framework. URL: https://learn.microsoft.com/en-us/previous-versions/dotnet/articles/ms973903(v=msdn.10)?redirectedfrom=MSDN Introduction to Thread Pools in Java. URL: https://www.baeldung.com/thread-pool-java-and-guava O'Neil P. et al. ORDPATHs: Insert-friendly XML node labels // Proceedings of the 2004 ACM SIGMOD international conference on Management of data. – 2004. – С. 903-908. URL: http://www.cse.iitb.ac.in/infolab/Data/Courses/CS632/2014/2007/Papers/ordpath.pdf PostgreSQL index-ltree. URL: http://www.sai.msu.su/~megera/postgres/gist Кириллов В.С. Бинарное кодирование иерархических структур // Вестник КРАУНЦ. Физико-математические науки. – 2023. – Т. 43, № 2. – С. 44-54. https://doi.org/10.26117/20796641-2023-43-2-44-54 ISSN 2079-664 EDN: XUMKPG
Supplementary files

