You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: keps/sig-api-machinery/20191210-consistent-reads-from-cache.md
+23-2Lines changed: 23 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,7 @@ read from etcd.
39
39
-[Summary](#summary)
40
40
-[Motivation](#motivation)
41
41
-[Goals](#goals)
42
+
-[Non-Goals](#non-goals)
42
43
-[Proposal](#proposal)
43
44
-[Consistent reads from cache](#consistent-reads-from-cache-1)
44
45
-[Use WithProgressNotify to enable automatic watch updates](#use-withprogressnotify-to-enable-automatic-watch-updates)
@@ -52,6 +53,7 @@ read from etcd.
52
53
-[Option: Enable pagination in the watch cache](#option-enable-pagination-in-the-watch-cache)
53
54
-[Rejected Option: Return unpaginated responses to paginated list requests](#rejected-option-return-unpaginated-responses-to-paginated-list-requests)
54
55
-[What if the watch cache is stale?](#what-if-the-watch-cache-is-stale)
56
+
-[Ability to Opt-out](#ability-to-opt-out)
55
57
-[Test Plan](#test-plan)
56
58
-[Rollout Plan](#rollout-plan)
57
59
-[Serving consistent reads from cache](#serving-consistent-reads-from-cache)
@@ -125,6 +127,12 @@ serves the resourceVersion="0" list requests from reflectors today.
125
127
- Resolve the "stale read" problem (https://github.com/kubernetes/kubernetes/issues/59848)
126
128
- Improve the scalability and performance of Kubernetes for Get and List requests, when the watch cache is enabled
127
129
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
+
128
136
## Proposal
129
137
130
138
### Consistent reads from cache
@@ -144,7 +152,7 @@ When an consistent LIST request is received and the watch cache is enabled:
144
152
145
153
- 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).
146
154
- 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)
148
156
149
157
To get the revsion we have some options:
150
158
@@ -154,6 +162,8 @@ To get the revsion we have some options:
154
162
Consistent GET requests will continue to be served directly from etcd. We will
155
163
only serve consistent LIST requests from cache.
156
164
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
+
157
167
Optional: For some (but not all) of the etcd progress watch events, also create a
158
168
kubernetes "bookmark" watch event and send it to kube-apiserver clients so that
159
169
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:
198
208
- Reflector list/relist requests, which occur at startup and after a reflector
199
209
falls to far behind processing events (e.g. it was partitioned or resource starved)
200
210
- Controllers that directly perform consistent LIST requests
201
-
- kubectl LIST requests
202
211
203
212
In all cases, increasing latency in exchange for higher overall system
204
213
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.
222
231
Later, we could transition to "Serve 1st page of paginated requests from the watch cache"
223
232
which would expand cache usage to a much larger proportion of all consistent read requests.
224
233
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
+
225
239
#### Option: Continue to serve all paginated requests from etcd
226
240
227
241
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
310
324
rate limiting to prevent cascading failure. I.e. `Retry-After` HTTP header (for
311
325
well behaved clients) and [Priority and Fairness](https://github.com/kubernetes/enhancements/blob/master/keps/sig-api-machinery/20190228-priority-and-fairness.md).
312
326
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
0 commit comments