配置手册

This commit is contained in:
三丙
2024-10-29 16:50:12 +08:00
parent d9582b3e13
commit cfd97f53bc
5 changed files with 18 additions and 20 deletions

View File

@@ -164,6 +164,14 @@ service:
type: "${SERVICE_TYPE:monolith}" type: "${SERVICE_TYPE:monolith}"
# 可自定义的服务ID如果不指定则默认为HOSTNAME # 可自定义的服务ID如果不指定则默认为HOSTNAME
id: "${SERVICE_ID:}" id: "${SERVICE_ID:}"
thread-pool:
sharding:
hash_function_name: "${THREAD_POOL_SHARDING_HASH_FUNCTION_NAME:murmur3_128}" # murmur3_32, murmur3_128 or sha256
parallelism: "${THREAD_POOL_SHARDING_PARALLELISM:8}"
stats-print-interval-ms: "${THREAD_POOL_SHARDING_STATS_PRINT_INTERVAL_MS:10000}"
downlink:
rpc:
type: "${DOWNLINK_RPC_TYPE:grpc}" # rest or grpc
protocol: protocol:
sessions: sessions:
default-inactivity-timeout-in-sec: "${PROTOCOLS_SESSIONS_DEFAULT_INACTIVITY_TIMEOUT_IN_SEC:600}" default-inactivity-timeout-in-sec: "${PROTOCOLS_SESSIONS_DEFAULT_INACTIVITY_TIMEOUT_IN_SEC:600}"
@@ -260,12 +268,3 @@ service:
buffer-memory: "${PROTOCOLS_YUNKUAICHONGV160_FORWARD_BUFFER_MEMORY:33554432}" buffer-memory: "${PROTOCOLS_YUNKUAICHONGV160_FORWARD_BUFFER_MEMORY:33554432}"
other-properties: "${PROTOCOLS_YUNKUAICHONGV160_FORWARD_QUEUE_KAFKA_OTHER_PROPERTIES:}" other-properties: "${PROTOCOLS_YUNKUAICHONGV160_FORWARD_QUEUE_KAFKA_OTHER_PROPERTIES:}"
thread-pool:
sharding:
hash_function_name: "${THREAD_POOL_SHARDING_HASH_FUNCTION_NAME:murmur3_128}" # murmur3_32, murmur3_128 or sha256
parallelism: "${THREAD_POOL_SHARDING_PARALLELISM:8}"
stats-print-interval-ms: "${THREAD_POOL_SHARDING_STATS_PRINT_INTERVAL_MS:10000}"
downlink:
rpc:
type: "${DOWNLINK_RPC_TYPE:grpc}" # rest or grpc

View File

@@ -22,7 +22,7 @@ import static sanbing.jcpp.infrastructure.proto.ProtoConverter.toTracerProto;
*/ */
@Service @Service
@Slf4j @Slf4j
@ConditionalOnExpression("'${downlink.rpc.type:null}'=='grpc'") @ConditionalOnExpression("'${service.downlink.rpc.type:null}'=='grpc'")
public class GrpcDownlinkCallService extends DownlinkCallService { public class GrpcDownlinkCallService extends DownlinkCallService {
@Resource @Resource

View File

@@ -26,7 +26,7 @@ import static sanbing.jcpp.infrastructure.util.trace.TracerContextUtil.*;
*/ */
@Service @Service
@Slf4j @Slf4j
@ConditionalOnExpression("'${downlink.rpc.type:null}'=='rest'") @ConditionalOnExpression("'${service.downlink.rpc.type:null}'=='rest'")
public class RestDownlinkCallService extends DownlinkCallService { public class RestDownlinkCallService extends DownlinkCallService {
@Resource @Resource

View File

@@ -30,10 +30,10 @@ import static sanbing.jcpp.infrastructure.util.JCPPHashUtil.hash;
@Component @Component
@Slf4j @Slf4j
public class ShardingThreadPool { public class ShardingThreadPool {
@Value("${thread-pool.sharding.hash_function_name:murmur3_128}") @Value("${service.thread-pool.sharding.hash_function_name:murmur3_128}")
private String hashFunctionName; private String hashFunctionName;
@Value("${thread-pool.sharding.parallelism:8}") @Value("${service.thread-pool.sharding.parallelism:8}")
private int parallelism; private int parallelism;
private HashFunction hashFunction; private HashFunction hashFunction;
@@ -53,7 +53,7 @@ public class ShardingThreadPool {
} }
} }
@Scheduled(fixedDelayString = "${thread-pool.sharding.stats-print-interval-ms:10000}") @Scheduled(fixedDelayString = "${service.thread-pool.sharding.stats-print-interval-ms:10000}")
public void printStats() { public void printStats() {
executorServiceMap.forEach((k, v) -> { executorServiceMap.forEach((k, v) -> {

View File

@@ -40,6 +40,11 @@ service:
type: "${SERVICE_TYPE:protocol}" type: "${SERVICE_TYPE:protocol}"
# 可自定义的服务ID如果不指定则默认为HOSTNAME # 可自定义的服务ID如果不指定则默认为HOSTNAME
id: "${SERVICE_ID:}" id: "${SERVICE_ID:}"
thread-pool:
sharding:
hash_function_name: "${THREAD_POOL_SHARDING_HASH_FUNCTION_NAME:murmur3_128}" # murmur3_32, murmur3_128 or sha256
parallelism: "${THREAD_POOL_SHARDING_PARALLELISM:8}"
stats-print-interval-ms: "${THREAD_POOL_SHARDING_STATS_PRINT_INTERVAL_MS:10000}"
protocol: protocol:
sessions: sessions:
default-inactivity-timeout-in-sec: "${PROTOCOLS_SESSIONS_DEFAULT_INACTIVITY_TIMEOUT_IN_SEC:600}" default-inactivity-timeout-in-sec: "${PROTOCOLS_SESSIONS_DEFAULT_INACTIVITY_TIMEOUT_IN_SEC:600}"
@@ -192,9 +197,3 @@ queue:
enabled: "${QUEUE_APP_STATS_ENABLED:true}" enabled: "${QUEUE_APP_STATS_ENABLED:true}"
print-interval-ms: "${QUEUE_APP_STATS_PRINT_INTERVAL_MS:60000}" print-interval-ms: "${QUEUE_APP_STATS_PRINT_INTERVAL_MS:60000}"
thread-pool:
sharding:
hash_function_name: "${THREAD_POOL_SHARDING_HASH_FUNCTION_NAME:murmur3_128}" # murmur3_32, murmur3_128 or sha256
parallelism: "${THREAD_POOL_SHARDING_PARALLELISM:8}"
stats-print-interval-ms: "${THREAD_POOL_SHARDING_STATS_PRINT_INTERVAL_MS:10000}"