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

Use protobuf encoding for core K8s APIs in Prometheus Engine #1146

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

tosi3k
Copy link
Contributor

@tosi3k tosi3k commented Sep 17, 2024

For core K8s API objects like Pods, Nodes, etc., we can use protobuf encoding which, compared to the default JSON encoding, reduces CPU consumption related to (de)serialization, reduces overall latency of the API calls, reduces memory footprint and the work performed by the GC and results in quicker propagation of objects to event handlers of shared informers.

Core system components of K8s default their serialization method to protobuf for 8 years already: kubernetes/kubernetes#25738.

Some benchmarks comparing JSON vs. protobuf showcasing how the latter data format (de)serializes faster and uses less memory:

Copy link
Collaborator

@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.

Quick question about copying, but it looks ok. Curious about potential problems we could find. Is there a case where potential non-GKE k8s would ONLY support JSON and this will fail or client is able to fallback?

thanks!

@tosi3k
Copy link
Contributor Author

tosi3k commented Sep 17, 2024

Is there a case where potential non-GKE k8s would ONLY support JSON and this will fail or client is able to fallback?

It would only fail in K8s older than 1.3 in which protobuf support was added. It's embedded in the server and can't be turned off.

@bwplotka bwplotka merged commit 9de5732 into GoogleCloudPlatform:main Sep 17, 2024
25 checks passed
@bwplotka
Copy link
Collaborator

Thanks!

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.

2 participants