Skip to content

Commit

Permalink
Makes the stress threshold configurable. (#584)
Browse files Browse the repository at this point in the history
* Makes the stress threshold configurable.

* fix: Fix typo.

* Simplify code.
  • Loading branch information
bgrozev authored Aug 24, 2020
1 parent 09cb733 commit 56ebceb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/main/java/org/jitsi/jicofo/bridge/Bridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ public class Bridge
*/
public static final int MAX_TOTAL_PACKET_RATE_PPS = config.maxBridgePacketRatePps();

/**
* The stress-level beyond which we consider a bridge to be
* overloaded/overstressed.
*/
private static final double OVERSTRESSED_THRESHOLD = .8;

private long failureResetThreshold;

/**
Expand Down Expand Up @@ -309,12 +303,11 @@ public double getStress()
}

/**
* @return true if the stress of the bridge is greater-than-or-equal to
* {@link #OVERSTRESSED_THRESHOLD}.
* @return true if the stress of the bridge is greater-than-or-equal to the threshold.
*/
public boolean isOverloaded()
{
return getStress() >= OVERSTRESSED_THRESHOLD;
return getStress() >= config.stressThreshold();
}

public int getLastReportedPacketRatePps()
Expand Down
3 changes: 3 additions & 0 deletions src/main/kotlin/org/jitsi/jicofo/bridge/BridgeConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ class BridgeConfig {
}
fun averageParticipantPacketRatePps() = averageParticipantPacketRatePps

val stressThreshold: Double by config { "$BASE.stress-threshold".from(JitsiConfig.newConfig) }
fun stressThreshold() = stressThreshold

companion object {
const val BASE = "jicofo.bridge"
@JvmField
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ jicofo {
max-bridge-packet-rate = 50000
// The assumed average packet rate per participant.
average-participant-packet-rate-pps = 500
// The stress level above which a bridge is considered overstressed.
stress-threshold = 0.8
}
// Configure the codecs and RTP extensions to be used in the offer sent to clients.
codec {
Expand Down

0 comments on commit 56ebceb

Please sign in to comment.