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

   ### Current Behavior
   
   1. create an upstream
   ```
   curl http://127.0.0.1:9180/apisix/admin/upstreams/1  \
   -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -i -X PUT -d '
   {
       "type":"roundrobin",
       "nodes":[
       {
               "host":"httpbin.org",
               "port":80,
               "weight":1
        },
       {
               "host":"ifconfig.io",
               "port":80,
               "weight":1
        }
       ],
          "checks": {
               "active": {
                   "timeout": 5,
                   "http_path": "/status",
                   "host": "foo.com",
                   "healthy": {
                       "interval": 2,
                       "successes": 1
                   },
                   "unhealthy": {
                       "interval": 1,
                       "http_failures": 2
                   }
               }
           }    
   }'
   ```
   
   2. create a route
   ```
   curl http://127.0.0.1:9180/apisix/admin/routes/1 \
   -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
   
       "uri": "/*",
       "upstream_id": 1
   
   }'
   ```
   
   3. add a log
   
![image](https://user-images.githubusercontent.com/9354193/223439805-7d15b6b6-ecc4-4abd-9ae0-06077e5cc67e.png)
   
   4. send requests
   We can see that a random IP is returned each time
   
![image](https://user-images.githubusercontent.com/9354193/223440161-c2e27305-acee-41fc-8a1b-246658a6754f.png)
   
   5. it will create a new upstream every request
   
![image](https://user-images.githubusercontent.com/9354193/223441462-0de9df3e-a22f-43c9-85d3-36d4740402d4.png)
   https://github.com/apache/apisix/blob/master/apisix/utils/upstream.lua#L98
   
   6. it will create a health checker every request
   
![image](https://user-images.githubusercontent.com/9354193/223441824-8da455b0-24aa-435e-ad0a-b1343c72c41c.png)
   
   
   
   
   
   
   
   ### Expected Behavior
   
   It should not create a health check every request
   
   ### Error Logs
   
   no
   
   ### Steps to Reproduce
   
   It is described above
   
   ### Environment
   
   - APISIX version (run `apisix version`): 3.1.0
   - Operating system (run `uname -a`): ubuntu 22.04
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`): 1.21.4.1
   - etcd version, if relevant (run `curl 
http://127.0.0.1:9090/v1/server_info`):
   - 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