apisix icon indicating copy to clipboard operation
apisix copied to clipboard

help request: When there are two routes with the same rules in apisix, will apisix perform load balancing?

Open 1024-zzw opened this issue 3 years ago • 3 comments

Description

1.路由1 { "uri": "/test-boot/", "name": "AutoRouterUpstream_TEST-BOOT", "desc": "", "hosts": [ "apisix-gateway-ew.apisix.svc.cluster.local" ], "plugins": { "proxy-rewrite": { "regex_uri": [ "^/test-boot/(.)", "/${1}" ] } }, "upstream": { "type": "roundrobin", "hash_on": "vars", "scheme": "http", "discovery_type": "eureka", "pass_host": "pass", "service_name": "TEST-BOOT" }, "labels": { "prefix": "AutoRouterUpstream_" }, "status": 1 } 2.路由2 { "uri": "/test-boot/", "name": "AutoRouterUpstream_TEST-BOOT", "desc": "", "hosts": [ "apisix-gateway-ew.apisix.svc.cluster.local" ], "plugins": { "proxy-rewrite": { "regex_uri": [ "^/test-boot/(.)", "/${1}" ] } }, "upstream": { "type": "roundrobin", "hash_on": "vars", "scheme": "http", "discovery_type": "eureka", "pass_host": "pass", "service_name": "TEST-BOOT" }, "labels": { "prefix": "AutoRouterUpstream_" }, "status": 1 }

3.上面两个路由仅仅只是Route ID不一样。我们的集群中,早上访问对应路由的时候,apisix选择的是路由1;下午apisix给切换 成路由2了。请问是否有相关负载均衡呢?里面对于相同路由的选择是怎样的算法呢

Environment

  • APISIX version (run apisix version):
  • Operating system (run uname -a):
  • OpenResty / Nginx version (run openresty -V or nginx -V):
  • 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):

1024-zzw avatar Aug 02 '22 10:08 1024-zzw

Hitting two routes is random if the conditions for participating in the match are identical for both routes. You should avoid this situation.

tzssangglass avatar Aug 02 '22 13:08 tzssangglass

Hitting two routes is random if the conditions for participating in the match are identical for both routes. You should avoid this situation.

It's not random, all requests will be either hit the first one or the second one.

tokers avatar Aug 03 '22 01:08 tokers

It's not random, all requests will be either hit the first one or the second one.

I know what you mean about hitting one of them when there is no rebuilt route. In a broad time dimension, they are random.

tzssangglass avatar Aug 03 '22 01:08 tzssangglass

This issue has been marked as stale due to 350 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the [email protected] list. Thank you for your contributions.

github-actions[bot] avatar Jul 25 '23 10:07 github-actions[bot]

This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.

github-actions[bot] avatar Aug 09 '23 10:08 github-actions[bot]