diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md index 1c9735099a..2e245bd334 100644 --- a/docs/en/changes/changes.md +++ b/docs/en/changes/changes.md @@ -6,6 +6,9 @@ #### OAP Server * Add `layer` parameter to the global topology graphQL query. * Add `is_present` function in MQE for check if the list metrics has a value or not. +* Remove unreasonable default configurations for gRPC thread executor. +* Remove `gRPCThreadPoolQueueSize (SW_RECEIVER_GRPC_POOL_QUEUE_SIZE)` + configuration. #### UI * Fix the mismatch between the unit and calculation of the "Network Bandwidth Usage" widget in Linux-Service Dashboard. diff --git a/docs/en/setup/backend/backend-expose.md b/docs/en/setup/backend/backend-expose.md index 49345249fd..f016ebd7b2 100644 --- a/docs/en/setup/backend/backend-expose.md +++ b/docs/en/setup/backend/backend-expose.md @@ -23,7 +23,6 @@ receiver-sharing-server: gRPCPort: ${SW_RECEIVER_GRPC_PORT:0} maxConcurrentCallsPerConnection: ${SW_RECEIVER_GRPC_MAX_CONCURRENT_CALL:0} maxMessageSize: ${SW_RECEIVER_GRPC_MAX_MESSAGE_SIZE:0} - gRPCThreadPoolQueueSize: ${SW_RECEIVER_GRPC_POOL_QUEUE_SIZE:0} gRPCThreadPoolSize: ${SW_RECEIVER_GRPC_THREAD_POOL_SIZE:0} gRPCSslEnabled: ${SW_RECEIVER_GRPC_SSL_ENABLED:false} gRPCSslKeyPath: ${SW_RECEIVER_GRPC_SSL_KEY_PATH:""} diff --git a/docs/en/setup/backend/configuration-vocabulary.md b/docs/en/setup/backend/configuration-vocabulary.md index cb4d539a3a..ceec116d0e 100644 --- a/docs/en/setup/backend/configuration-vocabulary.md +++ b/docs/en/setup/backend/configuration-vocabulary.md @@ -36,8 +36,7 @@ The Configuration Vocabulary lists all available configurations provided by `app | - | - | searchableAlarmTags | Defines a set of alarm tag keys which are searchable through GraphQL. Multiple values are separated by commas. The max length of key=value should be less than 256 or will be dropped. | SW_SEARCHABLE_ALARM_TAG_KEYS | level | | - | - | autocompleteTagKeysQueryMaxSize | The max size of tags keys for autocomplete select. | SW_AUTOCOMPLETE_TAG_KEYS_QUERY_MAX_SIZE | 100 | | - | - | autocompleteTagValuesQueryMaxSize | The max size of tags values for autocomplete select. | SW_AUTOCOMPLETE_TAG_VALUES_QUERY_MAX_SIZE | 100 | -| - | - | gRPCThreadPoolSize | Pool size of gRPC server. | SW_CORE_GRPC_THREAD_POOL_SIZE | CPU core * 4 | -| - | - | gRPCThreadPoolQueueSize | Queue size of gRPC server. | SW_CORE_GRPC_POOL_QUEUE_SIZE | 10000 | +| - | - | gRPCThreadPoolSize | Pool size of gRPC server. | SW_CORE_GRPC_THREAD_POOL_SIZE | Default to gRPC's implementation, which is a cached thread pool that can grow infinitely. | | - | - | maxConcurrentCallsPerConnection | The maximum number of concurrent calls permitted for each incoming connection. Defaults to no limit. | SW_CORE_GRPC_MAX_CONCURRENT_CALL | - | | - | - | maxMessageSize | Sets the maximum message size allowed to be received on the server. Empty means 4 MiB. | SW_CORE_GRPC_MAX_MESSAGE_SIZE | 4M(based on Netty) | | - | - | remoteTimeout | Timeout for cluster internal communication (in seconds). | - | 20 | @@ -166,8 +165,7 @@ The Configuration Vocabulary lists all available configurations provided by `app | - | - | httpMaxRequestHeaderSize | Maximum request header size accepted. | SW_RECEIVER_SHARING_HTTP_MAX_REQUEST_HEADER_SIZE | 8192 | | - | - | gRPCHost | Binding IP of gRPC services. Services include gRPC data report and internal communication among OAP nodes. | SW_RECEIVER_GRPC_HOST | 0.0.0.0. Not Activated | | - | - | gRPCPort | Binding port of gRPC services. | SW_RECEIVER_GRPC_PORT | Not Activated | -| - | - | gRPCThreadPoolSize | Pool size of gRPC server. | SW_RECEIVER_GRPC_THREAD_POOL_SIZE | CPU core * 4 | -| - | - | gRPCThreadPoolQueueSize | Queue size of gRPC server. | SW_RECEIVER_GRPC_POOL_QUEUE_SIZE | 10000 | +| - | - | gRPCThreadPoolSize | Pool size of gRPC server. | SW_RECEIVER_GRPC_THREAD_POOL_SIZE | Default to gRPC's implementation, which is a cached thread pool that can grow infinitely. | | - | - | gRPCSslEnabled | Activates SSL for gRPC services. | SW_RECEIVER_GRPC_SSL_ENABLED | false | | - | - | gRPCSslKeyPath | File path of gRPC SSL key. | SW_RECEIVER_GRPC_SSL_KEY_PATH | - | | - | - | gRPCSslCertChainPath | File path of gRPC SSL cert chain. | SW_RECEIVER_GRPC_SSL_CERT_CHAIN_PATH | - | diff --git a/docs/en/setup/backend/grpc-security.md b/docs/en/setup/backend/grpc-security.md index f1b55e7271..59f7835678 100644 --- a/docs/en/setup/backend/grpc-security.md +++ b/docs/en/setup/backend/grpc-security.md @@ -79,7 +79,6 @@ receiver-sharing-server: gRPCPort: ${SW_RECEIVER_GRPC_PORT:"changeMe"} maxConcurrentCallsPerConnection: ${SW_RECEIVER_GRPC_MAX_CONCURRENT_CALL:0} maxMessageSize: ${SW_RECEIVER_GRPC_MAX_MESSAGE_SIZE:0} - gRPCThreadPoolQueueSize: ${SW_RECEIVER_GRPC_POOL_QUEUE_SIZE:0} gRPCThreadPoolSize: ${SW_RECEIVER_GRPC_THREAD_POOL_SIZE:0} gRPCSslEnabled: ${SW_RECEIVER_GRPC_SSL_ENABLED:true} gRPCSslKeyPath: ${SW_RECEIVER_GRPC_SSL_KEY_PATH:"/path/to/server.pem"} diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleConfig.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleConfig.java index 8b4f2330a4..61f7f57780 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleConfig.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleConfig.java @@ -77,7 +77,6 @@ public class CoreModuleConfig extends ModuleConfig { private int gRPCThreadPoolSize; - private int gRPCThreadPoolQueueSize; /** * Timeout for cluster internal communication, in seconds. */ diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java index 5599aeba2e..103572ee42 100755 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java @@ -230,9 +230,6 @@ public class CoreModuleProvider extends ModuleProvider { if (moduleConfig.getMaxMessageSize() > 0) { grpcServer.setMaxMessageSize(moduleConfig.getMaxMessageSize()); } - if (moduleConfig.getGRPCThreadPoolQueueSize() > 0) { - grpcServer.setThreadPoolQueueSize(moduleConfig.getGRPCThreadPoolQueueSize()); - } if (moduleConfig.getGRPCThreadPoolSize() > 0) { grpcServer.setThreadPoolSize(moduleConfig.getGRPCThreadPoolSize()); } diff --git a/oap-server/server-library/library-server/src/main/java/org/apache/skywalking/oap/server/library/server/grpc/GRPCServer.java b/oap-server/server-library/library-server/src/main/java/org/apache/skywalking/oap/server/library/server/grpc/GRPCServer.java index 656f92593a..c726e3b124 100644 --- a/oap-server/server-library/library-server/src/main/java/org/apache/skywalking/oap/server/library/server/grpc/GRPCServer.java +++ b/oap-server/server-library/library-server/src/main/java/org/apache/skywalking/oap/server/library/server/grpc/GRPCServer.java @@ -26,9 +26,9 @@ import io.grpc.netty.NettyServerBuilder; import java.io.IOException; import java.net.InetSocketAddress; import java.util.Optional; -import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ExecutorService; import java.util.concurrent.RejectedExecutionHandler; +import java.util.concurrent.SynchronousQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import lombok.extern.slf4j.Slf4j; @@ -50,14 +50,11 @@ public class GRPCServer implements Server { private String privateKeyFile; private String trustedCAsFile; private DynamicSslContext sslContext; - private int threadPoolSize = Runtime.getRuntime().availableProcessors() * 4; - private int threadPoolQueueSize = 10000; + private int threadPoolSize; public GRPCServer(String host, int port) { this.host = host; this.port = port; - this.maxConcurrentCallsPerConnection = 4; - this.maxMessageSize = Integer.MAX_VALUE; } public void setMaxConcurrentCallsPerConnection(int maxConcurrentCallsPerConnection) { @@ -72,10 +69,6 @@ public class GRPCServer implements Server { this.threadPoolSize = threadPoolSize; } - public void setThreadPoolQueueSize(int threadPoolQueueSize) { - this.threadPoolQueueSize = threadPoolQueueSize; - } - /** * Require for `server.crt` and `server.pem` for open ssl at server side. * @@ -92,15 +85,22 @@ public class GRPCServer implements Server { @Override public void initialize() { InetSocketAddress address = new InetSocketAddress(host, port); - ArrayBlockingQueue blockingQueue = new ArrayBlockingQueue<>(threadPoolQueueSize); - ExecutorService executor = new ThreadPoolExecutor( - threadPoolSize, threadPoolSize, 60, TimeUnit.SECONDS, blockingQueue, - new CustomThreadFactory("grpcServerPool"), new CustomRejectedExecutionHandler() - ); nettyServerBuilder = NettyServerBuilder.forAddress(address); - nettyServerBuilder = nettyServerBuilder.maxConcurrentCallsPerConnection(maxConcurrentCallsPerConnection) - .maxInboundMessageSize(maxMessageSize) - .executor(executor); + + if (maxConcurrentCallsPerConnection > 0) { + nettyServerBuilder.maxConcurrentCallsPerConnection(maxConcurrentCallsPerConnection); + } + if (maxMessageSize > 0) { + nettyServerBuilder.maxInboundMessageSize(maxMessageSize); + } + if (threadPoolSize > 0) { + ExecutorService executor = new ThreadPoolExecutor( + threadPoolSize, threadPoolSize, 60, TimeUnit.SECONDS, new SynchronousQueue<>(), + new CustomThreadFactory("grpcServerPool"), new CustomRejectedExecutionHandler() + ); + nettyServerBuilder.executor(executor); + } + if (!Strings.isNullOrEmpty(privateKeyFile) && !Strings.isNullOrEmpty(certChainFile)) { sslContext = DynamicSslContext.forServer(privateKeyFile, certChainFile, trustedCAsFile); nettyServerBuilder.sslContext(sslContext); @@ -109,10 +109,9 @@ public class GRPCServer implements Server { } static class CustomRejectedExecutionHandler implements RejectedExecutionHandler { - @Override public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { - log.warn("Grpc server thread pool is full, rejecting the task"); + log.warn("Task {} rejected from {}", r.toString(), executor.toString()); } } diff --git a/oap-server/server-receiver-plugin/skywalking-sharing-server-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/sharing/server/SharingServerConfig.java b/oap-server/server-receiver-plugin/skywalking-sharing-server-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/sharing/server/SharingServerConfig.java index 44e45db7e3..06ae12fb26 100644 --- a/oap-server/server-receiver-plugin/skywalking-sharing-server-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/sharing/server/SharingServerConfig.java +++ b/oap-server/server-receiver-plugin/skywalking-sharing-server-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/sharing/server/SharingServerConfig.java @@ -43,7 +43,6 @@ public class SharingServerConfig extends ModuleConfig { private int maxConcurrentCallsPerConnection; private int maxMessageSize; private int gRPCThreadPoolSize; - private int gRPCThreadPoolQueueSize; private String authentication; private boolean gRPCSslEnabled = false; private String gRPCSslKeyPath; diff --git a/oap-server/server-receiver-plugin/skywalking-sharing-server-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/sharing/server/SharingServerModuleProvider.java b/oap-server/server-receiver-plugin/skywalking-sharing-server-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/sharing/server/SharingServerModuleProvider.java index 780c4558fd..bfd78ab7a4 100644 --- a/oap-server/server-receiver-plugin/skywalking-sharing-server-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/sharing/server/SharingServerModuleProvider.java +++ b/oap-server/server-receiver-plugin/skywalking-sharing-server-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/sharing/server/SharingServerModuleProvider.java @@ -125,9 +125,6 @@ public class SharingServerModuleProvider extends ModuleProvider { if (config.getMaxConcurrentCallsPerConnection() > 0) { grpcServer.setMaxConcurrentCallsPerConnection(config.getMaxConcurrentCallsPerConnection()); } - if (config.getGRPCThreadPoolQueueSize() > 0) { - grpcServer.setThreadPoolQueueSize(config.getGRPCThreadPoolQueueSize()); - } if (config.getGRPCThreadPoolSize() > 0) { grpcServer.setThreadPoolSize(config.getGRPCThreadPoolSize()); } diff --git a/oap-server/server-starter/src/main/resources/application.yml b/oap-server/server-starter/src/main/resources/application.yml index 44680896cb..26d345372d 100644 --- a/oap-server/server-starter/src/main/resources/application.yml +++ b/oap-server/server-starter/src/main/resources/application.yml @@ -82,7 +82,6 @@ core: gRPCPort: ${SW_CORE_GRPC_PORT:11800} maxConcurrentCallsPerConnection: ${SW_CORE_GRPC_MAX_CONCURRENT_CALL:0} maxMessageSize: ${SW_CORE_GRPC_MAX_MESSAGE_SIZE:0} - gRPCThreadPoolQueueSize: ${SW_CORE_GRPC_POOL_QUEUE_SIZE:-1} gRPCThreadPoolSize: ${SW_CORE_GRPC_THREAD_POOL_SIZE:-1} gRPCSslEnabled: ${SW_CORE_GRPC_SSL_ENABLED:false} gRPCSslKeyPath: ${SW_CORE_GRPC_SSL_KEY_PATH:""} @@ -268,7 +267,6 @@ receiver-sharing-server: gRPCPort: ${SW_RECEIVER_GRPC_PORT:0} maxConcurrentCallsPerConnection: ${SW_RECEIVER_GRPC_MAX_CONCURRENT_CALL:0} maxMessageSize: ${SW_RECEIVER_GRPC_MAX_MESSAGE_SIZE:0} - gRPCThreadPoolQueueSize: ${SW_RECEIVER_GRPC_POOL_QUEUE_SIZE:0} gRPCThreadPoolSize: ${SW_RECEIVER_GRPC_THREAD_POOL_SIZE:0} gRPCSslEnabled: ${SW_RECEIVER_GRPC_SSL_ENABLED:false} gRPCSslKeyPath: ${SW_RECEIVER_GRPC_SSL_KEY_PATH:""} @@ -580,4 +578,4 @@ ai-pipeline: selector: ${SW_AI_PIPELINE:default} default: uriRecognitionServerAddr: ${SW_AI_PIPELINE_URI_RECOGNITION_SERVER_ADDR:} - uriRecognitionServerPort: ${SW_AI_PIPELINE_URI_RECOGNITION_SERVER_PORT:17128} \ No newline at end of file + uriRecognitionServerPort: ${SW_AI_PIPELINE_URI_RECOGNITION_SERVER_PORT:17128} diff --git a/oap-server/server-tools/data-generator/src/main/resources/application.yml b/oap-server/server-tools/data-generator/src/main/resources/application.yml index dc5f1d3502..083a10d141 100755 --- a/oap-server/server-tools/data-generator/src/main/resources/application.yml +++ b/oap-server/server-tools/data-generator/src/main/resources/application.yml @@ -34,7 +34,6 @@ core: gRPCPort: ${SW_CORE_GRPC_PORT:11800} maxConcurrentCallsPerConnection: ${SW_CORE_GRPC_MAX_CONCURRENT_CALL:0} maxMessageSize: ${SW_CORE_GRPC_MAX_MESSAGE_SIZE:0} - gRPCThreadPoolQueueSize: ${SW_CORE_GRPC_POOL_QUEUE_SIZE:-1} gRPCThreadPoolSize: ${SW_CORE_GRPC_THREAD_POOL_SIZE:-1} gRPCSslEnabled: ${SW_CORE_GRPC_SSL_ENABLED:false} gRPCSslKeyPath: ${SW_CORE_GRPC_SSL_KEY_PATH:""}