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 2021/05/01 14:57:50 UTC

[GitHub] [apisix] tangtangsara commented on issue #4171: bug: log-util print response header connection always close, is apisix use short connection to upstream ?

tangtangsara commented on issue #4171:
URL: https://github.com/apache/apisix/issues/4171#issuecomment-830645498


   
   
   
   > Hi, I reproduced your example and apisix does not actively modify the header connection.
   > 
   > my route
   > 
   > ```json
   > {
   >     "update_time": 1619856904,
   >     "id": "1",
   >     "upstream": {
   >         "hash_on": "vars",
   >         "pass_host": "pass",
   >         "scheme": "http",
   >         "nodes": {
   >             "127.0.0.1:1980": 1
   >         },
   >         "type": "roundrobin"
   >     },
   >     "uri": "/*",
   >     "create_time": 1619856904,
   >     "status": 1,
   >     "enable_websocket": true,
   >     "priority": 0
   > }
   > ```
   > 
   > `127.0.0.1:1980` is a nginx server, the nginx.conf is https://github.com/apache/apisix/blob/master/benchmark/server/conf/nginx.conf
   > 
   > here is my request and response
   > 
   > ```
   > GET
   > 127.0.0.1:9080/hello
   > 16:21:22.653
   > Pretty
   > Raw
   > Request Headers:
   > Connection:"keep-alive"
   > cache-control:"no-cache"
   > Postman-Token:"7d3d220d-e0d1-4958-89b4-5f3fa842f244"
   > User-Agent:"PostmanRuntime/7.6.0"
   > Accept:"*/*"
   > Host:"127.0.0.1:9080"
   > accept-encoding:"gzip, deflate"
   > Response Headers:
   > Content-Type:"text/plain; charset=utf-8"
   > Transfer-Encoding:"chunked"
   > Connection:"keep-alive"
   > Date:"Sat, 01 May 2021 08:21:22 GMT"
   > Server:"APISIX/2.5"
   > Response Body:Infinity
   > ```
   @tzssangglass 
   您这个请求和响应是 postman (客户端 或浏览器) -> apisix之间的, 他们之间的响应我这里也是没问题的
   我提交的问题是apisix -> upstream之间的,  
   
   tomcat不会有什么问题, 因为之前通过nginx代理响应都是正常的.
   而且我通过抓包,确认了 apisix 发送请求给tomcat时
    设置nginx配置 set $upstream_connection         '';   代表  无connection头, tomcat响应没有connection 头
    设置nginx配置 set $upstream_connection         'keep-alive';   代表强制启用 keep-alive, tomcat响应有connection:keepalive
   这都是正确的 
   
   @Firstsawyou 日志里面记录的响应头,一定是有问题的, 没有打印出正确的tomcat的响应头.
   更重要的是, 因为这个问题引起了我的担心 , 担心 apisix和tomcat之间的连接,即便是tomcat响应了keepalive,但仍然如日志打印的connection:close一直使用短连接.
   高并发的情况会大量创建连接
   


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