Skip to content

Commit 763b83e

Browse files
xu.zhangzsxwing
authored andcommitted
[SPARK-21701][CORE] Enable RPC client to use SO_RCVBUF and SO_SNDBUF in SparkConf.
## What changes were proposed in this pull request? TCP parameters like SO_RCVBUF and SO_SNDBUF can be set in SparkConf, and `org.apache.spark.network.server.TransportServe`r can use those parameters to build server by leveraging netty. But for TransportClientFactory, there is no such way to set those parameters from SparkConf. This could be inconsistent in server and client side when people set parameters in SparkConf. So this PR make RPC client to be enable to use those TCP parameters as well. ## How was this patch tested? Existing tests. Author: xu.zhang <[email protected]> Closes apache#18964 from neoremind/add_client_param.
1 parent d3abb36 commit 763b83e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

common/network-common/src/main/java/org/apache/spark/network/client/TransportClientFactory.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,14 @@ private TransportClient createClient(InetSocketAddress address)
210210
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, conf.connectionTimeoutMs())
211211
.option(ChannelOption.ALLOCATOR, pooledAllocator);
212212

213+
if (conf.receiveBuf() > 0) {
214+
bootstrap.option(ChannelOption.SO_RCVBUF, conf.receiveBuf());
215+
}
216+
217+
if (conf.sendBuf() > 0) {
218+
bootstrap.option(ChannelOption.SO_SNDBUF, conf.sendBuf());
219+
}
220+
213221
final AtomicReference<TransportClient> clientRef = new AtomicReference<>();
214222
final AtomicReference<Channel> channelRef = new AtomicReference<>();
215223

0 commit comments

Comments
 (0)