Add EWMA as configurable load balancing algorithm (#2229)

This commit is contained in:
Zenara Daley 2018-03-23 11:06:21 -04:00 committed by Manuel Alejandro de Brito Fontes
parent b0a63fe3ff
commit 6e099c5f57
6 changed files with 283 additions and 13 deletions

View file

@ -42,6 +42,8 @@ http {
lua_shared_dict configuration_data 5M;
lua_shared_dict round_robin_state 1M;
lua_shared_dict locks 512k;
lua_shared_dict balancer_ewma 1M;
lua_shared_dict balancer_ewma_last_touched_at 1M;
init_by_lua_block {
require("resty.core")
@ -976,6 +978,11 @@ stream {
{{ end }}
{{ if not (empty $location.Backend) }}
{{ if $all.DynamicConfigurationEnabled}}
log_by_lua_block {
balancer.call()
}
{{ end }}
{{ buildProxyPass $server.Hostname $all.Backends $location $all.DynamicConfigurationEnabled }}
{{ if (or (eq $location.Proxy.ProxyRedirectFrom "default") (eq $location.Proxy.ProxyRedirectFrom "off")) }}
proxy_redirect {{ $location.Proxy.ProxyRedirectFrom }};