jujiale opened a new issue, #7631:
URL: https://github.com/apache/apisix/issues/7631

   ### Description
   
   hello , I use apisix v2.12 do some test, I have installed apisix-base, but I 
meet some question,the following is my config. my upstream is a 
openresty(172.25.xxx.xxx) ,the openresty keepalive_timeout is 10s , when I 
visit http://172.25.xxx.xxx:9000:9000/test, it could return a simple string.
   `
   
       {
            "id": "414195977881125816",
            "create_time": 1656409641,
            "update_time": 1660009873,
            "uri": "/test",
            "name": "jujiale-test",
            "methods": ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", 
"OPTIONS", "CONNECT", "TRACE"],
            "plugins": {
                    "prometheus": {
                            "disable": false,
                            "prefer_name": true
                    }
            },
            "upstream": {
                    "nodes": {
                            "172.25.xxx.xxx:9000": 1
                    },
                    "timeout": {
                            "connect": 6,
                            "send": 6,
                            "read": 6
                    },
                    "type": "roundrobin",
                    "schtheme": "http",
                    "pass_host": "pass",
                    "keepalive_pool": {
                            "idle_timeout": "60s",
                            "requests": 1000,
                            "size": 320
                    }
            },
            "status": 1
       }
   
   `
   
   with above config , I use tcpdump do packet capture in apisix server, "sudo 
tcpdump -i any host 172.25.xxx.xxx and dst port 9000 -w 111.pcap". then I visit 
uri "/test" in apiisx with curl. the request sent to upstream OK. but when I 
use wireshark open 111.pcap, it appears many three-handshaking, then I cutdown 
idle_timeout from 60s to 5s in order to be smaller than 10s in openresty 
config, it also has many three-handshakings. I am confused of such thing.
   
   I find the following source code is invoked when I visited uri "/test"
   source code: apisix/balancer.lua
   
[https://github.com/apache/apisix/blob/f118f5ea7a5d96023a7bd546545f7c1ad6486495/apisix/balancer.lua#L299](url)
   `
   
       local idle_timeout = keepalive_pool.idle_timeout
                   local size = keepalive_pool.size
                   local requests = keepalive_pool.requests
       
                   pool_opt.pool_size = size
                   local ok, err = balancer.set_current_peer(server.host, 
server.port,
                                                             pool_opt)
                   if not ok then
                       return ok, err
                   end
       
                   return balancer.enable_keepalive(idle_timeout, requests)
   `
    the code "balancer.enable_keepalive(idle_timeout, requests)" seems does not 
work
   
   what I do above this is in apisix-dashboard to config keepalive_pool, then I 
remove keepalive_pool config from my route config, and use config-default.yaml 
nginx_config.http.upstream.keepalive_timeout is 60s, with the wireshark do 
examine, it also behaves like above what I discribe.
   
   
   So I want to know, set idle_timeout 0  if could close keepalive, and set 
idle_timeout is not 0 if could open keepalive_pool
   
   
   
   
   ### Environment
   
   - APISIX version (run `apisix version`):v2.12
   - Operating system (run `uname -a`):linux 3.10.0-957.21.3.el7.x86_64
   - OpenResty / Nginx version (run `openresty -V` or `nginx 
-V`):openresty/1.19.9.1
   - etcd version, if relevant (run `curl 
http://127.0.0.1:9090/v1/server_info`):3.5.0
   - APISIX Dashboard version, if relevant:
   - Plugin runner version, for issues related to plugin runners:
   - LuaRocks version, for installation issues (run `luarocks --version`):
   


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