HBASE-7972 allow configuring the TCP backlog on thrift services.
Author: Jean-Daniel Cryans Ammending-Author: Esteban Gutierrez Ammending-Author: Sean Busbey
This commit is contained in:
parent
1003d5a6d5
commit
a2dab027f6
|
@ -171,6 +171,7 @@ public class ThriftServerRunner implements Runnable {
|
||||||
* The thrift server and the HBase cluster must run in secure mode.
|
* The thrift server and the HBase cluster must run in secure mode.
|
||||||
*/
|
*/
|
||||||
static final String THRIFT_QOP_KEY = "hbase.thrift.security.qop";
|
static final String THRIFT_QOP_KEY = "hbase.thrift.security.qop";
|
||||||
|
static final String BACKLOG_CONF_KEY = "hbase.regionserver.thrift.backlog";
|
||||||
|
|
||||||
private static final String DEFAULT_BIND_ADDR = "0.0.0.0";
|
private static final String DEFAULT_BIND_ADDR = "0.0.0.0";
|
||||||
public static final int DEFAULT_LISTEN_PORT = 9090;
|
public static final int DEFAULT_LISTEN_PORT = 9090;
|
||||||
|
@ -515,6 +516,9 @@ public class ThriftServerRunner implements Runnable {
|
||||||
"-" + BIND_CONF_KEY + " not supported with " + implType);
|
"-" + BIND_CONF_KEY + " not supported with " + implType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Thrift's implementation uses '0' as a placeholder for 'use the default.'
|
||||||
|
int backlog = conf.getInt(BACKLOG_CONF_KEY, 0);
|
||||||
|
|
||||||
if (implType == ImplType.HS_HA || implType == ImplType.NONBLOCKING ||
|
if (implType == ImplType.HS_HA || implType == ImplType.NONBLOCKING ||
|
||||||
implType == ImplType.THREADED_SELECTOR) {
|
implType == ImplType.THREADED_SELECTOR) {
|
||||||
|
|
||||||
|
@ -560,7 +564,8 @@ public class ThriftServerRunner implements Runnable {
|
||||||
InetAddress listenAddress = getBindAddress(conf);
|
InetAddress listenAddress = getBindAddress(conf);
|
||||||
|
|
||||||
TServerTransport serverTransport = new TServerSocket(
|
TServerTransport serverTransport = new TServerSocket(
|
||||||
new InetSocketAddress(listenAddress, listenPort));
|
new TServerSocket.ServerSocketTransportArgs().
|
||||||
|
bindAddr(new InetSocketAddress(listenAddress, listenPort)).backlog(backlog));
|
||||||
|
|
||||||
TBoundedThreadPoolServer.Args serverArgs =
|
TBoundedThreadPoolServer.Args serverArgs =
|
||||||
new TBoundedThreadPoolServer.Args(serverTransport, conf);
|
new TBoundedThreadPoolServer.Args(serverTransport, conf);
|
||||||
|
|
|
@ -105,6 +105,8 @@ public class ThriftServer {
|
||||||
*/
|
*/
|
||||||
static final String THRIFT_QOP_KEY = "hbase.thrift.security.qop";
|
static final String THRIFT_QOP_KEY = "hbase.thrift.security.qop";
|
||||||
|
|
||||||
|
static final String BACKLOG_CONF_KEY = "hbase.regionserver.thrift.backlog";
|
||||||
|
|
||||||
public static final int DEFAULT_LISTEN_PORT = 9090;
|
public static final int DEFAULT_LISTEN_PORT = 9090;
|
||||||
|
|
||||||
|
|
||||||
|
@ -269,9 +271,12 @@ public class ThriftServer {
|
||||||
TProcessor processor,
|
TProcessor processor,
|
||||||
TTransportFactory transportFactory,
|
TTransportFactory transportFactory,
|
||||||
int workerThreads,
|
int workerThreads,
|
||||||
InetSocketAddress inetSocketAddress)
|
InetSocketAddress inetSocketAddress,
|
||||||
|
int backlog)
|
||||||
throws TTransportException {
|
throws TTransportException {
|
||||||
TServerTransport serverTransport = new TServerSocket(inetSocketAddress);
|
TServerTransport serverTransport = new TServerSocket(
|
||||||
|
new TServerSocket.ServerSocketTransportArgs().
|
||||||
|
bindAddr(inetSocketAddress).backlog(backlog));
|
||||||
log.info("starting HBase ThreadPool Thrift server on " + inetSocketAddress.toString());
|
log.info("starting HBase ThreadPool Thrift server on " + inetSocketAddress.toString());
|
||||||
TThreadPoolServer.Args serverArgs = new TThreadPoolServer.Args(serverTransport);
|
TThreadPoolServer.Args serverArgs = new TThreadPoolServer.Args(serverTransport);
|
||||||
serverArgs.processor(processor);
|
serverArgs.processor(processor);
|
||||||
|
@ -345,6 +350,9 @@ public class ThriftServer {
|
||||||
throw new RuntimeException("Could not parse the value provided for the port option", e);
|
throw new RuntimeException("Could not parse the value provided for the port option", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Thrift's implementation uses '0' as a placeholder for 'use the default.'
|
||||||
|
int backlog = conf.getInt(BACKLOG_CONF_KEY, 0);
|
||||||
|
|
||||||
// Local hostname and user name,
|
// Local hostname and user name,
|
||||||
// used only if QOP is configured.
|
// used only if QOP is configured.
|
||||||
String host = null;
|
String host = null;
|
||||||
|
@ -473,7 +481,8 @@ public class ThriftServer {
|
||||||
processor,
|
processor,
|
||||||
transportFactory,
|
transportFactory,
|
||||||
workerThreads,
|
workerThreads,
|
||||||
inetSocketAddress);
|
inetSocketAddress,
|
||||||
|
backlog);
|
||||||
}
|
}
|
||||||
|
|
||||||
final TServer tserver = server;
|
final TServer tserver = server;
|
||||||
|
|
Loading…
Reference in New Issue