Skip to content

Commit

Permalink
Added configuration for thrift.
Browse files Browse the repository at this point in the history
 - Allow setting max # of thrift worker threads
   and the request timeout.
  • Loading branch information
danielbwatson committed May 5, 2016
1 parent 2893b63 commit 608eef9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public class ArchaiusConfigImpl implements Config {
private final DynamicStringProperty lookupServiceUserAdmin;
private final DynamicStringProperty pluginConfigLocation;
private final DynamicStringProperty tagServiceUserAdmin;
private final DynamicIntProperty thriftMaxWorkerThreadsSize;
private final DynamicIntProperty thriftRequestTimeoutInSeconds;
private final DynamicStringProperty metacatVersion;
private final DynamicBooleanProperty usePigTypes;
private final DynamicIntProperty serviceMaxNumberOfThreads;
Expand Down Expand Up @@ -76,6 +78,8 @@ public ArchaiusConfigImpl(DynamicPropertyFactory factory) {
this.metacatVersion = factory.getStringProperty("netflix.appinfo.version", "1.0.0");
this.pluginConfigLocation = factory.getStringProperty("metacat.plugin.config.location", null);
this.tagServiceUserAdmin = factory.getStringProperty("metacat.tag_service.user_admin", "admin");
this.thriftMaxWorkerThreadsSize = factory.getIntProperty("metacat.thrift.max_worker_threads", 100);
this.thriftRequestTimeoutInSeconds = factory.getIntProperty("metacat.thrift.request_timeout_in_seconds", 300);
this.usePigTypes = factory.getBooleanProperty("metacat.franklin.connector.use.pig.type", true);
this.serviceMaxNumberOfThreads = factory.getIntProperty("metacat.service.max.number.threads", 50);

Expand Down Expand Up @@ -176,6 +180,16 @@ public String getTagServiceUserAdmin() {
return tagServiceUserAdmin.get();
}

@Override
public int getThriftMaxWorkerThreadsSize() {
return thriftMaxWorkerThreadsSize.get();
}

@Override
public int getThriftRequestTimeoutInSeconds() {
return thriftRequestTimeoutInSeconds.get();
}

@Override
public boolean isEpochInSeconds() {
return epochInSeconds.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public interface Config {
String getMetacatVersion();
String getPluginConfigLocation();
String getTagServiceUserAdmin();
int getThriftMaxWorkerThreadsSize();
int getThriftRequestTimeoutInSeconds();
boolean isEpochInSeconds();
boolean isUsePigTypes();
int getServiceMaxNumberOfThreads();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.TimeUnit;

public class CatalogThriftService {
private static final Logger log = LoggerFactory.getLogger(CatalogThriftService.class);
private final String catalogName;
Expand Down Expand Up @@ -57,7 +59,11 @@ public void start() throws Exception {
handler);

TServerTransport serverTransport = new TServerSocket(portNumber);
TThreadPoolServer.Args serverArgs = new TThreadPoolServer.Args(serverTransport).processor(processor);
TThreadPoolServer.Args serverArgs = new TThreadPoolServer.Args(serverTransport)
.processor(processor)
.maxWorkerThreads(config.getThriftMaxWorkerThreadsSize())
.requestTimeout(config.getThriftRequestTimeoutInSeconds())
.requestTimeoutUnit(TimeUnit.SECONDS);
server = new TThreadPoolServer(serverArgs);
server.setServerEventHandler(new CatalogThriftEventHandler());

Expand Down

0 comments on commit 608eef9

Please sign in to comment.