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

Pagination from cache KEP #5017

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

serathius
Copy link
Contributor

Create first draft of #4988 as provisional.

/cc @wojtek-t @deads2k @MadhavJivrajani @jpbetz

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Dec 30, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: serathius
Once this PR has been reviewed and has the lgtm label, please assign apelisse for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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 kind/kep Categorizes KEP tracking issues and PRs modifying the KEP directory sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 30, 2024
@dims
Copy link
Member

dims commented Dec 30, 2024

cc @mengqiy @chaochn47 @shyamjvs

As still some pagination requests will be delegated to etcd, we will monitor the
success rate by measuring the pagination cache hit vs miss ratio.

Consideration: Should we start respecting the limit parameter?
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure I understand - are we not respecting the limit parameter in the current iteration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently API server doesn't respect limit when serving RV="0". https://github.com/kubernetes/kubernetes/blob/6746df77f2376c6bc1fd0de767d2a94e6bd6cec1/staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher.go#L806-L818

I think we should consider re-enabling limit for consistency, however we need to better understand consequences. Impact on client/server when we cannot serve pagination from cache, like with L7 LB or pagination taking more than 75s.

I'm not worried about clients, user setting limit should be already prepared to handle pagination as it is required when not setting RV.


For setups with L4 loadbalancer apiserver can be configured with Goaway, which
requests client reconnects periodically, however per request probability should
be configured around 0.1%.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason for 0.1% here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

0.1% is the recommended to configuration for GOAWAY kubernetes/kubernetes#88567

requests client reconnects periodically, however per request probability should
be configured around 0.1%.

For L7 loadbalancer the default algorithm usually is round-robin. For most LBs
Copy link
Contributor

@MadhavJivrajani MadhavJivrajani Jan 2, 2025

Choose a reason for hiding this comment

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

Trying to better understand this, is the worst case here as follows (assume 3 API Servers A, B, C):

  1. Client hits API Server A: assuming the rv is cached, snapshot is created on receiving a LIST request with a limit parameter set
  2. Client hits API Server B: no snapshot present, we delegate to etcd
  3. Client hits API Server C: no snapshot present, we delegate to etcd

so the performance degenerates to the current situation without cached pagination with slight improvement for (1)? And if (1) also delegates to etcd in case the rv isn't cached, then perf degenerates to the current scenario of no cached pagination?

Copy link
Contributor

Choose a reason for hiding this comment

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

This ^ is assuming all are on a version that has support for pagination from the cache. If there is one server that is on a minor version which does not have support, my understanding is that that would again be delegated to etcd

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, there is no regression, assuming that:

  • We will delegate continue requests, that we don't have cached responses for, to etcd.
  • We will not change how API server doesn't respect limit for RV="0".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/kep Categorizes KEP tracking issues and PRs modifying the KEP directory sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants