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

portal和adminservice通信导致HA问题 #4948

Closed
whl12345 opened this issue Aug 2, 2023 · 4 comments
Closed

portal和adminservice通信导致HA问题 #4948

whl12345 opened this issue Aug 2, 2023 · 4 comments
Labels

Comments

@whl12345
Copy link

whl12345 commented Aug 2, 2023

portal与adminservice间的服务注册发现基于eureka,
如果adminservice部分节点重启,由于eureka是ap架构,导致portal获取adminservice列表通知不及时,通过压测portal写接口发现存在超时错误,如何改善?

@whl12345 whl12345 changed the title portal和adminservice通信问题 portal和adminservice通信导致HA问题 Aug 2, 2023
@whl12345
Copy link
Author

whl12345 commented Aug 2, 2023

排查apollo代码发现portal调用adminservice非get请求没有重试,如果eureka通知不及时,k8s环境下客户端请求失效服务端,易引发客户端超时

@dosubot
Copy link

dosubot bot commented Aug 2, 2023

Answer generated by a 🤖

Answer

为了改善Apollo配置管理系统中portal和adminservice之间的通信并防止高负载期间的超时错误,您可以考虑以下方法:

  1. 增加Eureka客户端的注册获取间隔:默认情况下,Eureka客户端每30秒获取一次注册。如果您的服务不经常更改,您可以增加此间隔以减少Eureka服务器和网络的负载。这可以通过在application.yml中添加以下配置来完成:
eureka:
  client:
    registryFetchIntervalSeconds: 60
  1. 启用Eureka客户端的缓存:启用缓存可以减少对Eureka服务器的请求次数。这可以通过在application.yml中添加以下配置来完成:
eureka:
  client:
    fetchRegistry: true
    cacheRefreshExecutorExpiryInSeconds: 300
    cacheRefreshExecutorIntervalInSeconds: 30
  1. 增加服务器超时:如果超时错误是由于服务器响应时间过长引起的,您可以增加服务器超时。这可以通过在application.yml中添加以下配置来完成:
server:
  tomcat:
    connectionTimeout: 20000
  1. 调整AdminServiceAddressLocator中的刷新间隔:在共享的上下文中,Apollo中的AdminServiceAddressLocator类有一个NORMAL_REFRESH_INTERVAL为5分钟,OFFLINE_REFRESH_INTERVAL为10秒。如果在重启某些adminservice节点时服务列表更新延迟,您可能需要减少NORMAL_REFRESH_INTERVAL或增加OFFLINE_REFRESH_INTERVAL。但是,请注意,这可能会增加系统的负载。

  2. 调整Eureka服务URL轮询间隔:在共享的上下文中,eurekaServiceUrlPollIntervalSeconds设置为60秒。这意味着Eureka客户端将每60秒向Eureka服务器轮询一次服务URL更新。如果在重启某些adminservice节点时服务列表更新延迟,您可能需要减少此间隔。但是,请注意,这可能会增加系统的负载。这可以通过在application.yml中修改以下配置来完成:

eureka:
  client:
    eurekaServiceUrlPollIntervalSeconds: 30

请注意,这些都是一般性建议,实际值可能需要根据您的特定用例和环境进行调整。

来源:

Sources


This response is meant to be useful, save you time, and share context. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

@stale
Copy link

stale bot commented Sep 3, 2023

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 3, 2023
@stale
Copy link

stale bot commented Sep 11, 2023

This issue has been automatically closed because it has not had activity in the last 7 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted". Thank you for your contributions.

@stale stale bot closed this as completed Sep 11, 2023
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

1 participant