diff options
author | Shixiong Zhu <shixiong@databricks.com> | 2016-03-29 21:14:48 -0700 |
---|---|---|
committer | Shixiong Zhu <shixiong@databricks.com> | 2016-03-29 21:14:48 -0700 |
commit | 7320f9bd190afb7639cd21e956e7300fdd84c0ee (patch) | |
tree | 6bfabd9e1d9328c3023a6697012a45658143e8b6 | |
parent | b66b97cd04067e1ec344fa2e28dd91e7ef937af5 (diff) | |
download | spark-7320f9bd190afb7639cd21e956e7300fdd84c0ee.tar.gz spark-7320f9bd190afb7639cd21e956e7300fdd84c0ee.tar.bz2 spark-7320f9bd190afb7639cd21e956e7300fdd84c0ee.zip |
[SPARK-14254][CORE] Add logs to help investigate the network performance
## What changes were proposed in this pull request?
It would be very helpful for network performance investigation if we log the time spent on connecting and resolving host.
## How was this patch tested?
Jenkins unit tests.
Author: Shixiong Zhu <shixiong@databricks.com>
Closes #12046 from zsxwing/connection-time.
-rw-r--r-- | common/network-common/src/main/java/org/apache/spark/network/client/TransportClientFactory.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/common/network-common/src/main/java/org/apache/spark/network/client/TransportClientFactory.java b/common/network-common/src/main/java/org/apache/spark/network/client/TransportClientFactory.java index f179bad1f4..5a36e18b09 100644 --- a/common/network-common/src/main/java/org/apache/spark/network/client/TransportClientFactory.java +++ b/common/network-common/src/main/java/org/apache/spark/network/client/TransportClientFactory.java @@ -123,7 +123,10 @@ public class TransportClientFactory implements Closeable { public TransportClient createClient(String remoteHost, int remotePort) throws IOException { // Get connection from the connection pool first. // If it is not found or not active, create a new one. + long preResolveHost = System.nanoTime(); final InetSocketAddress address = new InetSocketAddress(remoteHost, remotePort); + long hostResolveTimeMs = (System.nanoTime() - preResolveHost) / 1000000; + logger.info("Spent {} ms to resolve {}", hostResolveTimeMs, address); // Create the ClientPool if we don't have it yet. ClientPool clientPool = connectionPool.get(address); @@ -235,7 +238,7 @@ public class TransportClientFactory implements Closeable { } long postBootstrap = System.nanoTime(); - logger.debug("Successfully created connection to {} after {} ms ({} ms spent in bootstraps)", + logger.info("Successfully created connection to {} after {} ms ({} ms spent in bootstraps)", address, (postBootstrap - preConnect) / 1000000, (postBootstrap - preBootstrap) / 1000000); return client; |