配置手册

This commit is contained in:
三丙
2024-10-29 17:16:02 +08:00
parent aa0eb5f568
commit 23812a5ef1
4 changed files with 46 additions and 46 deletions

View File

@@ -176,17 +176,17 @@ service:
sessions:
default-inactivity-timeout-in-sec: "${SERVICE_PROTOCOLS_SESSIONS_DEFAULT_INACTIVITY_TIMEOUT_IN_SEC:600}"
default-state-check-interval-in-sec: "${SERVICE_PROTOCOLS_SESSIONS_DEFAULT_STATE_CHECK_INTERVAL_IN_SEC:60}"
rpc:
port: "${SERVICE_PROTOCOL_RPC_PORT:9090}"
boss: "${SERVICE_PROTOCOL_RPC_BOSS:4}"
worker: "${SERVICE_PROTOCOL_RPC_WORKER:64}"
so-rcvbuf: "${SERVICE_PROTOCOL_RPC_SO_RCVBUF:65535}"
so-sndbuf: "${SERVICE_PROTOCOL_RPC_SO_SNDBUF:65535}"
no-delay: "${SERVICE_PROTOCOL_RPC_NO_DELAY:true}"
user-thread-pool-size: "${SERVICE_PROTOCOL_RPC_USER_THREAD_POOL_SIZE:1024}"
max-inbound-message-size: "${SERVICE_PROTOCOL_RPC_MAX_INBOUND_MESSAGE_SIZE:33554432}"
max-concurrent-calls-per-connection: "${SERVICE_PROTOCOL_MAX_CONCURRENT_CALLS_PER_CONNECTION:4}"
client-max-keep-alive-time-sec: "${SERVICE_PROTOCOL_RPC_CLIENT_MAX_KEEP_ALIVE_TIME_SEC:30}"
grpc:
port: "${SERVICE_PROTOCOL_GRPC_PORT:9090}"
boss: "${SERVICE_PROTOCOL_GRPC_BOSS:4}"
worker: "${SERVICE_PROTOCOL_GRPC_WORKER:64}"
so-rcvbuf: "${SERVICE_PROTOCOL_GRPC_SO_RCVBUF:65535}"
so-sndbuf: "${SERVICE_PROTOCOL_GRPC_SO_SNDBUF:65535}"
no-delay: "${SERVICE_PROTOCOL_GRPC_NO_DELAY:true}"
user-thread-pool-size: "${SERVICE_PROTOCOL_GRPC_USER_THREAD_POOL_SIZE:1024}"
max-inbound-message-size: "${SERVICE_PROTOCOL_GRPC_MAX_INBOUND_MESSAGE_SIZE:33554432}"
max-concurrent-calls-per-connection: "${SERVICE_PROTOCOL_GRPC_MAX_CONCURRENT_CALLS_PER_CONNECTION:4}"
client-max-keep-alive-time-sec: "${SERVICE_PROTOCOL_GRPC_CLIENT_MAX_KEEP_ALIVE_TIME_SEC:30}"
protocols:
yunkuaichongV150:
enabled: "${PROTOCOLS_YUNKUAICHONGV150_ENABLED:true}"

View File

