-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use memory storage for etcd #845
Comments
kubeadm passes
but this means kubeadm init / join commands need to:
k/k master just moved to 3.3.15, while 1.15 uses an older version. if this disk i/o suddenly became a problem this should be in a k/k issue. |
Etcd is going to be writing all the constantly updated objects, no? (Eg node status) It would be trivial to test kind with memory backed etcd by adjusting node creation, but I don't think you'd ever run a real cluster not on disk... 🤔 |
yeah, data need to persist to disk to provide consistency
Absolutely, real clusters must use disks, this is only meant to be used for testing, my rationale is that these k8s cluster are ephemeral, thus the etcd clusters don't need to "persist" data on disk Can this be patched with the kind config? It will be enough with passing a different folder than |
You can test this more or less with no changes by making a tmpfs on the host and configuring it to mount there on a control plane. You could also edit the kind control plane creation process to put a tmpfs here on the node We should experiment, but I think we do eventually want durable etcd for certain classes of testing.. |
Also worth pointing out:
|
yeah, for k8s CI is not a big problem, but for users that run kind locally, it is. It took me a while to understand what was slowing down my system until I've found that my kind clusters were causing big latency in one of my disks. |
ok, here is how to run etcd using memory storage for reference
sudo mkdir /tmp/etcd
sudo mount -t tmpfs /tmp/etcd
kind: Cluster
apiVersion: kind.sigs.k8s.io/v1alpha3
nodes:
- role: control-plane
extraMounts:
- containerPath: /var/lib/etcd
hostPath: /tmp/etcd |
/reopen per conversation in slack https://kubernetes.slack.com/archives/CEKK1KTN2/p1570202642295000?thread_ts=1570196798.288800&cid=CEKK1KTN2 I'd like to find a way to make this easier to configure, mainly for people that want to use kind in their laptops and not in CIs, etcd writing constantly to disk directly is no adding any benefit in this particular scenario |
I think this will work
I was thinking more about this, and can't see the "durability" difference between using a folder inside the container or using a tmpfs volume for the etcd data dir, the data will be available as long as the container is alive, no? However, etcd writing to a tmpfs volume will be a big performance improvement, at a cost of less memory available, of course
|
i'd be interested if this will prevent me from testing 3 CP setups with kind on my setup. |
It's NOT a folder inside the container, it's on a volume. When we fix kind to survive host reboots (and we will) then this will break it again. It also will consume more RAM of course. |
I see it now 🤦♂️ |
can this be causing timeouts in the CI with slow disks? |
^^ possibly for istio, doesn't look like Kubernetes CI is seeing timeouts at this point. That's not the pattern with the broken pipe. Even for istio, I doubt it's "because they aren't doing this" but it could be "because they are otherwise using too much IOPs for the allocated disks" IIRC they are also on GCP PD-SSD which is quite fast. |
for CI I think the better pattern I want to try is to use a pool of PDs from some storage class to replace the emptyDir. I've been mulling how we could do this and persist some of the images in a clean and sane way, but imo this is well out of scope for the kind project. |
I think that this is only an issue for people using kind in their laptops or workstations, totally agree with you on the CI use case |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
did we wind up testing this in CI? |
If you are not afraid of security, and if is possible in kubeadm ( I really don't know) avoid the certificate generation ... Maybe is possible to include some well known certificate |
There is an unsafe "--unsafe-no-fsync" flag added in etcd to disables fsync. FYI: etcd-io/etcd#11946 |
Yeah, we're very interested in that once it's available in kubeadm's etcd. |
Currently we encounter bad performance of KIND cluster on DinD setup, we get 'etcdserver: timeout errors' that causes jobs to fail often. In such cases it is recommanded [1] to use in-memory etcd Running etcd in memory should improve performance and will make sriov provider more stabilized. [1] kubernetes-sigs/kind#845 Signed-off-by: Or Mergi <ormergi@redhat.com>
Currently we encounter bad performance of KIND cluster on DinD setup, we get 'etcdserver: timeout errors' that causes jobs to fail often. In such cases it is recommanded [1] to use in-memory etcd Running etcd in memory should improve performance and will make sriov provider more stabilized. [1] kubernetes-sigs/kind#845 Signed-off-by: Or Mergi <ormergi@redhat.com>
Circling back because this came up again today: I experimented with tempfs + the unsafe no fsync flag late last year and didn't see measurable improvements on my hardware (couple different dev machines), YMMV, this still doesn't seem to be a clear win even when persistence is not interesting, it depends on the usage and hardware. |
for CIs like github actions there is a measurable difference when running the e2e test suite :) |
Yeah - it's just another potential failure mode that would be nice to avoid |
Below config file works well to run etcd in memory kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
kubeadmConfigPatches:
- |
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
etcd:
local:
dataDir: /tmp/etcd The on podman : kind/pkg/cluster/internal/providers/podman/provision.go Lines 195 to 196 in 36f229f
on docker: kind/pkg/cluster/internal/providers/docker/provision.go Lines 236 to 237 in 5657682
|
as pointed out by Ben , we are going to have a performance hit because of etcd
|
This should work for all current supported Kubernetes versions and is slightly terser: kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
kubeadmConfigPatches:
- |
kind: ClusterConfiguration
etcd:
local:
dataDir: /tmp/etcd |
Maybe let's make a page to cover performance @aojea? We have other related commonly discovered issues that are only in "known issues" currently. We could leave stub entries but move performance considerations to a new docs page that covers this technique + inotify limits etc. I think the config to enable this is small enough to just document and it's too breaking to e.g. enable by default. We can also suggest other tunable flags and host configs some of which kind shouldn't touch itself. |
agree, these are recurrent questions, better to aggregate this information |
What would you like to be added:
Configure etcd storage in memory to improve the performance
Why is this needed:
etcd causes a very high disk io, and this can cause performance issues, especially if there are several kind clusters running in the same system, because you end with a lot of process writing to disk causing latency and affecting the other applications using the same disk,
Since #779 , the
var
filesystems was no longer running on the container filesystem, improving the performance, however, theetcd
storage continues to be on the disk, as we can see in the pod manifest:Ideally, we should have
/var/lib/etcd/
in memory, since the clusters are created to be created and destroyed and the information shouldn't be persistent.I have doubts about the best approach:
kind
creating a newtmpfs
volume for etcd?kubeadm
so we can mount theetcd-data
in memory or in another location of the node that's in memory?** NOTES **
etcd io accumulated
iotop -a
The text was updated successfully, but these errors were encountered: