diff --git a/cuebot/build.gradle b/cuebot/build.gradle index d4f00e193..4f93bd229 100644 --- a/cuebot/build.gradle +++ b/cuebot/build.gradle @@ -44,7 +44,7 @@ dependencies { compile group: 'com.google.guava', name: 'guava', version: '26.0-android' compile group: 'com.sun.mail', name: 'mailapi', version: '1.5.4' compile group: 'commons-lang', name: 'commons-lang', version: '2.6' - compile group: 'io.grpc', name: 'grpc-all', version: '1.14.0' + compile group: 'io.grpc', name: 'grpc-all', version: '1.36.2' compile group: 'org.apache.activemq', name: 'activemq-pool', version: activemqVersion compile group: 'org.apache.velocity', name: 'velocity', version: '1.7' compile group: 'org.jdom', name: 'jdom', version: '1.1.3' diff --git a/cuebot/src/main/java/com/imageworks/spcue/rqd/RqdClientGrpc.java b/cuebot/src/main/java/com/imageworks/spcue/rqd/RqdClientGrpc.java index 6aa6866ea..d9ad91cfd 100644 --- a/cuebot/src/main/java/com/imageworks/spcue/rqd/RqdClientGrpc.java +++ b/cuebot/src/main/java/com/imageworks/spcue/rqd/RqdClientGrpc.java @@ -53,21 +53,27 @@ public final class RqdClientGrpc implements RqdClient { private final int rqdCacheSize; private final int rqdCacheExpiration; + private final int rqdCacheConcurrency; private final int rqdServerPort; + private final int rqdTaskDeadlineSeconds; private LoadingCache channelCache; private boolean testMode = false; - public RqdClientGrpc(int rqdServerPort, int rqdCacheSize, int rqdCacheExpiration) { + public RqdClientGrpc(int rqdServerPort, int rqdCacheSize, int rqdCacheExpiration, + int rqdCacheConcurrency, int rqdTaskDeadline) { this.rqdServerPort = rqdServerPort; this.rqdCacheSize = rqdCacheSize; this.rqdCacheExpiration = rqdCacheExpiration; + this.rqdCacheConcurrency = rqdCacheConcurrency; + this.rqdTaskDeadlineSeconds = rqdTaskDeadline; } private void buildChannelCache() { this.channelCache = CacheBuilder.newBuilder() .maximumSize(rqdCacheSize) + .concurrencyLevel(rqdCacheConcurrency) .expireAfterAccess(rqdCacheExpiration, TimeUnit.MINUTES) .removalListener(new RemovalListener() { @Override @@ -80,8 +86,9 @@ public void onRemoval(RemovalNotification removal){ new CacheLoader() { @Override public ManagedChannel load(String host) throws Exception { - ManagedChannelBuilder channelBuilder = ManagedChannelBuilder.forAddress( - host, rqdServerPort).usePlaintext(); + ManagedChannelBuilder channelBuilder = ManagedChannelBuilder + .forAddress(host, rqdServerPort) + .usePlaintext(); return channelBuilder.build(); } }); @@ -92,7 +99,9 @@ private RqdInterfaceGrpc.RqdInterfaceBlockingStub getStub(String host) throws Ex buildChannelCache(); } ManagedChannel channel = channelCache.get(host); - return RqdInterfaceGrpc.newBlockingStub(channel); + return RqdInterfaceGrpc + .newBlockingStub(channel) + .withDeadlineAfter(rqdTaskDeadlineSeconds, TimeUnit.SECONDS); } private RunningFrameGrpc.RunningFrameBlockingStub getRunningFrameStub(String host) throws ExecutionException { @@ -100,7 +109,9 @@ private RunningFrameGrpc.RunningFrameBlockingStub getRunningFrameStub(String hos buildChannelCache(); } ManagedChannel channel = channelCache.get(host); - return RunningFrameGrpc.newBlockingStub(channel); + return RunningFrameGrpc + .newBlockingStub(channel) + .withDeadlineAfter(rqdTaskDeadlineSeconds, TimeUnit.SECONDS); } public void setHostLock(HostInterface host, LockState lock) { diff --git a/cuebot/src/main/resources/conf/spring/applicationContext-service.xml b/cuebot/src/main/resources/conf/spring/applicationContext-service.xml index 24bd94195..5f1738d69 100644 --- a/cuebot/src/main/resources/conf/spring/applicationContext-service.xml +++ b/cuebot/src/main/resources/conf/spring/applicationContext-service.xml @@ -46,6 +46,12 @@ ${grpc.rqd_cache_expiration} + + ${grpc.rqd_cache_concurrency} + + + ${grpc.rqd_task_deadline} + diff --git a/cuebot/src/main/resources/opencue.properties b/cuebot/src/main/resources/opencue.properties index 82404ee1c..4df5d601f 100644 --- a/cuebot/src/main/resources/opencue.properties +++ b/cuebot/src/main/resources/opencue.properties @@ -13,9 +13,13 @@ grpc.cue_port=${CUEBOT_GRPC_CUE_PORT:8443} grpc.rqd_server_port=${CUEBOT_GRPC_RQD_SERVER_PORT:8444} grpc.max_message_bytes=104857600 # Number of entries allowed in the RQD channel cache -grpc.rqd_cache_size=500 +grpc.rqd_cache_size=2000 # RQD Channel Cache Expiration in Minutes -grpc.rqd_cache_expiration=30 +grpc.rqd_cache_expiration=5 +# RQD Channel Cache expected concurrency +grpc.rqd_cache_concurrency=20 +# RQD Channel task deadline in seconds +grpc.rqd_task_deadline=10 # Whether or not to enable publishing to a messaging topic. # Set to a boolean value. See com/imageworks/spcue/services/JmsMover.java. diff --git a/cuebot/src/test/resources/opencue.properties b/cuebot/src/test/resources/opencue.properties index 38dc15ea9..5ac924592 100644 --- a/cuebot/src/test/resources/opencue.properties +++ b/cuebot/src/test/resources/opencue.properties @@ -8,6 +8,10 @@ grpc.max_message_bytes=104857600 grpc.rqd_cache_size=500 # RQD Channel Cache Expiration in Minutes grpc.rqd_cache_expiration=30 +# RQD Channel Cache expected concurrency +grpc.rqd_cache_concurrency=20 +# RQD Channel task deadline in seconds +grpc.rqd_task_deadline=10 log.frame-log-root=/arbitraryLogDirectory