Skip to content
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

[DPE-6124] optimise max map for VM deployments #522

Merged
merged 5 commits into from
Dec 13, 2024

Conversation

MiaAltieri
Copy link
Contributor

@MiaAltieri MiaAltieri commented Dec 11, 2024

Context

Solves issue #518 which reports 2024-11-28T21:05:16.089+00:00: vm.max_map_count is too low

This message comes from the fact that each network connection requires 2 mapped virtual memory areas. So mongodb is pointing out that if the server accepts all of the connections allowed, it will not have enough maps and possibly cause the mongod to crash.

MongoDB defines this value to be 2x the possible of soft ulimit. We could automatically set vm.max_map to 2x of soft ulimit. But I believe this is not advisable since each memory-mapped area consumes resources, and having too many can lead to increased memory usage and slower performance. Question - is there a programmatic way to determine at what point the number of memory mapped areas is detrimental? If so we could always consider decreasing the ulimt.

With that said I believe setting it to 262144 is a good spot to start and we could come back to these questions later in the future

Solution

We adopted an approach similar to Kafka here which is to set vm_max when possible. If it is not possible we log a warning and do not attempt to set it again

Testing

tested by hand in OpenStack deployment to verify that the following warning does not appear when connecting to Mongodb. But it was necessary to restart mongod to have the message go away.

   2024-11-28T21:05:16.089+00:00: vm.max_map_count is too low

know issue

vm.max_map_count is too low

is present until charmed-mongodb.mongod is restarted (despite the value being set before the installation of thecharmed-mongodb snap.)

@MiaAltieri MiaAltieri marked this pull request as draft December 11, 2024 16:26
@MiaAltieri MiaAltieri marked this pull request as ready for review December 12, 2024 08:46
@MiaAltieri MiaAltieri merged commit 0b571ba into 6/edge Dec 13, 2024
29 of 33 checks passed
@MiaAltieri MiaAltieri deleted the DPE-6124-optimise-max-map branch December 13, 2024 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants