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 模块 RestTemplate 支持配置 HTTP最大连接池和每个路由的连接大小 #5199

Closed
youngzil opened this issue Aug 14, 2024 · 0 comments · Fixed by #5200
Closed

Comments

@youngzil
Copy link
Contributor

你的特性请求和某个问题有关吗?请描述

  • 当前 portal 服务发现 调用Admin服务的时候,使用的是RestTemplate的连接池使用是默认的参数,默认是每个路由2,最大连接数20
    RestTemplateFactory
  • 在公司内部对 Apollo OpenAPI的接口 修改配置接口 和 发布配置接口 进行压测时,发现最大QPS只有200,但是CPU和线程还都比较空闲,使用Arthas查看所有的线程都卡在获取HTTP连接上,通过增加RestTemplate 的 connectionManager的MaxTotal(最大连接数) 和 MaxPerRoute(每个路由的连接大小)的大小解决并发问题

清晰简洁地描述一下你希望的解决方案
希望 Portal 模块 支持配置 RestTemplate 的 connectionManager的MaxTotal(最大连接数) 和 MaxPerRoute(每个路由的连接大小)

PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
connectionManager.setMaxTotal(portalConfig.connectPoolMaxTotal()); //最大连接数
connectionManager.setDefaultMaxPerRoute(portalConfig.connectPoolMaxPerRoute()); //每个路由(域名)最大连接数

在 PortalConfig 新增配置属性

public int connectPoolMaxTotal() {
    return getIntProperty("api.pool.max.total", 200);
  }

  public int connectPoolMaxPerRoute() {
    return getIntProperty("api.pool.max.per.route", 20);
  }

清晰简洁地描述一下这个特性的备选方案

其它背景

在这里添加和这个特性请求有关的背景说明、截图

youngzil added a commit to youngzil/apollo that referenced this issue Aug 14, 2024
nobodyiam pushed a commit that referenced this issue Aug 21, 2024
* feat: support portal restTemplate Client connection pool config

* feat: add CHANGES.md #5199

* style: remove chinese comments

* feat: add CHANGES.md #5200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant