Skip to content

Commit 78a4fde

Browse files
committed
Add FAQ section on how to avoid excessive LIST load when writing apps
1 parent bebdabe commit 78a4fde

File tree

1 file changed

+25
-0
lines changed
  • sig-scalability/configs-and-limits

1 file changed

+25
-0
lines changed

sig-scalability/configs-and-limits/faq.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,31 @@ summarized as:
6262
- if you can't keep your object size below 100kB, reach out to SIG
6363
Scalability and discuss the usecase to see how we can make it performant
6464

65+
### How should we code client applications to improve scalability?
66+
67+
As noted above, LIST requests can be particularly expensive. So when working with lists
68+
that may have more than a few thousand elements, consider these guidelines:
69+
70+
1. When defining a new resource type (new CRD) consider expected numbers
71+
of objects that will exist (numbers of CRs). See guidelines
72+
[here](https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/95-custom-resource-definitions#scale-targets-for-ga).
73+
1. If your code needs to hold an up-to-date list of objects in memory,
74+
avoid repeated LIST calls if possible. Instead consider using the
75+
`Informer` classes that are provided in most Kubernetes client
76+
libraries. Informers automatically combine LIST and WATCH functionality
77+
to efficiently maintain an in-memory collection.
78+
1. If `Informer`s don't suit your needs, try to use the API Server cache
79+
when LISTing. To use the cache you must supply a `ResourceVersion`.
80+
Read the [documentation about ResourceVersions](https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions) carefully to understand how it will affect the
81+
freshness of the data you receive.
82+
1. If you can't use `Informer`s AND you can't use the API Server cache,
83+
then be sure to [read large lists in chunks](https://kubernetes.io/docs/reference/using-api/api-concepts/#retrieving-large-results-sets-in-chunks).
84+
1. Consider the number of instances of your client application which will be running. For instance,
85+
there is a big difference between having
86+
just one controller listing objects, versus having demonsets on every node
87+
doing the same thing. If there will be many instances of your client application
88+
(either in daemonsets or some other form) you should be particularly careful
89+
about LIST-related load.
6590

6691
### How do you setup clusters for scalability testing?
6792

0 commit comments

Comments
 (0)