You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/12/08 11:38:50 UTC

[GitHub] [apisix] wfgydbu removed a comment on issue #2985: bug: 'limit-conn' plugin seems working in an unexpected manner

wfgydbu removed a comment on issue #2985:
URL: https://github.com/apache/apisix/issues/2985#issuecomment-740461818


   @spacewander @membphis  Hi friends, I'm wondering there might be another problem here.
   
   limit objs now are shared by using an `core.table`, Will it mess up two `limit-conn` in two different routes?
   
   Consider this, configure two routes:
   ```
   curl -i -X PUT http://127.0.0.1:9080/apisix/admin/routes/1 -H'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -d '
   {
       "uri": "/route1",
       "methods": ["PUT", "GET", "POST", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE"],
   	"plugins": {
           "proxy-rewrite": {
               "uri": "/"
           },
           "limit-conn": {
               "conn": 20,
               "burst": 0,
               "default_conn_delay": 0.1,
               "rejected_code": 503,
               "key": "remote_addr"
               }
   	},
       "upstream": {
           "type": "roundrobin",
           "nodes": {
               "10.10.10.40:8000": 10
           }
       }
   }'
   
   
   
   curl -i -X PUT http://127.0.0.1:9080/apisix/admin/routes/2 -H'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -d '
   {
       "uri": "/route2",
       "methods": ["PUT", "GET", "POST", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE"],
   	"plugins": {
           "proxy-rewrite": {
               "uri": "/"
           },
           "limit-conn": {
               "conn": 50,
               "burst": 0,
               "default_conn_delay": 0.1,
               "rejected_code": 503,
               "key": "remote_addr"
               }
   	},
       "upstream": {
           "type": "roundrobin",
           "nodes": {
               "10.10.10.40:8000": 10
           }
       }
   }'
   ```
   Then run `ab -c 10 -n 10000 http://127.0.0.1:9080/route1` and `ab -c 40 -n 10000 http://127.0.0.1:9080/route2` at the same time. The Result contains 503 error code that should not have. Because  10 < 20 and 40 < 50). 
   
   Results:
   ```
   Document Path:          /route1
   Document Length:        214 bytes
   Concurrency Level:      10
   Time taken for tests:   4.530 seconds
   Complete requests:      10000
   Failed requests:        9663
      (Connect: 0, Receive: 0, Length: 9663, Exceptions: 0)
   Write errors:           0
   Non-2xx responses:      9663
   
   Document Path:          /route2
   Document Length:        214 bytes
   Concurrency Level:      40
   Time taken for tests:   10.496 seconds
   Complete requests:      10000
   Failed requests:        0
   Write errors:           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:
users@infra.apache.org