Skip to content

Commit 1e463b3

Browse files
committed
[FLINK-38754][runtime] Avoid reverse DNS lookups when connecting to BlobServer
1 parent e42cdd1 commit 1e463b3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

flink-runtime/src/main/java/org/apache/flink/runtime/blob/BlobClient.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,12 @@ public BlobClient(InetSocketAddress serverAddress, Configuration clientConfig)
9292
}
9393

9494
// Establish the socket using the hostname and port. This avoids a potential issue where
95-
// the
96-
// InetSocketAddress can cache a failure in hostname resolution forever.
95+
// the InetSocketAddress can cache a failure in hostname resolution forever.
96+
// Use getHostString() instead of getHostName() to avoid unnecessary reverse DNS and DNS
97+
// lookups when addresses are specified as IP literals. This improves reliability and
98+
// reduces latency for each blob transfer.
9799
socket.connect(
98-
new InetSocketAddress(serverAddress.getHostName(), serverAddress.getPort()),
100+
new InetSocketAddress(serverAddress.getHostString(), serverAddress.getPort()),
99101
clientConfig.get(BlobServerOptions.CONNECT_TIMEOUT));
100102
socket.setSoTimeout(clientConfig.get(BlobServerOptions.SO_TIMEOUT));
101103
} catch (Exception e) {

0 commit comments

Comments
 (0)