Skip to content

Commit ac0fc95

Browse files
committed
fix: improve least_conn balancer implementation
1 parent d766027 commit ac0fc95

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

apisix/cli/config.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ local _M = {
9797
["prometheus-metrics"] = "15m",
9898
["standalone-config"] = "10m",
9999
["status-report"] = "1m",
100+
["balancer-least-conn"] = "10m",
100101
}
101102
},
102103
stream = {

apisix/cli/ngx_tpl.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ lua {
7373
{% if status then %}
7474
lua_shared_dict status-report {* meta.lua_shared_dict["status-report"] *};
7575
{% end %}
76+
{% if enable_stream then %}
77+
lua_shared_dict balancer-least-conn {* meta.lua_shared_dict["balancer-least-conn"] *};
78+
{% end %}
7679
}
7780
7881
{% if enabled_stream_plugins["prometheus"] and not enable_http then %}
@@ -284,7 +287,9 @@ http {
284287
lua_shared_dict balancer-ewma {* http.lua_shared_dict["balancer-ewma"] *};
285288
lua_shared_dict balancer-ewma-locks {* http.lua_shared_dict["balancer-ewma-locks"] *};
286289
lua_shared_dict balancer-ewma-last-touched-at {* http.lua_shared_dict["balancer-ewma-last-touched-at"] *};
290+
{% if not enable_stream then %}
287291
lua_shared_dict balancer-least-conn {* http.lua_shared_dict["balancer-least-conn"] *};
292+
{% end %}
288293
lua_shared_dict etcd-cluster-health-check {* http.lua_shared_dict["etcd-cluster-health-check"] *}; # etcd health check
289294
290295
# for discovery shared dict

0 commit comments

Comments
 (0)