Remove unreasonable default configurations for gRPC thread executor (#11639)
This commit is contained in:
parent
f6a7791053
commit
39c21e3b45
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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:""}
|
||||
|
|
|
|||
|
|
@ -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 | - |
|
||||
|
|
|
|||
|
|
@ -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"}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ public class CoreModuleConfig extends ModuleConfig {
|
|||
|
||||
private int gRPCThreadPoolSize;
|
||||
|
||||
private int gRPCThreadPoolQueueSize;
|
||||
/**
|
||||
* Timeout for cluster internal communication, in seconds.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<Runnable> 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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
uriRecognitionServerPort: ${SW_AI_PIPELINE_URI_RECOGNITION_SERVER_PORT:17128}
|
||||
|
|
|
|||
|
|
@ -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:""}
|
||||
|
|
|
|||
Loading…
Reference in New Issue