optNetwork cycle

IT Infrastructure: Service Deadlocks & Self-Links

Scénario de test & Cas d'usage

Business Context

In a microservices architecture, mapping dependencies is crucial. The goal is to find 'Deadlocks' where a service waits for itself (Self-Link) or two services wait for each other. We also test the 'maxCycles' limit to stop after the first critical error is found.
About the Set : optNetwork

Network analysis and graph algorithms.

Discover all actions of optNetwork
Data Preparation

Creation of an IT map containing a Self-Loop (Service A -> Service A) and a short loop (B <-> C).

Copied!
1 
2DATA mycas.services;
3INPUT srv_source $ srv_target $;
4DATALINES;
5Srv_A Srv_A Srv_B Srv_C Srv_C Srv_B Srv_D Srv_E;
6 
7RUN;
8 

Étapes de réalisation

1
Execution allowing Self-Links and limiting results to exactly 1 cycle (Fail-Fast approach).
Copied!
1 
2PROC CAS;
3optNetwork.cycle RESULT=r STATUS=s / direction="DIRECTED" links={name="services"} linksVar={from="srv_source", to="srv_target"} selfLinks=TRUE maxCycles=1 deterministic=TRUE out={name="CriticalDeadlocks", replace=true};
4 
5RUN;
6 
2
Checking the result count.
Copied!
1 
2PROC CAS;
3TABLE.recordCount TABLE={name="CriticalDeadlocks"};
4 
5RUN;
6 

Expected Result


The action returns exactly one cycle (either the self-loop A->A or the loop B->C->B) because maxCycles=1. The presence of the self-loop is detected thanks to `selfLinks=TRUE`.