Improved low-threshold script skip

This commit is contained in:
Luca Deri 2020-08-12 11:36:51 +02:00
parent 10b27b12c8
commit f7bddc7e0a

View file

@ -20,7 +20,8 @@ local ht_stats = interface.getHashTablesStats()
local idle_flows = ht_stats.FlowHash.hash_entry_states.hash_entry_state_idle
local active_flows = ht_stats.FlowHash.hash_entry_states.hash_entry_state_active
local idle_ratio_threshold = 66.
local idle_flows_threshold = 100000
local idle_flows_high_threshold = 100000
local idle_flows_low_threshold = 1000
local idle_ratio
if(active_flows == 0) then
@ -29,9 +30,12 @@ else
idle_ratio = (100 * idle_flows) / active_flows
end
if((idle_flows > idle_flows_threshold) or (idle_ratio > idle_ratio_threshold)) then
if(
(idle_flows > idle_flows_high_threshold)
or ((idle_ratio > idle_ratio_threshold) and (idle_flows > idle_flows_low_threshold))
) then
skip_user_scripts = true
io.write("[ht_state_update.lua] Skipping scripts on ".. interface.getName() ..": [idle ratio: "..idle_ratio.."]\n")
io.write("[ht_state_update.lua] Skipping scripts on ".. interface.getName() ..": [idle ratio: "..idle_ratio.."]["..idle_flows.."/"..active_flows.."]\n")
end
-- ########################################################