clickhouse:
image: yandex/clickhouse-server
container_name: clickhouse
ports:
- 8123:8123
- 9000:9000
ulimits:
nofile:
soft: 262144
hard: 262144
deploy:
resources:
limits:
cpus: "0.6"
memory: 2G
volumes:
- ./volumes/ck/data:/var/lib/clickhouse
- ./volumes/ck/log/:/var/log/clickhouse-server/
- ./volumes/ck/etc/:/etc/clickhouse-server/
- /etc/localtime:/etc/localtime
restart: on-failure
和同事交流后,发现cpus
参数设置不合理
我之前看着网上的一些文章和翻译,以为这个数字要取小数,是一个比值,是 “服务器cpu总数量 x 比值”,为该docker容器使用的cpu数量(这是我的错误理解)
在同事建议下,去看了官方英文文档,果然,我理解错了,这个就是简单的指 cpu数量
官方文档使用小技巧:是官方文档网站里的搜索框,输入英文关键词,基本就可以查找到想要的结果
官方文档地址:https://docs.docker.com/compose/compose-file/deploy/#cpus
cpus configures a limit or reservation for how much of the available CPU resources, as number of cores, a container can use.
number of cores
,很明确,就是数量,案例是设置小数如0.6,是指0.6个cpu,对clickhouse来说,完全不够用。clickhouse并行计算和数据文件块压缩合并,都比较吃cpu,至少要给8个cpu,生产环境,最好是32cpu起danger
If your system has less than 16 GB of RAM, you may experience various memory exceptions because default settings do not match this amount of memory. The recommended amount of RAM is 32 GB or more. You can use ClickHouse in a system with a small amount of RAM, even with 2 GB of RAM, but it requires additional tuning and can ingest at a low rate.
deploy:
resources:
limits:
cpus: "8.0"
memory: 16G