Repository: spark Updated Branches: refs/heads/master b66b97cd0 -> 7320f9bd1
[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 <[email protected]> Closes #12046 from zsxwing/connection-time. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/7320f9bd Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/7320f9bd Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/7320f9bd Branch: refs/heads/master Commit: 7320f9bd190afb7639cd21e956e7300fdd84c0ee Parents: b66b97c Author: Shixiong Zhu <[email protected]> Authored: Tue Mar 29 21:14:48 2016 -0700 Committer: Shixiong Zhu <[email protected]> Committed: Tue Mar 29 21:14:48 2016 -0700 ---------------------------------------------------------------------- .../org/apache/spark/network/client/TransportClientFactory.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/7320f9bd/common/network-common/src/main/java/org/apache/spark/network/client/TransportClientFactory.java ---------------------------------------------------------------------- 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 f179bad..5a36e18 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; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
