summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author刘畅 <[email protected]>2024-01-03 10:12:43 +0000
committer刘畅 <[email protected]>2024-01-03 10:12:43 +0000
commit0822899c4f2d2932ce2a3cc1e1c1bba7c2b27ad0 (patch)
treed010b00580a8a433543fd84180d8472efeaa73c8
parent56e19600c47233dff58f800b67e8c746f5f94bd1 (diff)
parentbd138432738b573731aa8c92653a2b2dc204f1dd (diff)
Merge branch 'bugfix_improve_frequency_of_refresh_priority' into 'rel'v3.1.17
Bugfix improve frequency of refresh priority See merge request tango/shaping-engine!67
-rw-r--r--shaping/src/shaper.cpp4
-rw-r--r--shaping/src/shaper_stat.cpp2
-rw-r--r--shaping/src/shaper_swarmkv.cpp4
3 files changed, 7 insertions, 3 deletions
diff --git a/shaping/src/shaper.cpp b/shaping/src/shaper.cpp
index 4ebc436..be68ca3 100644
--- a/shaping/src/shaper.cpp
+++ b/shaping/src/shaper.cpp
@@ -25,7 +25,7 @@ extern "C" {
#define TOKEN_ENLARGE_TIMES 10
#define TOKEN_GET_FAILED_INTERVAL_MS 1
-#define HMGET_REQUEST_INTERVAL_MS 1000
+#define HMGET_REQUEST_INTERVAL_MS 10
#define SWARMKV_QUEUE_LEN_GET_CMD_PRIORITY_1 "HMGET tsg-shaping-%d priority-0"
#define SWARMKV_QUEUE_LEN_GET_CMD_PRIORITY_2 SWARMKV_QUEUE_LEN_GET_CMD_PRIORITY_1 " priority-1"
@@ -657,7 +657,7 @@ static int shaper_profile_is_priority_blocked(struct shaping_thread_ctx *ctx, st
return 0;
}
- if (curr_time_ms - profile->hash_node->last_hmget_ms[priority] < HMGET_REQUEST_INTERVAL_MS) {//don't send hmget command in 1s
+ if (curr_time_ms - profile->hash_node->last_hmget_ms[priority] < HMGET_REQUEST_INTERVAL_MS) {//don't send hmget command in 10 ms
goto END;
}
diff --git a/shaping/src/shaper_stat.cpp b/shaping/src/shaper_stat.cpp
index d8895fa..db5b5f7 100644
--- a/shaping/src/shaper_stat.cpp
+++ b/shaping/src/shaper_stat.cpp
@@ -14,7 +14,7 @@
#define SHAPER_STAT_ROW_NAME "traffic_shaping_rule_hits"
-#define SHAPER_STAT_REFRESH_TIME_NS 100000000 //0.1s
+#define SHAPER_STAT_REFRESH_TIME_NS 10000000 //10 ms
struct shaper_stat_conf {
int enable_backgroud_thread;
diff --git a/shaping/src/shaper_swarmkv.cpp b/shaping/src/shaper_swarmkv.cpp
index 1fea20c..81d8ac9 100644
--- a/shaping/src/shaper_swarmkv.cpp
+++ b/shaping/src/shaper_swarmkv.cpp
@@ -170,6 +170,10 @@ struct swarmkv* shaper_swarmkv_init(int caller_thread_num)
}
LOG_DEBUG("%s: shaping open swarmkv: %s", LOG_TAG_SWARMKV, conf.swarmkv_cluster_name);
+
+ char cmd[256] = {0};//重启之后自动执行一次heal
+ snprintf(cmd, sizeof(cmd), "/opt/tsg/framework/bin/swarmkv-cli -n %s -c %s:%d --exec CLUSTER SANITY heal", conf.swarmkv_cluster_name, conf.swarmkv_consul_ip, conf.swarmkv_consul_port);
+ system(cmd);
return swarmkv_db;
}