@@ -45,10 +45,10 @@ import static sanbing.jcpp.infrastructure.proto.ProtoConverter.toTracerProto;
@Slf4j
public class DownlinkGrpcClient {
@Value("${downlink.rpc.grpc.netty.event_loop:}")
@Value("${service.downlink.rpc.grpc.netty.event_loop:}")
private Integer rpcNettyEventLoop;
@Value("${downlink.rpc.grpc.netty.so_sndbuf:65535}")
@Value("${service.downlink.rpc.grpc.netty.so_sndbuf:65535}")
private Integer rpcNettySoSndbuf;
@Value("${service.downlink.rpc.grpc.netty.so_rcvbuf:65535}")

View File

@@ -41,23 +41,23 @@ import static sanbing.jcpp.infrastructure.util.config.ThreadPoolConfiguration.JC
@Slf4j
@ConditionalOnExpression("'${service.type:null}'=='monolith' || '${service.type:null}'=='protocol'")
public class DownlinkGrpcService extends ProtocolInterfaceImplBase {
@Value("${service.protocol.rpc.port}")
private int rpcPort;
@Value("${service.protocol.rpc.boss}")
private int rpcBoss;
@Value("${service.protocol.rpc.worker}")
private int rpcWorker;
@Value("${service.protocol.rpc.so-rcvbuf}")
private int rpcNettySoRcvbuf;
@Value("${service.protocol.rpc.so-sndbuf}")
private int rpcNettySoSndbuf;
@Value("${service.protocol.rpc.no-delay}")
private boolean rpcNettyNoDelay;
@Value("${service.protocol.rpc.max-inbound-message-size}")
@Value("${service.protocol.grpc.port}")
private int grpcPort;
@Value("${service.protocol.grpc.boss}")
private int grpcBoss;
@Value("${service.protocol.grpc.worker}")
private int grpcWorker;
@Value("${service.protocol.grpc.so-rcvbuf}")
private int grpcNettySoRcvbuf;
@Value("${service.protocol.grpc.so-sndbuf}")
private int grpcNettySoSndbuf;
@Value("${service.protocol.grpc.no-delay}")
private boolean grpcNettyNoDelay;
@Value("${service.protocol.grpc.max-inbound-message-size}")
private int maxInboundMessageSize;
@Value("${service.protocol.rpc.max-concurrent-calls-per-connection}")
@Value("${service.protocol.grpc.max-concurrent-calls-per-connection}")
private int maxConcurrentCallsPerConnection;
@Value("${service.protocol.rpc.client-max-keep-alive-time-sec}")
@Value("${service.protocol.grpc.client-max-keep-alive-time-sec}")
private int clientMaxKeepAliveTimeSec;
@Resource
@@ -70,12 +70,12 @@ public class DownlinkGrpcService extends ProtocolInterfaceImplBase {
public void init() throws Exception {
log.info("Initializing Protocol Downlink Grpc service!");
NettyServerBuilder builder = NettyServerBuilder.forPort(this.rpcPort)
.bossEventLoopGroup(new NioEventLoopGroup(this.rpcBoss))
.workerEventLoopGroup(new NioEventLoopGroup(this.rpcWorker))
.withOption(ChannelOption.SO_RCVBUF, rpcNettySoRcvbuf)
.withChildOption(ChannelOption.SO_SNDBUF, rpcNettySoSndbuf)
.withChildOption(ChannelOption.TCP_NODELAY, rpcNettyNoDelay)
NettyServerBuilder builder = NettyServerBuilder.forPort(this.grpcPort)
.bossEventLoopGroup(new NioEventLoopGroup(this.grpcBoss))
.workerEventLoopGroup(new NioEventLoopGroup(this.grpcWorker))
.withOption(ChannelOption.SO_RCVBUF, grpcNettySoRcvbuf)
.withChildOption(ChannelOption.SO_SNDBUF, grpcNettySoSndbuf)
.withChildOption(ChannelOption.TCP_NODELAY, grpcNettyNoDelay)
.compressorRegistry(CompressorRegistry.getDefaultInstance())
.decompressorRegistry(DecompressorRegistry.getDefaultInstance())
.channelType(NioServerSocketChannel.class)
@@ -89,7 +89,7 @@ public class DownlinkGrpcService extends ProtocolInterfaceImplBase {
.addService(this);
this.server = builder.build();
log.info("Going to start RPC server using port: {}", this.rpcPort);
log.info("Going to start RPC server using port: {}", this.grpcPort);
try {
this.server.start();

View File

@@ -49,17 +49,17 @@ service:
sessions:
default-inactivity-timeout-in-sec: "${SERVICE_PROTOCOLS_SESSIONS_DEFAULT_INACTIVITY_TIMEOUT_IN_SEC:600}"
default-state-check-interval-in-sec: "${SERVICE_PROTOCOLS_SESSIONS_DEFAULT_STATE_CHECK_INTERVAL_IN_SEC:60}"
rpc:
port: "${SERVICE_PROTOCOL_RPC_PORT:9090}"
boss: "${SERVICE_PROTOCOL_RPC_BOSS:4}"
worker: "${SERVICE_PROTOCOL_RPC_WORKER:64}"
so-rcvbuf: "${SERVICE_PROTOCOL_RPC_SO_RCVBUF:65535}"
so-sndbuf: "${SERVICE_PROTOCOL_RPC_SO_SNDBUF:65535}"
no-delay: "${SERVICE_PROTOCOL_RPC_NO_DELAY:true}"
user-thread-pool-size: "${SERVICE_PROTOCOL_RPC_USER_THREAD_POOL_SIZE:1024}"
max-inbound-message-size: "${SERVICE_PROTOCOL_RPC_MAX_INBOUND_MESSAGE_SIZE:33554432}"
max-concurrent-calls-per-connection: "${SERVICE_PROTOCOL_MAX_CONCURRENT_CALLS_PER_CONNECTION:4}"
client-max-keep-alive-time-sec: "${SERVICE_PROTOCOL_RPC_CLIENT_MAX_KEEP_ALIVE_TIME_SEC:30}"
grpc:
port: "${SERVICE_PROTOCOL_GRPC_PORT:9090}"
boss: "${SERVICE_PROTOCOL_GRPC_BOSS:4}"
worker: "${SERVICE_PROTOCOL_GRPC_WORKER:64}"
so-rcvbuf: "${SERVICE_PROTOCOL_GRPC_SO_RCVBUF:65535}"
so-sndbuf: "${SERVICE_PROTOCOL_GRPC_SO_SNDBUF:65535}"
no-delay: "${SERVICE_PROTOCOL_GRPC_NO_DELAY:true}"
user-thread-pool-size: "${SERVICE_PROTOCOL_GRPC_USER_THREAD_POOL_SIZE:1024}"
max-inbound-message-size: "${SERVICE_PROTOCOL_GRPC_MAX_INBOUND_MESSAGE_SIZE:33554432}"
max-concurrent-calls-per-connection: "${SERVICE_PROTOCOL_GRPC_MAX_CONCURRENT_CALLS_PER_CONNECTION:4}"
client-max-keep-alive-time-sec: "${SERVICE_PROTOCOL_GRPC_CLIENT_MAX_KEEP_ALIVE_TIME_SEC:30}"
protocols:
yunkuaichongV150:
enabled: "${PROTOCOLS_YUNKUAICHONGV150_ENABLED:true}"