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

fix: add VolumeStats cache to avoid massive statfs calls #700

Merged
merged 1 commit into from Dec 4, 2023

Conversation

andyzhangx
Copy link
Member

@andyzhangx andyzhangx commented Dec 3, 2023

What type of PR is this?
/kind bug

What this PR does / why we need it:
fix: add VolumeStats cache to avoid massive statfs calls

This PR adds a 10min cache for VolumeStats per volumeID, that could avoid massive statfs calls

Which issue(s) this PR fixes:

Fixes #

Requirements:

Special notes for your reviewer:

I1203 14:10:50.070801       1 utils.go:76] GRPC call: /csi.v1.Node/NodeGetVolumeStats
I1203 14:10:50.070883       1 utils.go:77] GRPC request: {"volume_id":"f53b93510cc4d479080fad5.file.core.windows.net/pvc-35cf7e8d-8343-44b5-a9d3-bb71a29b00d0#pvc-6b9fb44c-dc30-48d5-b19a-a81d5b9cbf40#","volume_path":"/var/lib/kubelet/pods/4574ee48-11c5-4abc-8369-a7f52d379b74/volumes/kubernetes.io~csi/pvc-6b9fb44c-dc30-48d5-b19a-a81d5b9cbf40/mount"}
I1203 14:10:50.084101       1 utils.go:83] GRPC response: {"usage":[{"available":107356094464,"total":107374182400,"unit":1,"used":18087936},{"unit":2}]}
I1203 14:12:06.787682       1 utils.go:76] GRPC call: /csi.v1.Node/NodeGetVolumeStats
I1203 14:12:06.787730       1 utils.go:77] GRPC request: {"volume_id":"f53b93510cc4d479080fad5.file.core.windows.net/pvc-35cf7e8d-8343-44b5-a9d3-bb71a29b00d0#pvc-6b9fb44c-dc30-48d5-b19a-a81d5b9cbf40#","volume_path":"/var/lib/kubelet/pods/4574ee48-11c5-4abc-8369-a7f52d379b74/volumes/kubernetes.io~csi/pvc-6b9fb44c-dc30-48d5-b19a-a81d5b9cbf40/mount"}
I1203 14:12:06.787786       1 nodeserver.go:305] NodeGetVolumeStats: volume stats for volume f53b93510cc4d479080fad5.file.core.windows.net/pvc-35cf7e8d-8343-44b5-a9d3-bb71a29b00d0#pvc-6b9fb44c-dc30-48d5-b19a-a81d5b9cbf40# path /var/lib/kubelet/pods/4574ee48-11c5-4abc-8369-a7f52d379b74/volumes/kubernetes.io~csi/pvc-6b9fb44c-dc30-48d5-b19a-a81d5b9cbf40/mount is cached
I1203 14:12:06.787816       1 utils.go:83] GRPC response: {"usage":[{"available":107356094464,"total":107374182400,"unit":1,"used":18087936},{"unit":2}]}
I1203 14:13:29.138315       1 utils.go:76] GRPC call: /csi.v1.Node/NodeGetVolumeStats
I1203 14:13:29.138435       1 utils.go:77] GRPC request: {"volume_id":"f53b93510cc4d479080fad5.file.core.windows.net/pvc-35cf7e8d-8343-44b5-a9d3-bb71a29b00d0#pvc-6b9fb44c-dc30-48d5-b19a-a81d5b9cbf40#","volume_path":"/var/lib/kubelet/pods/4574ee48-11c5-4abc-8369-a7f52d379b74/volumes/kubernetes.io~csi/pvc-6b9fb44c-dc30-48d5-b19a-a81d5b9cbf40/mount"}
I1203 14:13:29.138480       1 nodeserver.go:305] NodeGetVolumeStats: volume stats for volume f53b93510cc4d479080fad5.file.core.windows.net/pvc-35cf7e8d-8343-44b5-a9d3-bb71a29b00d0#pvc-6b9fb44c-dc30-48d5-b19a-a81d5b9cbf40# path /var/lib/kubelet/pods/4574ee48-11c5-4abc-8369-a7f52d379b74/volumes/kubernetes.io~csi/pvc-6b9fb44c-dc30-48d5-b19a-a81d5b9cbf40/mount is cached
I1203 14:13:29.138495       1 utils.go:83] GRPC response: {"usage":[{"available":107356094464,"total":107374182400,"unit":1,"used":18087936},{"unit":2}]}

Release note:

fix: add VolumeStats cache to avoid massive statfs calls

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 3, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andyzhangx

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 3, 2023
@andyzhangx andyzhangx force-pushed the statfs-cache branch 2 times, most recently from c5ef52d to b5c41cc Compare December 3, 2023 03:21
fix: add VolumeStats cache to avoid massive statfs calls

fix

fix

fix
@andyzhangx
Copy link
Member Author

/test pull-csi-driver-smb-e2e-capz

1 similar comment
@andyzhangx
Copy link
Member Author

/test pull-csi-driver-smb-e2e-capz

@k8s-ci-robot
Copy link
Contributor

@andyzhangx: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-csi-driver-smb-e2e-capz f1c7cde link false /test pull-csi-driver-smb-e2e-capz

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@andyzhangx andyzhangx merged commit c1bbc6d into kubernetes-csi:master Dec 4, 2023
21 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants