Skip to content

Commit cbc3149

Browse files
authored
feat: Dynamic channel pool scaling (#194)
* feat: Dynamic channel pool scaling Provides dynamic scaling functionality which is configured with three parameters: - minRpcPerChannel -- minimum desired average concurrent calls per channel. - maxRpcPerChannel -- maximum desired average concurrent calls per channel. - scaleDownInterval -- how often to check for a possibility to scale down. When the average number of concurrent calls per channel reaches `maxRpcPerChannel` the pool will create and add a new channel unless already at max size. Every `scaleDownInterval` a check for downscaling is performed. Based on the maximum total concurrent calls observed since the last check, the desired number of channels is calculated as: `(max_total_concurrent_calls / minRpcPerChannel)` rounded up. If the calculated desired number of channels is lower than the current number of channels, the pool will be downscaled to the desired number or min size (whichever is greater). When downscaling, channels with the oldest connections are selected. Then the selected channels are removed from the pool but are not instructed to shutdown until all calls are completed. In a case when the pool is scaling up and there is a ready channel awaiting calls completion, the channel will be re-used instead of creating a new channel. * fix format to satisfy the linter * Add tests for dynamic pool scaling. * Lint: formatting * Fix dynamic channel pool test. * Fix dynamic scaling with affinity issue * Add comment for shouldScaleUp. Removed unused totalStreams.
1 parent 16a7640 commit cbc3149

8 files changed

Lines changed: 1132 additions & 119 deletions

File tree

grpc-gcp/build.gradle

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
plugins {
22
id 'java'
3-
id 'maven'
43
id 'maven-publish'
54
id 'signing'
6-
id 'com.google.protobuf' version '0.8.10'
7-
id 'com.github.sherter.google-java-format' version '0.8'
5+
id 'com.google.protobuf' version '0.9.4'
6+
id 'com.github.sherter.google-java-format' version '0.9'
87
id 'io.codearte.nexus-staging' version '0.8.0'
98
}
109

@@ -163,3 +162,8 @@ signing {
163162
sign publishing.publications.maven
164163
}
165164
}
165+
166+
googleJavaFormat {
167+
// Latest GJF that supports Java 8.
168+
toolVersion = "1.7"
169+
}

0 commit comments

Comments
 (0)