etcd v2.2.2 crash when master memory is nearly full
do a density test on k8s, with etcd v2.2.2, when create more and more pods, the memory useage of etcd master node goes full. when the master etcd's memory is nearly full ( still has many in swap), it crashes.
Thu Dec 24 22:05:56 UTC 2015
etcd-0:
total used free shared buffers cached
Mem: 7985 7284 700 0 60 5729
-/+ buffers/cache: 1494 6490
Swap: 20479 0 20479
etcd-2:
total used free shared buffers cached
Mem: 7985 7364 620 0 58 5776
-/+ buffers/cache: 1529 6455
Swap: 20479 0 20479
etcd-1:
total used free shared buffers cached
Mem: 7985 7864 120 0 0 4
-/+ buffers/cache: 7860 124
Swap: 20479 5575 14904
etcd-4:
total used free shared buffers cached
Mem: 7985 7822 163 0 0 5
-/+ buffers/cache: 7816 168
Swap: 20479 4159 16320
etcd-3:
total used free shared buffers cached
Mem: 7985 7751 233 0 0 8
-/+ buffers/cache: 7742 242
Swap: 20479 7237 13242
only etcd-0 and etcd-2 survival. other 3 crashed. the start arguments is:
root 21302 21278 1 Dec24 ? 00:18:31 /var/paas/packages/etcd/bin/etcd --name etcd-0 --data-dir /var/vcap/store/etcd --log-package-levels etcdmain=DEBUG,etcdserver=DEBUG --heartbeat-interval 500 --election-timeout 2500 --listen-peer-urls http://11.1.4.47:8001 --listen-client-urls http://11.1.4.47:5678 --initial-advertise-peer-urls http://11.1.4.47:8001 --advertise-client-urls http://11.1.4.47:5678 --initial-cluster etcd-1=http://11.1.4.48:8001,etcd-2=http://11.1.4.49:8001,etcd-3=http://11.1.4.50:8001,etcd-4=http://11.1.4.51:8001,etcd-0=http://11.1.4.47:8001 --initial-cluster-token etcd-cluster-1 --initial-cluster-state new
etcd-2:
root 16726 16694 7 Dec24 ? 01:24:24 /var/paas/packages/etcd/bin/etcd --name etcd-4 --data-dir /var/vcap/store/etcd --log-package-levels etcdmain=DEBUG,etcdserver=DEBUG --heartbeat-interval 500 --election-timeout 2500 --listen-peer-urls http://11.1.4.51:8001 --listen-client-urls http://11.1.4.51:5678 --initial-advertise-peer-urls http://11.1.4.51:8001 --advertise-client-urls http://11.1.4.51:5678 --initial-cluster etcd-1=http://11.1.4.48:8001,etcd-2=http://11.1.4.49:8001,etcd-3=http://11.1.4.50:8001,etcd-4=http://11.1.4.51:8001,etcd-0=http://11.1.4.47:8001 --initial-cluster-token etcd-cluster-1 --initial-cluster-state new
Is this problem happens because I use some incrorrect arguments? Or is there any reasons? how can I go deeper to examine it? do a go heap dump?
A few questions to get started:
- Do you have any statistics for the memory usage of etcd itself? (e.g. from
top,ps,sysstat, etc) - What exactly is it that crashes (the etcd process? the whole node?), and how - what are the symptoms?
- You mentioned you're doing a density test - what sort of scale are we talking? How many pods?
Do you have any statistics for the memory usage of etcd itself? (e.g. from top, ps, sysstat, etc)
the node only running etcd process, os cost 1G memory, others all belong to etcd
What exactly is it that crashes (the etcd process? the whole node?), and how - what are the symptoms?
process
You mentioned you're doing a density test - what sort of scale are we talking? How many pods?
k8s, 300node, 3w pods
the node only running etcd process, os cost 1G memory, others all belong to etcd
I'm afraid this still isn't anywhere near enough information for us to go on. How much memory was etcd using - how did you know it was the process consuming all the memory?
process
OK, what was the symptom of the crash? Was there a stack trace?
k8s, 300node, 3w pods
Sorry but I don't know what "3w" means (thousand? million?). Do you have any idea what the actual data set size was?
thanks
@jonboulle sorry, 3w is a chinese word. It means 30000. I didn't record the exact memory etcd process use. Next time(not now, a few weeks later maybe) I will take more data while do experiment. Will the go pprof heap dump help?
@HardySimpson @jonboulle @xiang90 @hongchaodeng Hi all, i have token the density test again, and the situation is:
1. environment info:
| 软件 | 版本 |
|---|---|
| Etcd | 2.2.2 |
| K8s | master branch, about 439d7a721e087f4015191fe7e2d0b9262abd2530 commit |
| 环境 | CPU/核 | 内存/G | 磁盘/G | 数量 |
|---|---|---|---|---|
| K8s-master | 8 | 16 | 160 | 1 |
| K8s-node | 2 | 4 | 40 | 500 |
| Etcd | 4 | 8 | 80 | 5 |
2. take k8s density test(40 pods per node, total 20000 pods)
as the test going on, the etcd's memory continue to rise, until OOM(out of memory)
etcd_oom.txt
@magicwang-cn Do you know how much memory etcd actually consumes when it OOM?
Also have you tried to allocate more memory to etcd machine?
@xiang90
when the mem's use more than 40%(total 8G), every one second i will make a etcd heap pprof(until the etcd process crash, it take about 1 minute):

@HardySimpson @magicwang-cn The heap analysis does not provide enough information. I am not sure why the json encoder is holding a lot of memory. Were etcd serving a large number of large concurrent requests? If yes, then it seems to be fine. You have to limit the number of concurrent requests or give etcd server more memory. We are not going to optimize v2 API any time soon.
It would be helpful if you can reproduce this issue with etcd independently.
Closing due to low activity. Please reopen if this is still an issue and you can provide more information.