Skip to content
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

Set NSS_SDB_USE_CACHE=no to avoid memory growth #1716

Merged
merged 1 commit into from
Sep 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions pkg/controller/elasticsearch/nodespec/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@ func DefaultEnvVars(httpCfg v1alpha1.HTTPConfig) []corev1.EnvVar {
{Name: settings.EnvProbePasswordFile, Value: path.Join(esvolume.ProbeUserSecretMountPath, user.InternalProbeUserName)},
{Name: settings.EnvProbeUsername, Value: user.InternalProbeUserName},
{Name: settings.EnvReadinessProbeProtocol, Value: httpCfg.Scheme()},

// Disable curl/libnss use of sqlite caching to avoid triggering an issue in linux/kubernetes
// where the kernel's dentry cache grows by 5mb every time curl is invoked. This cache usage
// is charged against the pod which created it. In our case, the elasticsearch nodes trigger
// this problem with the readinessProbe invoking curl.
//
// In production testing, no negative impact on curl's behavior is observed from this setting.
// This setting is primarily targeted at curl invocation in the readinessProbe.
// References:
// https://github.com/elastic/cloud-on-k8s/issues/1581#issuecomment-525527334
// https://github.com/elastic/cloud-on-k8s/issues/1635
// https://issuetracker.google.com/issues/140577001
{Name: "NSS_SDB_USE_CACHE", Value: "no"},
}...,
)
}
Expand Down
7 changes: 7 additions & 0 deletions pkg/controller/elasticsearch/nodespec/podspec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ func TestBuildPodTemplateSpec(t *testing.T) {
},
}

// pods built with BuildPodTemplateSpec sort env vars, so our expected result must be sorted as well.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 My initial idea was to use go-spew (which also might make the error output below easier to read), but that will only sort map keys

for _, container := range expected.Spec.Containers {
sort.SliceStable(container.Env, func(i, j int) bool {
return container.Env[i].Name < container.Env[j].Name
})
}

deep.MaxDepth = 25
require.Nil(t, deep.Equal(expected, actual))
}