推导默认值与键间约束
部分配置键未显式填写时,框架会根据关联配置自动推导合理默认值;若手动填写,则必须满足下表约束,违反时拒绝启动并指明冲突键名:
| 配置键 | 自动推导的默认值 | 手动配置时的约束 |
|---|---|---|
tasks.control_timeout | min(1s, tasks.storage.lease_duration / 3) | 不得超过 lease_duration 的 1/3 |
tasks.storage.poll_interval | min(100ms, tasks.storage.lease_duration / 3) | 不得超过 lease_duration 的 1/3 |
residents.deactivate_timeout | min(2s, residents.call_timeout, 停机窗口的 80% 减 call_timeout) | 不大于 call_timeout,且 call_timeout + deactivate_timeout 不超过 9s 600ms |
fabric.placement.quorum | 未组网时取 1,配置了 seeds 或开启 discovery.mode("seeds" / "multicast" / "storage")时取 expected_nodes / 2 + 1 | 必须是 expected_nodes 的严格多数派 |
fabric.gossip.bind | 与 fabric.cluster.bind 同 IP,端口号加 1 | 当 cluster 端口为 65535 时必须手动指定 |
server.connections.max_per_source | min(256, server.connections.max) | 不得超过 server.connections.max |
server.http.max_in_flight_body_bytes | max(64MiB, server.http.max_body_bytes, server.http.grpc.max_message_bytes) | 不得小于 max_body_bytes 与 grpc.max_message_bytes |
server.tcp.listeners.<name>.bind | 沿用 server.tcp.bind | 代码里必须有同名 App::tcp 注册(UDP 同理) |
其他跨配置段的联动要求:
- Resident 托管依赖后台任务执行面:二进制包含
#[resident]声明且residents.hosting.enabled = true(默认)时,必须保持tasks.execution.enabled = true;否则预检与启动均失败,错误信息以residents.hosting.enabled requires tasks.execution.enabled开头。纯网关转发节点若不托管实体,请显式设residents.hosting.enabled = false。 - 请求体与上传体积、HTTP/2 流式 gRPC:
server.http.max_body_bytes与security.max_body_bytes都不能小于 Livecell 的max_upload_bytes;开启server.http.grpc.streaming = true时必须同时开启server.http.h2.enabled = true。 - 任务并发、接管超时与 Redis 地址:
tasks.map.per_root_in_flight不能超过tasks.concurrency;residents.placement.release_timeout必须小于call_timeout与接管窗口;Session、Cache 或限流任一后端设为redis时必须配置非空的redis.url。