perf(deploy): 边缘 nginx 承压调优与连接池/PG 参数(P0-2/P0-3)
- 主配置 nginx.conf 进镜像(worker_connections 16384 + rlimit 65536 + gzip + 带上游耗时的访问日志):官方默认 1024×4=4096 连接硬顶是 1w 并发第一道墙 - admin.conf:upstream keepalive 64(proxy_http 1.1 + Connection "")、 /public/ /v2-api/ 限流 50r/s burst 200(429)、代理超时 5s/30s、 /uploads/ /assets/ 30d 缓存头;admin.v2.conf 的 /v2/h5/ 哈希产物长缓存 - compose:PG 显式参数(statement_timeout=10s/max_connections=200/ shared_buffers=512MB)、DATABASE_URL connection_limit=50&pool_timeout=3 (单位秒,勿写毫秒;勿加 statement_cache_size=0)、admin ulimits nofile 65536 - 部署注意:主配置走镜像须 rebuild;PG 参数重启前按全局约束 pg_dump+快照存档
This commit is contained in:
@@ -17,6 +17,9 @@ COPY apps/admin apps/admin
|
||||
RUN pnpm --filter @inkreach/admin exec vite build
|
||||
|
||||
FROM nginx:1.27-alpine
|
||||
# 性能整改 P0-2:替换官方主配置(worker_connections 1024 → 16384、gzip、访问日志);
|
||||
# conf.d(admin.conf / admin.v2.conf)仍按服务挂载/拷贝
|
||||
COPY deploy/nginx/nginx.conf /etc/nginx/nginx.conf
|
||||
COPY --from=build /app/apps/admin/dist /usr/share/nginx/html/v2/admin
|
||||
COPY deploy/nginx/admin.conf /etc/nginx/conf.d/default.conf
|
||||
COPY deploy/h5 /usr/share/nginx/html/v2/h5
|
||||
|
||||
Reference in New Issue
Block a user