0

I was wondering what's the significance of different units of time used while specifying http client timeouts. Connection Timeout is in milliseconds, idle timeout in seconds, and read-timeout in milliseconds.

  1. Does vertx use different precisions to determine the accuracy with which the timeout should be triggered?

  2. How is the timeout triggered?

I'm using https://vertx.io/docs/apidocs/io/vertx/core/http/HttpClientRequest.html

1 Answers1

0

In general, not related to Vert.x:
connection timeout < read timeout < idle timeout
More specifically, to check if connection is idle may take tens on milliseconds. Hence it's not optimal to allow setting this values in milliseconds in the first place, since then there may be situations when time to check idle connection is greater than idle timeout.

HttpClientRequest provides only one timeout. Probably your question is about WebClientOptions, that indeed provides different timeouts:
https://vertx.io/docs/apidocs/io/vertx/ext/web/client/WebClientOptions.html

If you're interested in how it's actually used, you can take a look at NetClientImpl source code:

https://github.com/eclipse-vertx/vert.x/blob/master/src/main/java/io/vertx/core/net/impl/NetClientImpl.java#L103

Alexey Soshin
  • 16,718
  • 2
  • 31
  • 40