-
Notifications
You must be signed in to change notification settings - Fork 17
K8SPSMDB-1318 Documented concurrent reconciliation #258
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
Open
nastena1606
wants to merge
4
commits into
main
Choose a base branch
from
K8SPSMDB-1318-Doc-concurrent-reconciliation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+77
−0
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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 hidden or 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,75 @@ | ||
# Configure concurrency for a cluster reconciliation | ||
|
||
Reconciliation is the process by which the Operator continuously compares the desired state with the actual state of the cluster. The desired state is defined in a Kubernetes custom resource, like PerconaServerMongoDB. | ||
|
||
If the actual state does not match the desired state, the Operator takes actions to bring the system into alignment. This means creating, updating, or deleting Kubernetes resources (Pods, Services, ConfigMaps, etc.) or performing database-specific operations like scaling, backups, or failover. | ||
|
||
Reconciliation is triggered by a variety of events, including: | ||
|
||
- Changes to the cluster configuration | ||
- Changes to the cluster state | ||
- Changes to the cluster resources | ||
|
||
By default, the Operator has one reconciliation worker. This means that if you deploy or update 2 clusters at the same time, the Operator will reconcile them sequentially. | ||
|
||
The `MAX_CONCURRENT_RECONCILES` environment variable in the `percona-server-mongodb-operator` deployment controls the number of concurrent workers that can reconcile resources in Percona Server for MongoDB clusters in parallel. | ||
|
||
Thus, to extend the previous example, if you set the number of reconciliation workers to `2`, the Operator will reconcile both clusters in parallel. This also helps you with benchmarking the Operator performance. | ||
|
||
The general recommendation is to set the number of concurrent workers equal to the number of Percona Server for MongoDB clusters. When the number of workers is greater, the excessive workers will remain idle. | ||
|
||
## Set the number of reconciliation workers | ||
|
||
1. Check the index of the `MAX_CONCURRENT_RECONCILES` environment variable using the following command: | ||
|
||
```{bash data-prompt="$"} | ||
$ kubectl get deployment percona-server-mongodb-operator -o jsonpath='{.spec.template.spec.containers[0].env[?(@.name=="MAX_CONCURRENT_RECONCILES")].value}' | ||
``` | ||
|
||
??? example "Sample output" | ||
|
||
```{.json .no-copy} | ||
1 | ||
``` | ||
|
||
2. To set a new value and verify it's been updated, run the following command: | ||
|
||
```{.bash data-prompt="$"} | ||
$ kubectl patch deployment percona-server-mongodb-operator \ | ||
--type='strategic' \ | ||
-o yaml \ | ||
-p='{ | ||
"spec": { | ||
"template": { | ||
"spec": { | ||
"containers": [ | ||
{ | ||
"name": "percona-server-mongodb-operator", | ||
"env": [ | ||
{ | ||
"name": "MAX_CONCURRENT_RECONCILES", | ||
"value": "2" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} | ||
}'\ | ||
-o jsonpath='{.spec.template.spec.containers[0].env[?(@.name=="MAX_CONCURRENT_RECONCILES")].value}' | ||
``` | ||
|
||
The command does the following: | ||
|
||
- Patches the deployment to update the `MAX_CONCURRENT_RECONCILES` environment variable | ||
- Sets the value to `2`. | ||
- Outputs the result | ||
|
||
You can set the value to any number greater than 0. | ||
|
||
??? example "Sample output" | ||
|
||
```{.text .no-copy} | ||
2 | ||
``` |
This file contains hidden or 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.
The navigation entry lacks a descriptive title. It should include a human-readable title like the other entries in this section, for example:
- \"Configure concurrent reconciliation\": reconciliation-concurrency.md
Copilot uses AI. Check for mistakes.