whl739 opened a new issue #2954:
URL: https://github.com/apache/apisix/issues/2954


   ### Issue description
   See code in `apisix/balancer/ewma.lua`:
   ```
   local function _ewma_after_balance(ctx, before_retry)
       if before_retry then
           -- don't count tries which fail to complete
           return nil 
       end 
   
       local response_time = tonumber(ctx.var.upstream_response_time) or 0
       local connect_time = tonumber(ctx.var.upstream_connect_time) or 0
       local rtt = connect_time + response_time
       local upstream = ctx.var.upstream_addr
   
       if not upstream then
           return nil, "no upstream addr found"
       end 
   
       return get_or_update_ewma(upstream, rtt, true)
   end
   ```
   
   Both var `upstream_response_time` and `upstream_addr` may  be separated by 
commas,  it will cause unexpected result.
   And if openresty is not patched with `lua-var-nginx-module`, these times are 
all 0.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to