【问题标题】:How to limit the connections number Finagle creates?如何限制 Finagle 创建的连接数?
【发布时间】:2015-07-13 09:11:13
【问题描述】:

我使用 Finalge https://twitter.github.io/finagle/ 来测试超时情况,如下所示:

  1. 服务器端:在 RPC 定义中,只需休眠 10 秒并返回。
  2. 客户端:使用within调用RPC函数,如within(50.milliseconds) onSuccess { ... } onFailure { ... }
  3. 许多客户端:使用大约 100 个客户端同时调用 RPC 函数

结果当然是所有的 RPC 都超时了。但是,当我使用netstat 检查连接时,我发现有 100 个ESTABLISHED 连接。问题是我可以限制 Finagle 创建的连接数吗?

【问题讨论】:

    标签: scala tcp finagle twitter-finagle


    【解决方案1】:

    是的,你可以使用

    hostConnectionLimit(10)
    

    在您的 ClientBuilder 中限制与每个主机的连接。这里的“主机”是指服务器端的盒子。

    源码here.

    【讨论】:

      猜你喜欢
      • 2016-12-24
      • 1970-01-01
      • 1970-01-01
      • 2015-03-09
      • 2021-09-16
      • 1970-01-01
      • 1970-01-01
      • 2021-08-19
      • 2021-05-18
      相关资源
      最近更新 更多