-
Notifications
You must be signed in to change notification settings - Fork 203
K8SPXC-1327: Make jemalloc the default memory allocator #2002
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
base: main
Are you sure you want to change the base?
Conversation
https://perconadev.atlassian.net/browse/K8SPXC-1327 Problem: By default, standard libc allocator is used by PXC. It is often desirable to use jemalloc instead. To do so, use has to configure LD_PRELOAD environment variable. The only way to do this is through k8s secret. Solution: Extended PodSpec object with MySqlAllocator property. If it is empty, omitted or set to 'jemalloc', LD_PRELOAD env variable pointing to jemalloc library will be exported. Otherwise the default allocator will be used.
deploy/cr.yaml
Outdated
| size: 3 | ||
| image: perconalab/percona-xtradb-cluster-operator:main-pxc8.0 | ||
| autoRecovery: true | ||
| # mySqlAllocator: jemalloc |
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.
In cr we have a commented option with a default value. In our doc, we will add all possible values. Also, you can add them in CRD. It is possible to add validation on CRD level.
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.
In cr we have a commented option with a default value. In our doc, we will add all possible values.
Done
Also, you can add them in CRD. It is possible to add validation on CRD level.
I'm not sure I understand where and what to add.
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.
validation rules are defined using comments called kubebuilder markers: https://book.kubebuilder.io/reference/markers/crd-validation
for example:
- MySQLAllocator string `json:"mysqlAllocator,omitempty"`
+
+ // +kubebuilder:validation:Required
+ // +kubebuilder:validation:Enum={jemalloc,tcmalloc}
+ // +kubebuilder:default=jemalloc
+ MySQLAllocator string `json:"mysqlAllocator,omitempty"`afterwards you need to regenerate manifests: make generate manifests VERSION=main (do this after merging main and fixing conflicts)
https://perconadev.atlassian.net/browse/K8SPXC-1327 Logic simplified. LD_PRELOAD is set always via appc.Env.
https://perconadev.atlassian.net/browse/K8SPXC-1327 Addressed review comments.
94ebe85 to
9b9576e
Compare
https://perconadev.atlassian.net/browse/K8SPXC-1628 Extended solution for K8SPXC-1327 to allow usage of tcmalloc.
| }...) | ||
| } | ||
|
|
||
| if cr.CompareVersionWith("1.18.0") >= 0 { |
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.
we need to change this version to 1.19.0 since 1.18.0 is already released
commit: 4292959 |
|
please also have a look on the unit tests cause they are failing due to the proposed changes. 🙏🏽 |
|
I'll address comments and fix tests |
https://perconadev.atlassian.net/browse/K8SPXC-1327
Problem:
By default, standard libc allocator is used by PXC. It is often desirable to use jemalloc instead. To do so, use has to configure LD_PRELOAD environment variable. The only way to do this is through k8s secret.
Solution:
Extended PodSpec object with MySqlAllocator property. If it is empty, omitted or set to 'jemalloc', LD_PRELOAD env variable pointing to jemalloc library will be exported.
Otherwise the default allocator will be used.
CHANGE DESCRIPTION
Problem:
Short explanation of the problem.
Cause:
Short explanation of the root cause of the issue if applicable.
Solution:
Short explanation of the solution we are providing with this PR.
CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
compare/*-oc.yml)?Config/Logging/Testability