Make disruptor_thrift_server invocation pool configurable

patch by Pavel Yaskevich; reviewed by Jason Brown for CASSANDRA-7594
This commit is contained in:
Pavel Yaskevich 2014-09-02 15:44:48 -07:00
parent 968ffd8dd3
commit b22089d7c8
4 changed files with 16 additions and 2 deletions

View File

@ -5,6 +5,7 @@
* Always reject inequality on the partition key without token()
(CASSANDRA-7722)
* Always send Paxos commit to all replicas (CASSANDRA-7479)
* Make disruptor_thrift_server invocation pool configurable (CASSANDRA-7594)
2.0.10

View File

@ -361,7 +361,7 @@
<dependency groupId="com.googlecode.json-simple" artifactId="json-simple" version="1.1"/>
<dependency groupId="com.github.stephenc.high-scale-lib" artifactId="high-scale-lib" version="1.1.2"/>
<dependency groupId="com.github.stephenc" artifactId="jamm" version="0.2.5"/>
<dependency groupId="com.thinkaurelius.thrift" artifactId="thrift-server" version="0.3.3"/>
<dependency groupId="com.thinkaurelius.thrift" artifactId="thrift-server" version="0.3.6"/>
<dependency groupId="org.yaml" artifactId="snakeyaml" version="1.11"/>
<dependency groupId="org.apache.thrift" artifactId="libthrift" version="0.9.1"/>
@ -467,7 +467,7 @@
<dependency groupId="org.mindrot" artifactId="jbcrypt"/>
<dependency groupId="com.yammer.metrics" artifactId="metrics-core"/>
<dependency groupId="com.addthis.metrics" artifactId="reporter-config"/>
<dependency groupId="com.thinkaurelius.thrift" artifactId="thrift-server" version="0.3.3"/>
<dependency groupId="com.thinkaurelius.thrift" artifactId="thrift-server" version="0.3.6"/>
<dependency groupId="net.sf.supercsv" artifactId="super-csv" version="2.1.0" />
<dependency groupId="log4j" artifactId="log4j"/>

View File

@ -19,9 +19,14 @@
package org.apache.cassandra.thrift;
import java.net.InetSocketAddress;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import com.thinkaurelius.thrift.Message;
import com.thinkaurelius.thrift.TDisruptorServer;
import org.apache.cassandra.concurrent.JMXEnabledThreadPoolExecutor;
import org.apache.cassandra.concurrent.NamedThreadFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -78,6 +83,13 @@ public class THsHaDisruptorServer extends TDisruptorServer
throw new RuntimeException(String.format("Unable to create thrift socket to %s:%s", addr.getAddress(), addr.getPort()), e);
}
ThreadPoolExecutor invoker = new JMXEnabledThreadPoolExecutor(DatabaseDescriptor.getRpcMinThreads(),
DatabaseDescriptor.getRpcMaxThreads(),
60L,
TimeUnit.SECONDS,
new SynchronousQueue<Runnable>(),
new NamedThreadFactory("RPC-Thread"), "RPC-THREAD-POOL");
com.thinkaurelius.thrift.util.TBinaryProtocol.Factory protocolFactory = new com.thinkaurelius.thrift.util.TBinaryProtocol.Factory(true, true);
TDisruptorServer.Args serverArgs = new TDisruptorServer.Args(serverTransport).useHeapBasedAllocation(true)
@ -87,6 +99,7 @@ public class THsHaDisruptorServer extends TDisruptorServer
.outputProtocolFactory(protocolFactory)
.processor(args.processor)
.maxFrameSizeInBytes(DatabaseDescriptor.getThriftFramedTransportSize())
.invocationExecutor(invoker)
.alwaysReallocateBuffers(true);
return new THsHaDisruptorServer(serverArgs);