Class BottleneckDetector
java.lang.Object
com.tnsai.coordination.observability.BottleneckDetector
Analyzes an
InteractionGraph to detect performance bottlenecks
in multi-agent systems.
Detects the following bottleneck types:
- OVERLOADED - Agent with disproportionately high in-degree
- SINGLE_POINT_FAILURE - Agent whose removal disconnects the graph
- IDLE - Agent with very low activity
- COMMUNICATION_HOT_SPOT - Edge with disproportionately high weight
- UNBALANCED_LOAD - High variance in agent activity levels
Usage Example
BottleneckDetector detector = new BottleneckDetector(graph);
List<Bottleneck> bottlenecks = detector.detect();
double health = detector.getHealthScore();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA detected bottleneck in the agent interaction graph.static enumTypes of bottlenecks that can be detected. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a detector for the given interaction graph. -
Method Summary
Modifier and TypeMethodDescriptiondetect()Runs all detection algorithms with default thresholds.detectCommunicationHotSpots(double thresholdMultiplier) Detects edges with disproportionately high weight.detectIdle(double minActivity) Detects agents with very low activity.detectOverloaded(double thresholdMultiplier) Detects agents with disproportionately high in-degree.Detects agents whose removal would disconnect the graph.detectUnbalancedLoad(double maxVarianceRatio) Detects unbalanced load across agents.doubleComputes an overall health score for the agent group.
-
Constructor Details
-
BottleneckDetector
Creates a detector for the given interaction graph.- Parameters:
graph- interaction graph to analyze
-
-
Method Details
-
detect
Runs all detection algorithms with default thresholds.- Returns:
- list of all detected bottlenecks
-
detectOverloaded
Detects agents with disproportionately high in-degree.An agent is overloaded if its in-degree exceeds the mean in-degree multiplied by the threshold.
- Parameters:
thresholdMultiplier- multiplier for mean in-degree (default 2.0)- Returns:
- list of overloaded bottlenecks
-
detectIdle
Detects agents with very low activity.An agent is idle if its out-degree is less than
minActivity * mean(outDegree).- Parameters:
minActivity- minimum activity ratio relative to mean (default 0.1)- Returns:
- list of idle bottlenecks
-
detectSinglePointsOfFailure
Detects agents whose removal would disconnect the graph.Uses BFS reachability: removes each agent and checks if remaining agents are still connected.
- Returns:
- list of single-point-of-failure bottlenecks
-
detectCommunicationHotSpots
Detects edges with disproportionately high weight.An edge is a hot spot if its weight exceeds the mean edge weight multiplied by the threshold.
- Parameters:
thresholdMultiplier- multiplier for mean edge weight (default 3.0)- Returns:
- list of communication hot spot bottlenecks
-
detectUnbalancedLoad
Detects unbalanced load across agents.Load is unbalanced if the ratio of max activity to min activity exceeds the threshold, where activity = in-degree + out-degree.
- Parameters:
maxVarianceRatio- maximum allowed ratio (default 2.0)- Returns:
- list of unbalanced load bottlenecks (one per detection, not per agent)
-
getHealthScore
public double getHealthScore()Computes an overall health score for the agent group.Score ranges from 0.0 (unhealthy) to 1.0 (healthy). Formula:
1.0 - (bottleneck_count * severity_sum) / (node_count * 10), clamped to [0, 1].- Returns:
- health score between 0.0 and 1.0
-