# ============================================================ # iotlcm 内存上限 override —— 8 vCPU / 32 GB 宿主机,与其他服务共用 # # 定位:这台机器是「一机多环境」,iotlcm 只是其中一个占用方。 # 所以只给全套 20 个服务留 **约 8.5 GB 上限**(实测常驻约 2 GB), # 剩余 20+ GB 留给宿主机上要新增的其它服务。 # # 没有本文件会怎样:编排里没有内存限制,任何一个服务泄漏/跑批都会 # 把整机内存吃到 OOM Killer 随机杀进程(表现为容器反复 Restarting # 且日志里看不到业务异常,只能 dmesg 里看到 oom-kill)。 # # 用法(顺序不能反): # docker compose -f docker-compose.yml -f compose.memlimit.yml up -d # # 只调 resources(+ MySQL 自身缓存参数),不动镜像、端口、卷、依赖。 # 换成更小的机器(4 GB)时按比例下调:mysql 1024M / tdengine 512M / # worker-svr 768M / 其余 320M;8 GB 机器可用 1024M / 768M / 512M。 # ============================================================ services: # ---------- 基础组件 ---------- mysql: # buffer pool 由 128M(默认)提到 768M,连接数 151 → 300 command: - --character-set-server=utf8mb4 - --collation-server=utf8mb4_general_ci - --default-time-zone=+08:00 - --innodb-buffer-pool-size=768M - --max-connections=300 deploy: resources: limits: memory: 2048M reservations: memory: 768M redis: deploy: resources: limits: memory: 384M reservations: memory: 96M rabbitmq: deploy: resources: limits: memory: 512M reservations: memory: 192M tdengine: deploy: resources: limits: memory: 1024M reservations: memory: 256M # 一次性建表任务,跑完即退出 tdengine-init: deploy: resources: limits: memory: 128M # 单节点 consul 常驻约 110~120 MB,给足余量避免贴边 consul: deploy: resources: limits: memory: 256M reservations: memory: 96M # ---------- 业务服务 ---------- admin-svr: deploy: resources: limits: memory: 512M reservations: memory: 128M admin-ui: deploy: resources: limits: memory: 64M openapi: deploy: resources: limits: memory: 384M reservations: memory: 128M upstream-chan: deploy: resources: limits: memory: 384M reservations: memory: 128M upstream-proxy: deploy: resources: limits: memory: 384M reservations: memory: 128M # 全量同步(流量/状态/IMEI)时内存抬升最明显,按文档「500 MB ~ 1 GB」给 1 GB worker-svr: deploy: resources: limits: memory: 1024M reservations: memory: 256M app-server: deploy: resources: limits: memory: 512M reservations: memory: 128M app-web: deploy: resources: limits: memory: 64M sms: deploy: resources: limits: memory: 192M docs: deploy: resources: limits: memory: 64M # ---------- profile 可选服务 ---------- bot: deploy: resources: limits: memory: 192M onelink-mock: deploy: resources: limits: memory: 192M nginx: deploy: resources: limits: memory: 128M # 单端口入口(with-gateway);之前没有任何上限 gateway: deploy: resources: limits: memory: 256M