Repository navigation
Streaming Encoding for LIST Responses #5116
Copy link
Copy link
Closed
Labels
lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.Denotes an issue or PR has remained open with no activity and has become stale.sig/api-machineryCategorizes an issue or PR as relevant to SIG API Machinery.Categorizes an issue or PR as relevant to SIG API Machinery.stage/stableDenotes an issue tracking an enhancement targeted for Stable/GA statusDenotes an issue tracking an enhancement targeted for Stable/GA status
Description
Enhancement Description
- One-line enhancement description (can be used as a release note): Streaming Response Encoding
- Kubernetes Enhancement Proposal: https://github.com/kubernetes/enhancements/blob/master/keps/sig-api-machinery/5116-streaming-response-encoding/README.md
- Previous discussion: Don't copy whole response during response marshalling kubernetes#129304, Streaming json list encoder kubernetes#129334
- Primary contact (assignee): serathius@
- Responsible SIGs: api-machinery
- Enhancement target (which target equals to which milestone):
- Beta release target (x.y): 1.33
- Stable release target (x.y): 1.34
Milestones:
Beta
- KEP (
k/enhancements) update PR(s): KEP-5116: Add KEP (Streaming response encoding) #5119 - Code (
k/k) update PR(s):- Implement tests for deferredResponseWriter to validate behavior on multiple writer calls. kubernetes#130168
- Implement chunking for gzip encoder in
deferredResponseWriterkubernetes#130264 - Implement JSON and Proto list benchmarks
- Implement static analysis to validate json and proto tags of builtin List types kubernetes#130216
- Add tests for encoding collections in JSON for KEP-5116 kubernetes#130220
- Implement tests for encoding collections in Proto kubernetes#130395
- Streaming json list encoder kubernetes#129334
- Implement streaming proto list encoder kubernetes#129407
- Docs (
k/website) update(s):- No planning doc update as feature is not user facing.
-
Stable
- KEP (
k/enhancements) update PR(s): Move KEP-5116 to GA #5324 - Code (
k/k) update PR(s): - Docs (
k/website) update(s): Document KEP-5116 website#51457
- KEP (
-
Optional improvements being worked on that are not blocking for graduation:
Reacted by chenk008, Reficul, William Zhang, haosdent, NovaHe, T Wang, Di Xu, Faeka Ansari and Iván Baldo
Metadata
Metadata
Assignees
Labels
lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.Denotes an issue or PR has remained open with no activity and has become stale.sig/api-machineryCategorizes an issue or PR as relevant to SIG API Machinery.Categorizes an issue or PR as relevant to SIG API Machinery.stage/stableDenotes an issue tracking an enhancement targeted for Stable/GA statusDenotes an issue tracking an enhancement targeted for Stable/GA status
Type
Projects
- StatusShow more project fieldsTracked for code freeze
- StatusShow more project fieldsTracked for code freeze
Activity
serathius commentedon Jan 31, 2025
/sig api-machinery
[-]Streaming Response Encoding[/-][+]Streaming Encoding for LIST Responses[/+]chenk008 commentedon Feb 7, 2025
I'm glad to see this proposal. We have also implemented similar capabilities in our inner repo and are preparing to push this part to upstream. We have submitted a CFP for the upcoming KubeCon China conference.
In our implementation, we use sync.Pool to efficiently manage memory allocation and cache the serialized results of each item. When the buffer reaches a certain size, we execute a flush operation to parallelize the serialization processing and write to http2.
Additionally, we have added support for gzip compression, which is only enabled when the first batch of cached data reaches 128 * 1024.
For json serialization, we have customized the
StreamMarshalmethod for unstructuredList.As for protobuf, we generate code through a generator to ensure reverse protobuf marshalling compatibility.
And it has conducted extensive testing with large datasets and have obtained comparative results. @yulongfang Can you share some benchmark results?
yulongfang commentedon Feb 8, 2025
Thank @chenk008 for your introduction. We have many large-scale clusters in Alibaba Cloud. When the controllers of these large-scale clusters are restarted, they will initiate a full list request to the apiserver, which will have a certain impact on the stability of the cluster. We have to use larger machines to run the apiserver, resulting in a waste of resources.
In this context, we adopted the method to carry out relevant optimization and achieved the following results.
list json format return data stress test scenario description:
list json format return data related stress test data:
qps 0.05
qps 0.1
list protobuf Format Returned data Stress test scenario description:
list configmaps format Returned data Related stress test data:
qps 0.05
qps 0.1
BenTheElder commentedon Feb 12, 2025
FYI: Technical details are usually discussed in KEP PRs or elsewhere, with the KEP issue serving as a place to link back work.
@chenk008 @yulongfang you might consider reviewing #5119
serathius commentedon Feb 13, 2025
Hey @chenk008 @yulongfang please see the previous discussion in kubernetes/kubernetes#129304 and kubernetes/kubernetes#129334.
We also have already done a performance analysis of our changes in kubernetes/kubernetes#129304 (comment).
We also added running a automatic benchmark of list requests. You can see the results in https://perf-dash.k8s.io/#/?jobname=benchmark%20list&metriccategoryname=E2E&metricname=Resources&Resource=memory&PodName=kube-apiserver-benchmark-list-master%2Fkube-apiserver
We currently run it in JSON + configmap with
RV=""configuration, hope to expand it to include Proto, Pods, CustomResources and other types of LIST request. Would be awesome if you can contribute.serathius commentedon Feb 13, 2025
/milestone v1.33
pacoxu commentedon Feb 14, 2025
@jpbetz @dipesh-rawat this is target to v1.33 and the KEP was merged.
Should the lead-opted-in and tracked label be added and tracked by release team?
dipesh-rawat commentedon Feb 14, 2025
@serathius @pacoxu Unfortunately, the enhancement freeze deadline has passed, and this KEP issue was not
lead-opted-in, so it wasn’t added to the tracking board for the v1.33 release. Post-freeze, we've disabled the automated sync job for KEP issues to the tracking board.To move forward, we’ll need a short exception request filed so the team can add the lead-opted-in label and manually include this in the tracking board.
If you still wish to progress this enhancement in v1.33, please file an exception request as soon as possible, within three days. If you have any questions, you can reach out in the #release-enhancements channel on Slack and we'll be happy to help. Thanks!
(cc v1.33 Release Lead @npolshakova)
serathius commentedon Feb 14, 2025
Ups, @jpbetz is OOO. @deads2k can you take a look?
serathius commentedon Feb 14, 2025
Sent https://groups.google.com/g/kubernetes-sig-release/c/fDI9FdlClnA
58 remaining items
yujen77300 commentedon Jul 21, 2025
Hello @serathius 👋, 1.34 Docs Shadow here.
Please take a look at Documenting for a release - PR Ready for Review to get your PR ready for review before Tuesday July 29th 2025 18:00 PST.
Thank you!
jpbetz commentedon Jul 22, 2025
Hi @fykaa, SIG API Machinery lead here. I just wanted to confirm this is code complete for code freeze. There are a couple PRs that were listed as "optional" that were listed under the stable graduation criteria. I've confirmed that there are not blocking and moved them out of the graduation criteria. This should not be good to go for code freeze.
fykaa commentedon Jul 23, 2025
@jpbetz your response makes it eligible to be tracked for code freeze!
Thanks for the update!
rayandas commentedon Sep 16, 2025
Hi @serathius 👋, v1.35 Enhancements Lead here.
I am closing the v1.34 milestone now.
If you'd like to work on this enhancement in v1.35, please have the SIG lead opt-in by adding the
lead-opted-inlabel, which ensures it gets added to the tracking board. Also, please set the milestone to v1.35 using/milestone v1.35.Thanks!
/remove-label lead-opted-in
/remove-label tracked/yes
/milestone clear
k8s-triage-robot commentedon Dec 15, 2025
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
lifecycle/staleis appliedlifecycle/stalewas applied,lifecycle/rottenis appliedlifecycle/rottenwas applied, the issue is closedYou can:
/remove-lifecycle stale/closePlease send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
serathius commentedon Dec 16, 2025
Let's close and track followup separatly
/close
k8s-ci-robot commentedon Dec 16, 2025
@serathius: Closing this issue.
Details
In response to this:
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-sigs/prow repository.