-
Notifications
You must be signed in to change notification settings - Fork 77
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
Add capacity planning document #1714
Merged
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7a1410c
:pencil: add capacity plannnig document
vankichi 60aeef3
Apply suggestions from code review
vankichi 9b9bf7b
:pencil: fix RAM calculation
vankichi 15e2914
Apply suggestions from code review
vankichi 7fba112
Merge branch 'master' into documentation/docs/add-capacity-plannnig
vankichi f03e879
Update docs/user-guides/capacity-plannig.md
vankichi e54b555
:pencil: fix capacity planning doc
vankichi 1a7964d
:pencil: add affinity section
vankichi 644e39d
:pencil: add warning about affinity setting
vankichi 6a9b6da
Merge branch 'master' into documentation/docs/add-capacity-plannnig
vankichi 1f1348b
:recycle: update .prh.yaml
vankichi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
# Capacity Planning | ||
|
||
## What is capacity planning for the Vald cluster? | ||
|
||
Capacity planning is essential before deploying the Vald cluster to the cloud service. | ||
There are three viewpoints: Vald cluster view, Kubernetes view, and Component view. | ||
Let's see each view. | ||
|
||
## Vald cluster view | ||
|
||
The essential point at the Vald cluster view is the hardware specification, especially RAM. | ||
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
The Vald cluster, especially Vald Agent components, requires much RAM capacity because the vector index is stored in memory. | ||
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
It is easy to figure out the minimum required RAM capacity by the following formula. | ||
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```bash | ||
( { the dimension vector } × { bit number of vector } + { the bit of vectors ID string } ) × { the maximum number of the vector } × { the index replica } | ||
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` | ||
|
||
For example, if you want to insert 1 million vectors with 900 dimensions and the object type is 32-bit with 32 byte (256 bit) ID, and the index replica is 3, the minimum required RAM capacity is: | ||
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```bash | ||
(900 × 32 + 256 ) × 1,000,000 × 3 = 8,7168,000,000 (bit) = 10.896 (GB) | ||
``` | ||
|
||
It is just the minimum required RAM for indexing. | ||
Considering the margin of RAM capacity, the minimum RAM capacity should be less than 60% of the actual RAM capacity. | ||
Therefore, the actual minimum RAM capacity will be: | ||
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```bash | ||
8,7168,000,000 (bit) / 0.6 = 145,280,000,000 (bit) = 18.16 (GB) | ||
``` | ||
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
<div class="warn"> | ||
In the production usage, memory usage may be not enough in the minimum required RAM.<BR> | ||
E.g., there are a noisy problem, high memory usage for createIndex (indexing on memory), high traffic needs more memory, etc. | ||
</div> | ||
|
||
## Kubernetes cluster view | ||
|
||
### Pod priority & QoS | ||
|
||
When the Node capacity (e.g., RAM, CPU) reaches the limit, Kubernetes will decide to kill some Pods according to QoS and Pod priority. | ||
Kubernetes performs pod scheduling with pods Priority Class as the priority and QoS as the second priority. | ||
|
||
**Pod priority** | ||
|
||
Pod priority has the integer value, and the higher value, the higher priority. | ||
|
||
Each Vald component has the default priority value: | ||
|
||
- Agent: 1000000000 | ||
- Discoverer: 1000000 | ||
- Filter Gateway: 1000000 | ||
- LB Gateway: 1000000 | ||
- Index Manager: 1000000 | ||
|
||
Therefore, the order of priority is as follows: | ||
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```bash | ||
Agent > Discoverer = Filter Gateway = LB Gateway = Index Manger | ||
``` | ||
|
||
Those values will be helpful when the Pods other than the Vald component are in the same Node. | ||
|
||
It is easy to change by editing your `values.yaml`. | ||
|
||
```yaml | ||
# e.g. LB Gateway podPriority settings. | ||
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
... | ||
gateway: | ||
lb: | ||
... | ||
podPriority: | ||
enabled: true | ||
value: {new values} | ||
... | ||
``` | ||
|
||
**QoS** | ||
|
||
QoS value can be either Guaranteed, Burstable, or BestEffort. | ||
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
And, QoS priority is higher in the order of Guaranteed, Burstable, BestEffort, and Kubernetes will kill Pods in ascending order of importance. | ||
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Resource request and limit determine QoS. | ||
|
||
The below table shows the condition for each QoS. | ||
|
||
| QoS | request CPU | request Memory | limit CPU | request Memory | Sup. | | ||
| :--------: | :-------------: | :------------: | :-------------: | :-------------: | :---------------------------------- | | ||
| Guaranteed | :o: | :o: | :o: | :o: | All settings are required. | | ||
| Burstable | :o: (:warning:) | :o: (:warning) | :o: (:warning:) | :o: (:warning:) | One to three settings are required. | | ||
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| BestEffort | :x: | :x: | :x: | :x: | No setting is required. | | ||
|
||
Vald requires many RAM resources because of on-memory indexing, so we highly recommend that you do not specify a limit, especially for the Vald Agent. | ||
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
In this case, QoS will be Burstable. | ||
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
**Throttling** | ||
|
||
The CPU throttling affects the pod performance. | ||
|
||
If it occurs, the Vald cluster operator must consider each component's CPU resource request and limit. | ||
It is easy to change by editing the `values.yaml` file and applying it. | ||
|
||
```yaml | ||
# e.g. LB Gateway resources settings. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LanguageTool] reported by reviewdog 🐶 |
||
... | ||
gateway: | ||
lb: | ||
... | ||
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
resources: | ||
requests: | ||
cpu: 200m | ||
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
memory: 150Mi | ||
limits: | ||
cpu: 2000m | ||
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
memory: 700Mi | ||
... | ||
``` | ||
|
||
<div class="warning"> | ||
Please take care of pod priority and QoS. | ||
</div> | ||
|
||
### Node & Pod affinity | ||
|
||
Kubernetes scheduler often applies Pods on Node based on resource availability. | ||
|
||
In production usage, other components sometimes work on the Kubernetes cluster where the Vald cluster runs. | ||
Depending on the situation, you may want to deploy to a different Node: e.g., when running a machine learning component that requires high memory on an independent Node. | ||
|
||
In this situation, we recommend you to set the affinity/anti-affinity configuration for each Vald component. | ||
It is easy to change by editing each component setting on your `values.yaml`. | ||
|
||
<div class="warn"> | ||
The affinity setting for Vald Agent is the significant for the Vald cluster.<BR> | ||
Please DO NOT remove the default settings. | ||
</div> | ||
|
||
```yaml | ||
# e.g. Agent's affinity settings | ||
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
... | ||
agent: | ||
... | ||
vankichi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
affinity: | ||
nodeAffinity: | ||
preferredDuringSchedulingIgnoredDuringExecution: [] | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
nodeSelectorTerms: [] | ||
podAffinity: | ||
preferredDuringSchedulingIgnoredDuringExecution: [] | ||
requiredDuringSchedulingIgnoredDuringExecution: [] | ||
podAntiAffinity: | ||
preferredDuringSchedulingIgnoredDuringExecution: | ||
- weight: 100 | ||
podAffinityTerm: | ||
topologyKey: kubernetes.io/hostname | ||
labelSelector: | ||
matchExpressions: | ||
- key: app | ||
operator: In | ||
values: | ||
- vald-agent-ngt | ||
requiredDuringSchedulingIgnoredDuringExecution: [] | ||
... | ||
``` | ||
|
||
For more information about Kubernetes affinity, please refer to [here](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity) | ||
|
||
## Component view | ||
|
||
Depending on the customization of each component for each user, there are some points to be aware of. | ||
|
||
**Index Manager** | ||
|
||
If the `saveIndex` is executed frequently, the backup data per unit time will increase, which consumes bandwidth. | ||
|
||
Similarly, as the saveIndex concurrency increases, the backup data per unit time increases. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be better to add Guaranteed and BestEffort and QoS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kpango updated