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

reduce traffic by caching Node objects #99

Closed
pohly opened this issue Dec 2, 2020 · 4 comments · Fixed by #100
Closed

reduce traffic by caching Node objects #99

pohly opened this issue Dec 2, 2020 · 4 comments · Fixed by #100

Comments

@pohly
Copy link
Contributor

pohly commented Dec 2, 2020

There's an old TODO in the code about this:

selectedNode, err = ctrl.client.CoreV1().Nodes().Get(nodeName, metav1.GetOptions{}) // TODO (verult) cache Nodes

Scale testing shows that this is causing significant traffic when provisioning many volumes with selected node: 80kB/s for GET of Nodes, followed by 1.7kB/s for GET of CRDs.

Link to results (likely to go stale):
http://35.243.169.140:3000/d/A354LoAGz/pohlyat-storage-tests?orgId=1&from=1606743419743&to=1606743617019&var-source=adhoc-1333398611282628608-central&var-etcd_type=All&var-etcd_operation=All&var-verb=All&var-resource=All

/cc @verult @jsafrane

@pohly
Copy link
Contributor Author

pohly commented Dec 2, 2020

Is an informer the right solution? It's less precise than doing a GET (local cache might be stale), but I suppose any caching solution has that problem.

We also need to be aware that the provisioner then gets informed about all nodes, even when it only ever needs a handful of nodes in a larger cluster.

@wongma7
Copy link
Contributor

wongma7 commented Dec 2, 2020

external-provisioner controller already has an informer, maybe we should deprecate SelectedNode *v1.Node and pass SelectedNode *string to Provision instead, leaving it up to the Provisioner how to retrieve a Node object (and its topology)? https://github.com/kubernetes-csi/external-provisioner/blob/89079cfeb84cbbfcda976504d46e6b2b8352adb7/cmd/csi-provisioner/csi-provisioner.go#L216

I am not too worried about stale Node cache either since I don't think node topology is something that should change often if at all...

@wongma7
Copy link
Contributor

wongma7 commented Dec 2, 2020

Or, to follow the existing pattern https://github.com/kubernetes-sigs/sig-storage-lib-external-provisioner/blob/master/controller/controller.go#L473, accept a NodeInformer as an argument so if external-provisioner controller already has one it can pass it in, if not, this controller will create one.

@pohly
Copy link
Contributor Author

pohly commented Dec 3, 2020

So let's use an informer. I would leave the current behavior unchanged (i.e. use GET as fallback) and let the caller decide whether it wants to use an informer.

pohly added a commit to pohly/sig-storage-lib-external-provisioner that referenced this issue Dec 3, 2020
It may make sense to use an informer-based lister for Node instead of
doing a GET for each PVC with a selected node, in particular if there
is already a shared informer in the process.

Fixes: kubernetes-sigs#99
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 a pull request may close this issue.

2 participants