An Iterative Approach for Detecting and Resolving Cyclic Dependencies Anti-Pattern in Microservices Architectures
International journal of intelligent engineering and systems · 2025
Microservices is an architectural style for building applications as small, loosely coupled, and independently deployable services.However, maintaining quality requires addressing anti-patterns like cyclic dependencies.This paper introduces a new iterative approach to detect and resolve cyclic dependencies in microservices.Initially, graph theory and the Strongly Connected Components algorithm are employed to identify cycles.Two algorithms are then proposed: one to determine the shape of each cycle, and another to detect tiny sub-cycles, which are cyclic dependencies involving only two microservices, as they represent the simplest form of cyclic dependencies to address.Three refactoring strategies are introduced and evaluated based on these algorithms to effectively eliminate cyclic dependencies.The approach was validated using an e-commerce business domain microservices project with 10 microservices, including 2 cyclic dependencies of Unknown and Tiny shapes.All cyclic dependencies were effectively resolved using the proposed approach, resulting in a 16.66% reduction in service dependency within the architecture.The overall cycles were resolved in 2 brief iterations, with a focus on the resolution of Tiny cycles.These results demonstrate the approach's rapid and efficient impact on microservices quality, promoting loosely coupled and scalable architectures.