1
k8s单个pod资源限制
在比格云主机上通过docker-compose管理的容器
华熙生物-300人用
1 2 3 4 5 6 7 8 9
| NAME CPU % MEM USAGE / LIMIT MEM % hxsw-todo-1 0.17% 124.3MiB / 3.81GiB 3.19% hxsw-lowcode-1 0.71% 972.5MiB / 3.81GiB 24.93% hxsw-oaa-1 0.07% 190.9MiB / 3.81GiB 4.89% hxsw-timejob-1 0.39% 81.33MiB / 3.81GiB 2.08% hxsw-nginx-1 0.00% 52.87MiB / 3.81GiB 1.36% hxsw-pointer-1 0.08% 38.64MiB / 3.81GiB 0.99% hxsw-inroad-1 0.07% 503.3MiB / 3.81GiB 12.90% 合计 1.49% 1961MB
|
健坤化学,250人用量
1 2 3 4 5 6 7 8 9
| NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS jkhx-inroad-1 1.49% 767.1MiB / 3.81GiB 19.66% 6.8GB / 13.1GB 25.7MB / 271MB 45 jkhx-nginx-1 0.00% 94.47MiB / 3.81GiB 2.42% 2.95GB / 16.3GB 247MB / 8.19kB 3 jkhx-lowcode-1 0.48% 356.1MiB / 3.81GiB 9.13% 6.69GB / 8.6GB 70.2MB / 0B 44 jkhx-timejob-1 0.12% 89.02MiB / 3.81GiB 2.28% 1.7GB / 1.25GB 9.97MB / 0B 23 jkhx-oaa-1 0.09% 216.9MiB / 3.81GiB 5.56% 227MB / 252MB 37MB / 19.3MB 21 jkhx-todo-1 0.20% 170MiB / 3.81GiB 4.36% 444MB / 606MB 51.9MB / 0B 23 jkhx-pointer-1 0.08% 30.17MiB / 3.81GiB 0.77% 438kB / 0B 17.4MB / 0B 14 合计 2.5% 1723
|
福邦新材料
1 2 3 4 5 6 7 8
| NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS pointer 0.13% 35.14MiB / 3.682GiB 0.93% 76.4kB / 0B 55.6MB / 0B 15 timejob 0.08% 45.75MiB / 3.682GiB 1.21% 84.4MB / 91.6MB 8.76MB / 0B 19 oaa 0.08% 200MiB / 3.682GiB 5.31% 364MB / 354MB 4.97MB / 0B 21 inroad 0.26% 1.212GiB / 3.682GiB 32.93% 39.9GB / 39.1GB 33.6MB / 0B 44 nginx 0.00% 46.57MiB / 3.682GiB 1.24% 11.6GB / 113GB 50.1MB / 30.7kB 2 todo 0.19% 285.6MiB / 3.682GiB 7.58% 309MB / 309MB 32.5MB / 0B 21 总计 0.74% 1854
|
gc上通过k8s管理的容器(单pod多容器)
bach正式环境,300人规模
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| POD NAME CPU(cores) MEMORY(bytes) inroadweb-bach-768565bfc7-n24jh inroad 8m 561Mi inroadweb-bach-768565bfc7-n24jh lowcode 111m 1073Mi inroadweb-bach-768565bfc7-n24jh nginx 1m 6Mi inroadweb-bach-768565bfc7-n24jh oaa 1m 304Mi inroadweb-bach-768565bfc7-n24jh pointer 1m 34Mi inroadweb-bach-768565bfc7-n24jh promtail 6m 48Mi 总计 126m 2028Mi
POD NAME CPU(cores) MEMORY(bytes) inroadweb-bach-768565bfc7-q8g57 inroad 3m 517Mi inroadweb-bach-768565bfc7-q8g57 lowcode 20m 1721Mi inroadweb-bach-768565bfc7-q8g57 nginx 1m 16Mi inroadweb-bach-768565bfc7-q8g57 oaa 9m 238Mi inroadweb-bach-768565bfc7-q8g57 pointer 1m 50Mi inroadweb-bach-768565bfc7-q8g57 promtail 4m 43Mi 总计 35m 2588Mi
|
zjcm正式环境
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| POD NAME CPU(cores) MEMORY(bytes) inroadweb-zjcm-78d7ddc9bf-mpmjq inroad 2m 432Mi inroadweb-zjcm-78d7ddc9bf-mpmjq lowcode 2m 1100Mi inroadweb-zjcm-78d7ddc9bf-mpmjq nginx 1m 8Mi inroadweb-zjcm-78d7ddc9bf-mpmjq oaa 1m 245Mi inroadweb-zjcm-78d7ddc9bf-mpmjq pointer 1m 69Mi inroadweb-zjcm-78d7ddc9bf-mpmjq promtail 2m 47Mi 合计 9m 1900Mi
inroadweb-zjcm-78d7ddc9bf-8mcxk inroad 2m 496Mi inroadweb-zjcm-78d7ddc9bf-8mcxk lowcode 3m 1441Mi inroadweb-zjcm-78d7ddc9bf-8mcxk nginx 1m 4Mi inroadweb-zjcm-78d7ddc9bf-8mcxk oaa 1m 259Mi inroadweb-zjcm-78d7ddc9bf-8mcxk pointer 1m 62Mi inroadweb-zjcm-78d7ddc9bf-8mcxk promtail 5m 36Mi 合计 9m 2300Mi
|
bach测试环境,没几个人用
1 2 3 4 5 6 7
| POD NAME CPU(cores) MEMORY(bytes) inroadweb-bach-68d88fdbcb-2dh2c inroad 2m 381Mi inroadweb-bach-68d88fdbcb-2dh2c lowcode 4m 721Mi inroadweb-bach-68d88fdbcb-2dh2c nginx 0m 9Mi inroadweb-bach-68d88fdbcb-2dh2c oaa 1m 199Mi inroadweb-bach-68d88fdbcb-2dh2c pointer 1m 51Mi 总计 7m 1363Mi
|
zjcm测试环境,没几个人用
1 2 3 4 5 6 7 8
| POD NAME CPU(cores) MEMORY(bytes) inroadweb-zjcm-7c97cfbdf8-lfjx7 inroad 5m 336Mi inroadweb-zjcm-7c97cfbdf8-lfjx7 lowcode 3m 230Mi inroadweb-zjcm-7c97cfbdf8-lfjx7 nginx 1m 6Mi inroadweb-zjcm-7c97cfbdf8-lfjx7 oaa 1m 172Mi inroadweb-zjcm-7c97cfbdf8-lfjx7 pointer 1m 50Mi inroadweb-zjcm-7c97cfbdf8-lfjx7 promtail 10m 56Mi 合计 19m 853Mi
|
比格云测试集群(多pod多容器)
xsd,0人使用
1 2 3 4 5 6 7 8 9
| NAME CPU % MEM USAGE hxsw-todo-1 0 115 hxsw-lowcode-1 0 254 hxsw-oaa-1 0 173 hxsw-timejob-1 0 106 hxsw-nginx-1 0 4 hxsw-pointer-1 0 33 hxsw-inroad-1 0 393 合计 0 1078
|
结论
:star:无论时单容器但是多容器,创建一套服务的成本大概是1G内存,用于deployment的资源请求配额
:star:内存占用排序:积木、工智道、oaa、todo、pointer、timejob、nginx
服务 |
inroad |
lowcode |
oaa |
todo |
pointer |
timejob |
nginx |
deployment |
成本 |
400MB |
300M |
180M |
120M |
50M |
120M |
10M |
1200M |
峰值 |
1241M |
1800M |
360M |
300M |
100M |
none |
none |
|
CPU 请求:200m = 0.2 核心
资源request
1 2 3 4
| resources: requests: cpu: 200m memory: 256Mi
|
弹性伸缩规则
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| apiVersion: autoscaling/v2beta2 kind: HorizontalPodAutoscaler metadata: name: my-hpa spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: my-deployment minReplicas: 1 maxReplicas: 5 metrics: - type: Resource resource: name: memory target: type: Utilization averageUtilization: 70
|
inroad
工智道随便开几个页面访问,内存就能达到一个G
要求,大概没人访问的时候,大概占用内存400M,只有一个pod,请求2个G,达到80%扩容新的pod
1 2 3 4
| resources: requests: cpu: 200m memory: 1200Mi
|
收集dump文件
1 2
| https://zhuanlan.zhihu.com/p/639610440 https://learn.microsoft.com/zh-cn/dotnet/core/diagnostics/dotnet-dump
|
1 2 3 4 5 6 7
| #!/bin/bash mkdir /opt/$1 $$ cd /opt/$1 unzip config.zip wget -q https://3dview-1251252938.cos.ap-shanghai.myqcloud.com/dengjinjun/scripts/install_docker.sh chmod +x install_docker.sh sh install_docker.sh docker-compose up -d
|