ChuanFF commented on PR #12872:
URL: https://github.com/apache/apisix/pull/12872#issuecomment-3738318512

   @shreemaan-abhishek 
   
   **Example:** an APISIX cluster with two nodes, **A** and **B**.  
   Configuration: `limit_key = limit_conn`, `conf.key_ttl = 10s`, `conf.conn = 
10`, `conf.burst = 0`.
   
   - **t = 1s:**  
     Five requests arrive at node A. Redis `INCR` is called with `5`, resulting 
in  
     `limit_conn = 5`, `TTL = 10s`.
   
   - **t = 5s:**  
     Five requests arrive at node B. Redis `INCR` is called with `5`, resulting 
in  
     `limit_conn = 10`, `TTL = 10s`.
   
   - **t = 10s:**  
     Node A crashes. At this moment, the Redis key remains  
     `limit_conn = 10` with `TTL = 5s`.
   
   - **t = 14s:**  
     Five requests finish on node B. Redis is updated, resulting in  
     `limit_conn = 5`, `TTL = 10s`.
   
   - **t = 20s:**  
     Six requests finish on node B. Redis is updated to  
     `limit_conn = 11`, `TTL = 10s`.  
     Since `11 > conf.conn`, one request is rejected.
   
   Therefore, in scenarios with continuously ongoing requests, it is difficult 
to rely on TTL expiration to clear the counters of nodes that have gone down.
   


-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to