- POST /app/watch/progress 只写 Redis 缓冲立即返回(p95 75ms→2ms), WatchProgressFlusher 每 2s 把 watch:pg:dirty 队列按身份合并批量 UPSERT, Redis 异常自动回退同步写库,接口契约不变 - 读接口用缓冲覆盖 DB 行保证读己之写;Caffeine 缓存剧集校验免去上报路径两条 DB 查询 - 落库按「新增进度/新增流水/更新行」分组攒批(MyBatis BATCH 只合并连续同形状语句), 配合 reWriteBatchedInserts 多值 INSERT,12.4 万积压 45 秒消化完, 1650 QPS 持续压测队列稳态归零
45 lines
1.5 KiB
YAML
45 lines
1.5 KiB
YAML
# Author: fruit.com.cn
|
||
#
|
||
# 生产 profile(--spring.profiles.active=prod):
|
||
# 1) 集中生产开关,不在这里写任何密钥 —— 密钥一律环境变量注入;
|
||
# 2) 密钥缺失/还是 dev 默认值/签名没开 → ProdSecretGuard 直接让启动失败(fail-fast)。
|
||
server:
|
||
# 容器里由编排再映射;保持 8081 便于与 runbook 一致
|
||
port: ${SERVER_PORT:8081}
|
||
tomcat:
|
||
# 生产前置反代,真实 IP 从 X-Forwarded-* 取
|
||
remoteip:
|
||
remote-ip-header: X-Forwarded-For
|
||
protocol-header: X-Forwarded-Proto
|
||
|
||
spring:
|
||
lifecycle:
|
||
timeout-per-shutdown-phase: 30s
|
||
|
||
fruitshorts:
|
||
media:
|
||
# 生产必须开启播放地址签名(docs/12-上线检查清单)
|
||
signature-required: true
|
||
cors:
|
||
# 生产只允许显式配置的来源;没配就等于空,浏览器侧会被拦住(比"*"安全)
|
||
allowed-origins: ${CORS_ALLOWED_ORIGINS:}
|
||
watch-progress:
|
||
# 观看进度写缓冲:POST 先写 Redis 立即返回,后台任务批量合并进 watch_progress。
|
||
# 消化能力 = batch-size / interval ≈ 5000 条/秒,覆盖 30 万 DAU 峰值 ~3700 条/秒上报。
|
||
# 关掉(false)即回退同步写库,接口契约不变。
|
||
buffer: true
|
||
flush-interval-ms: 2000
|
||
flush-batch-size: 10000
|
||
|
||
springdoc:
|
||
# 生产只留机器可读契约,关掉 UI(doc.html 不对外开放)
|
||
swagger-ui:
|
||
enabled: ${SWAGGER_ENABLED:false}
|
||
api-docs:
|
||
enabled: ${SWAGGER_ENABLED:false}
|
||
|
||
logging:
|
||
level:
|
||
root: info
|
||
com.fruitshorts: info
|