Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help request: about eureka when apisix reload #7178

Closed
kongjun01 opened this issue Jun 1, 2022 · 9 comments
Closed

help request: about eureka when apisix reload #7178

kongjun01 opened this issue Jun 1, 2022 · 9 comments
Labels

Comments

@kongjun01
Copy link

Description

when apisix the reload, the eureka data is not ready (fetch_full_registry is not over), and there are many 502. Is there any solution.

Environment

  • APISIX version (run apisix version):2.10.5
  • 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):
@tzssangglass
Copy link
Member

I think discovery mode has this problem if it's a large amount of data.

We should allow users to specify that they have to wait for the fetch data to finish before providing the service, then APISIX will be interrupted during reload.

@tokers
Copy link
Contributor

tokers commented Jun 1, 2022

One solution is to let APISIX fetch all data from eureka in the init_worker phase. Just like the way we load data from ETCD.

@soulbird
Copy link
Contributor

soulbird commented Jun 1, 2022

One solution is to let APISIX fetch all data from eureka in the init_worker phase. Just like the way we load data from ETCD.

Looks like that's what it's doing now.

@tzssangglass
Copy link
Member

Looks like that's what it's doing now.

For eureka, it's not.

@kongjun01
Copy link
Author

kongjun01 commented Jun 1, 2022

I think discovery mode has this problem if it's a large amount of data.

We should allow users to specify that they have to wait for the fetch data to finish before providing the service, then APISIX will be interrupted during reload.

I considered that before.Our most front-end is Ali Cloud SLB, with a heartbeat mechanism.When the release is released, [-s quit], wait for SLB to think that APISIX has been offline, but there is a waiting time for heartbeat detection, during which SLB will still have traffic forward.Is it possible to stop all new requests outside after apisix receives the [-s quit] directive and then process requests received before closing.

@kongjun01
Copy link
Author

One solution is to let APISIX fetch all data from eureka in the init_worker phase. Just like the way we load data from ETCD.

The etcd is also asynchronous with the ngx_timer_at function, so how does it guarantee that the apisix provides the service after the data is fully loaded with the etcd?

@tokers
Copy link
Contributor

tokers commented Jun 2, 2022

One solution is to let APISIX fetch all data from eureka in the init_worker phase. Just like the way we load data from ETCD.

The etcd is also asynchronous with the ngx_timer_at function, so how does it guarantee that the apisix provides the service after the data is fully loaded with the etcd?

See https://github.com/apache/apisix/blob/master/conf/config-default.yaml#L159. That's the default behavior.

@soulbird
Copy link
Contributor

soulbird commented Jun 8, 2022

One solution is to let APISIX fetch all data from eureka in the init_worker phase. Just like the way we load data from ETCD.

The etcd is also asynchronous with the ngx_timer_at function, so how does it guarantee that the apisix provides the service after the data is fully loaded with the etcd?

We used luasocket instead of cosocket to load etcd configuration when apisix starts in init_worker phase

@kongjun01
Copy link
Author

One solution is to let APISIX fetch all data from eureka in the init_worker phase. Just like the way we load data from ETCD.

The etcd is also asynchronous with the ngx_timer_at function, so how does it guarantee that the apisix provides the service after the data is fully loaded with the etcd?

We used luasocket instead of cosocket to load etcd configuration when apisix starts in init_worker phase

perfect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants