Skip to content

Commit 486957e

Browse files
committed
Apply feedback
1 parent 5234cc7 commit 486957e

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

keps/sig-api-machinery/20191210-consistent-reads-from-cache.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ read from etcd.
3939
- [Summary](#summary)
4040
- [Motivation](#motivation)
4141
- [Goals](#goals)
42+
- [Non-Goals](#non-goals)
4243
- [Proposal](#proposal)
4344
- [Consistent reads from cache](#consistent-reads-from-cache-1)
4445
- [Use WithProgressNotify to enable automatic watch updates](#use-withprogressnotify-to-enable-automatic-watch-updates)
@@ -52,6 +53,7 @@ read from etcd.
5253
- [Option: Enable pagination in the watch cache](#option-enable-pagination-in-the-watch-cache)
5354
- [Rejected Option: Return unpaginated responses to paginated list requests](#rejected-option-return-unpaginated-responses-to-paginated-list-requests)
5455
- [What if the watch cache is stale?](#what-if-the-watch-cache-is-stale)
56+
- [Ability to Opt-out](#ability-to-opt-out)
5557
- [Test Plan](#test-plan)
5658
- [Rollout Plan](#rollout-plan)
5759
- [Serving consistent reads from cache](#serving-consistent-reads-from-cache)
@@ -125,6 +127,12 @@ serves the resourceVersion="0" list requests from reflectors today.
125127
- Resolve the "stale read" problem (https://github.com/kubernetes/kubernetes/issues/59848)
126128
- Improve the scalability and performance of Kubernetes for Get and List requests, when the watch cache is enabled
127129

130+
### Non-Goals
131+
132+
<<[UNRESOLVED @deads]>>
133+
- Avoid allowing true quorum reads. We should think carefully about this, see: https://github.com/kubernetes/enhancements/pull/1404#discussion_r381528406
134+
<<[/UNRESOLVED]>>
135+
128136
## Proposal
129137

130138
### Consistent reads from cache
@@ -144,7 +152,7 @@ When an consistent LIST request is received and the watch cache is enabled:
144152

145153
- Get the current revision from etcd for the resource type being served. The returned revision is strongly consistent (guaranteed to be the latest revision via a quorum read).
146154
- Use the existing `waitUntilFreshAndBlock` function in the watch cache to wait briefly for the watch to catch up to the current revision.
147-
- If the block times out, fail the request (see "What if the watch cache is stale?" section for details)
155+
- If the block times out, the request will result in rejection. (see "What if the watch cache is stale?" section for details)
148156

149157
To get the revsion we have some options:
150158

@@ -154,6 +162,8 @@ To get the revsion we have some options:
154162
Consistent GET requests will continue to be served directly from etcd. We will
155163
only serve consistent LIST requests from cache.
156164

165+
Important: We are planning to set the progress notify interval to 250ms, which will introduce up to 250ms latency to consistent LIST requests.
166+
157167
Optional: For some (but not all) of the etcd progress watch events, also create a
158168
kubernetes "bookmark" watch event and send it to kube-apiserver clients so that
159169
reflectors and shared informers are kept up-to-date. The benefit of this is that
@@ -198,7 +208,6 @@ The requests this is expected to impact are:
198208
- Reflector list/relist requests, which occur at startup and after a reflector
199209
falls to far behind processing events (e.g. it was partitioned or resource starved)
200210
- Controllers that directly perform consistent LIST requests
201-
- kubectl LIST requests
202211

203212
In all cases, increasing latency in exchange for higher overall system
204213
throughput seems a good trade off. Use cases that need low latency have multiple
@@ -222,6 +231,11 @@ selectively where we believe it will have the most impact.
222231
Later, we could transition to "Serve 1st page of paginated requests from the watch cache"
223232
which would expand cache usage to a much larger proportion of all consistent read requests.
224233

234+
<<[UNRESOLVED]>>
235+
That kubectl makes paginated, so if we enable this feature for paginated requests,
236+
which may add latency to `kubectl get`. We need to be clear on the behavior.
237+
<<[/UNRESOLVED]>>
238+
225239
#### Option: Continue to serve all paginated requests from etcd
226240

227241
Only start serving unpaginated LIST requests with resourceVersion="" from cache. Clients
@@ -310,6 +324,13 @@ Since falling back to etcd won't work, we should fail the requests and rely on
310324
rate limiting to prevent cascading failure. I.e. `Retry-After` HTTP header (for
311325
well behaved clients) and [Priority and Fairness](https://github.com/kubernetes/enhancements/blob/master/keps/sig-api-machinery/20190228-priority-and-fairness.md).
312326

327+
### Ability to Opt-out
328+
329+
<<[UNRESOLVED @deads2k]>>
330+
How to opt out of this behavior and still get a "normal" quorum read? We'll need this ability for our own debugging if nothing else.
331+
See https://github.com/kubernetes/enhancements/pull/1404#issuecomment-588433911
332+
<<[/UNRESOLVED]>>
333+
313334
### Test Plan
314335

315336
Correctness:

0 commit comments

Comments
 (0)