diff --git a/docs/canonicalk8s/styles/config/vocabularies/Canonical/accept.txt b/docs/canonicalk8s/styles/config/vocabularies/Canonical/accept.txt index dd4609ddf..21895e33e 100644 --- a/docs/canonicalk8s/styles/config/vocabularies/Canonical/accept.txt +++ b/docs/canonicalk8s/styles/config/vocabularies/Canonical/accept.txt @@ -376,3 +376,4 @@ DTMs cybersecurity uid runc +unoptimized diff --git a/docs/src/snap/reference/troubleshooting.md b/docs/src/snap/reference/troubleshooting.md index a84dec04a..8583c9494 100644 --- a/docs/src/snap/reference/troubleshooting.md +++ b/docs/src/snap/reference/troubleshooting.md @@ -112,6 +112,47 @@ containerd-base-dir: $containerdBaseDir EOF ``` +## Increased memory usage in Dqlite + +### Problem + +The datastore used for {{product}} Dqlite, reported an [issue #196] of increased +memory usage over time. This was particularly evident in smaller clusters. + +### Explanation + +This issue was caused due to an inefficient resource configuration of +Dqlite for smaller clusters. The threshold and trailing parameters are +related to Dqlite transactions and must be adjusted. The threshold is +the number of transactions we allow before a snapshot is taken of the +leader. The trailing is the number of transactions we allow the follower +node to lag behind the leader before it consumes the updated snapshot of the +leader. Currently, the default snapshot configuration is 1024 for the +threshold and 8192 for trailing which is too large for small clusters. Only +setting the trailing parameter in a configuration yaml automatically sets the +threshold to 0. This leads to a snapshot being taken every transaction and +increased CPU usage. + +### Solution + +Apply a tuning.yaml custom configuration to the Dqlite datastore in order to +adjust the trailing and threshold snapshot values. The trailing parameter +should be twice the threshold value. Create the tuning.yaml +file and place it in the Dqlite directory +`/var/snap/k8s/common/var/lib/k8s-dqlite/tuning.yaml`: + +``` +snapshot: + trailing: 1024 + threshold: 512 +``` + +Restart Dqlite: + +``` +sudo snap restart snap.k8s.k8s-dqlite +``` + [lxd-install]: ../howto/install/lxd.md @@ -120,3 +161,4 @@ EOF [kubernetes-125923]: https://github.com/kubernetes/kubernetes/pull/125923 [kubernetes-122955-2020403422]: https://github.com/kubernetes/kubernetes/issues/122955#issuecomment-2020403422 [@haircommander]: https://github.com/haircommander +[issue #196]: https://github.com/canonical/k8s-dqlite/issues/196#issuecomment-2621527026