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

Add memcached and enable memcached index cache for Thanos Store #238

Merged
merged 1 commit into from
Apr 17, 2020

Conversation

kakkoyun
Copy link
Member

@kakkoyun kakkoyun commented Apr 6, 2020

environments/openshift/obs.jsonnet Outdated Show resolved Hide resolved
@kakkoyun kakkoyun force-pushed the store_memcached branch 4 times, most recently from 0eea2db to 5d2829b Compare April 6, 2020 14:21
@kakkoyun kakkoyun marked this pull request as ready for review April 6, 2020 14:38
@@ -92,6 +93,9 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
},
replicas: 1,
ignoreDeletionMarksDelay: '24h',
memcached+: {
addresses: ['dnssrv+_http._tcp.%s.%s.svc.cluster.local' % [obs.storeCache.service.metadata.name, obs.storeCache.service.metadata.namespace]],
Copy link
Contributor

Choose a reason for hiding this comment

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

we can't rely on the .cluster.local suffix

Copy link
Member Author

Choose a reason for hiding this comment

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

@brancz Could you please explain a little bit more? We already rely heavily on .cluster.local across the board, what do I miss?

Copy link
Contributor

Choose a reason for hiding this comment

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

We do 😱 . The problem is that this suffix is configurable for every kubernetes, cluster so we need to omit it. The local DNS server will still resolve it correctly for the local service, but it may not be correct if we add the suffix.

Copy link
Contributor

@brancz brancz Apr 7, 2020

Choose a reason for hiding this comment

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

tl;dr We need to remove it wherever we use it. (I'm fine if that happens in a separate PR)

Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Nice, looking good generally! Some minor comments only. Does it work? (:

environments/base/manifests/store-cache-statefulSet.yaml Outdated Show resolved Hide resolved
environments/openshift/obs.jsonnet Outdated Show resolved Hide resolved
environments/openshift/obs.jsonnet Outdated Show resolved Hide resolved
@kakkoyun kakkoyun force-pushed the store_memcached branch 2 times, most recently from 9e88212 to 79a4c0c Compare April 7, 2020 12:12
@kakkoyun kakkoyun force-pushed the store_memcached branch 2 times, most recently from b9afe0a to 54b7c7a Compare April 7, 2020 13:31
Copy link
Member

@squat squat left a comment

Choose a reason for hiding this comment

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

I think there are a couple of things that could be cleaned up and I have some small questions. Great work so far!

environments/openshift/obs.jsonnet Outdated Show resolved Hide resolved
environments/openshift/obs.jsonnet Outdated Show resolved Hide resolved
environments/openshift/obs.jsonnet Outdated Show resolved Hide resolved
api/v1alpha1/observatorium_types.go Show resolved Hide resolved
api/v1alpha1/observatorium_types.go Outdated Show resolved Hide resolved
components/memcached.libsonnet Show resolved Hide resolved
environments/base/default-config.libsonnet Outdated Show resolved Hide resolved
@kakkoyun kakkoyun changed the title Add memcached and enable memcached index cache for Thanos Store WIP: Add memcached and enable memcached index cache for Thanos Store Apr 7, 2020
@kakkoyun kakkoyun changed the title WIP: Add memcached and enable memcached index cache for Thanos Store Add memcached and enable memcached index cache for Thanos Store Apr 8, 2020
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

NIce, some comments (:

{ name: 'client', containerPort: mc.service.spec.ports[0].port },
]) +
container.withArgs([
'-m %(memoryLimitMb)s' % mc.config,
Copy link
Member

Choose a reason for hiding this comment

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

For future, using long flags is preferable for readability.

// Convert number to k8s "quantity" (ie 1.5Gi -> "1536Mi")
// as per https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go
// Original from https://github.com/grafana/jsonnet-libs/blob/master/memcached/memcached.libsonnet
bytesToK8sQuantity(i)::
Copy link
Member

Choose a reason for hiding this comment

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

Wow

And someone just said DON'T USE GOLANG IT HAS IFs? =D

- --experimental.enable-index-cache-postings-compression
- |-
--index-cache.config="config":
"addresses":
Copy link
Member

Choose a reason for hiding this comment

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

How we ensure how many items we can cache? 🤔

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

We limit the max item size and max memory, this is how we control maximum number of items in the cache. For our own deployment, we will have another internal PR I'll address them over there.

Also I have created an issue as a follow up to this #243

@kakkoyun kakkoyun merged commit 97d80db into observatorium:master Apr 17, 2020
@kakkoyun kakkoyun deleted the store_memcached branch April 17, 2020 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants