简体   繁体   English

Apache 节俭超时

[英]Apache Thrift timeout

I'm using apache thrift in version 0.13.0.我在 0.13.0 版本中使用 apache thrift。 As soon as the time between two calls is approximately 1.5 seconds the connection will be closed.一旦两次调用之间的时间大约为 1.5 秒,连接就会关闭。 The timeout varies from 1.3 to 1.8 seconds.超时时间从 1.3 到 1.8 秒不等。

keepAlive is set in server and client. keepAlive在服务器和客户端中设置。 I tried different for rx, tx but this did not change anything.我为 rx, tx 尝试了不同的方法,但这并没有改变任何东西。 My client code used for testing is below.我用于测试的客户端代码如下。 The client is using windows and the server is running linux.客户端使用 windows,服务器运行 linux。

  for (int i = 0; i < 100'000;i+=50){
    remote_method();
    auto sleep = std::chrono::milliseconds(i);
    std::cout << "Sleep: " << i << "\n";
    std::this_thread::sleep_for(sleep);
  }

Thrift will throw an exception in the code snippet below, which is located in TSocket.cpp Thrift 将在下面的代码片段中抛出异常,该代码片段位于 TSocket.cpp

// Timed out!
    if (errno_copy == THRIFT_ETIMEDOUT) {
      throw TTransportException(TTransportException::TIMED_OUT, "THRIFT_ETIMEDOUT");
    }

It looks like something is resetting the connection after this time.在这段时间之后,似乎有什么东西正在重置连接。 If the method is called with a high frequency no timeout occurs.如果以高频率调用该方法,则不会发生超时。

Thrift is working correctly, other socket based communication is showing this behavior as well. Thrift 工作正常,其他基于套接字的通信也显示此行为。 The root cause was the VMware virtual machine the server was running in. The network mode (briged, NAT, or host only) did not make a difference.根本原因是运行服务器的 VMware 虚拟机。网络模式(桥接、NAT 或仅主机)没有影响。 By moving the server to a physical machine the problem has been solved.通过将服务器移动到物理机上,问题已得到解决。 Most likely the network configuration of the linux is faulty. linux的网络配置很可能有问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM