print "# INIT=" systime()
print "# THRESHOLD=" THRESHOLD
print "# FUDGE=" FUDGE
+ print "# DECISION=" DECISION
print "# PINGSLOTS=" PINGSLOTS
print "# BW_MAX_RX=" BW_MAX_RX
print "# BW_MIN_RX=" BW_MIN_RX
rx_rate_max = 100 # make something up
tx_rate_max = 100 # make something up
update_bw()
- update_bw_min_delta = (0.02 * peer_count)
+ if (DECISION == "eager") {
+ update_bw_min_delta = 0.02
+ decision_pingslots_factor = 3
+ adjust_sqm_mindelta = 0.5
+ } else if (DECISION == "relaxed") {
+ update_bw_min_delta = (0.02 * peer_count)
+ decision_pingslots_factor = 5
+ adjust_sqm_mindelta = 1
+ } else {
+ print "FATAL: BOGUS DECISION SETTING: " DECISION
+ exit 1
+ }
}
# XXX TODO impl. tunable for acting more fine-grained?
function slice_bw_window_rx(bw_lower_bound_rx, bw_upper_bound_rx) {
bw_bound_delta_rx = (bw_upper_bound_rx - bw_lower_bound_rx)
- bw_steps_rx = 1+int((log(bw_bound_delta_rx)/log(10)) ^ 1.6)
+ bw_steps_rx = 1 + int((log(bw_bound_delta_rx) / log(10)) ^ 1.6)
print "# STEPS_RX=" bw_steps_rx
for (k = 0; k <= bw_steps_rx; k++) {
STEPS_RX[k] = int((bw_lower_bound_rx + (k * (bw_bound_delta_rx / bw_steps_rx))))
ts_delta = ts - ts_old
if (ts_delta < update_bw_min_delta) {
# Let caller know that not much time has passed since the last update,
- # so maybe not waste time with useless calculations in the face of very
+ # so maybe not waste time with pointless calculations in the face of very
# little actual change.
return 0
}
function adjust_sqm(peername, latency) {
adjust_ts_delta = (ts - adjust_old)
- # Do not try to adjust bw more than once a second.
- if (adjust_ts_delta < 1.0) {
+ # Do not try to adjust bw more than the DECISION policy dictates
+ if (adjust_ts_delta < adjust_sqm_mindelta) {
# print "# " ts " looping too fast, skipping SQM update adjust_ts_delta=" adjust_ts_delta
return
}
}
not_increasing_count[peername] = 0
} else if (latency < (ping_prev[peername] + FUDGE / 2) && latency < (ping_pprev[peername] + FUDGE / 2) && ping_prev[peername] < (ping_pprev[peername] + FUDGE/2)) {
- if (not_increasing_count[peername] > (5 * PINGSLOTS)) {
+ if (not_increasing_count[peername] > (decision_pingslots_factor * PINGSLOTS)) {
if (bw_cur_step_rx < bw_maxindex_rx) {
bw_next_step_rx = bw_cur_step_rx + 1
print "+++ " ts " choosing bw rx step " bw_next_step_rx " := " STEPS_RX[bw_next_step_rx] "Kbps rx=" rx_rate " tx=" tx_rate
IFACE_TX='eth1' # interface to apply upstream SQM to (presently not used)
BW_MIN_RX=10000 # your min. acceptable downstream bandwidth to shape to in Kbps
BW_MAX_RX=30000 # your max. desired downstream bandwidth to shape to in Kbps
+TREND_DECISION="relaxed" # choose either "eager" or "relaxed" - the latter trades additional CPU load for quicker decision making
done
+case "${TREND_DECISION}" in
+ eager)
+ ;;
+ relaxed)
+ ;;
+ *)
+ printf 'FATAL: Interface "%s" does not seem to have cake SQM set up\n' "${i}"
+ exit 1
+ ;;
+esac
+
+
set -u
-v BW_MIN_RX="${BW_MIN_RX}" \
-v BW_MAX_RX="${BW_MAX_RX}" \
-v THRESHOLD="${THRESHOLD}" \
+ -v DECISION="${TREND_DECISION}" \
-v PINGSLOTS="${PING_SLOTS_PER_PEER}" \
-v FUDGE="${FUDGE_MS}" \
-v PING_PEERS="${PING_PEERS}" \