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

compute_ctl: Auto-set dynamic_shared_memory_type #7348

Merged
merged 6 commits into from Apr 10, 2024

Conversation

sharnoff
Copy link
Member

@sharnoff sharnoff commented Apr 9, 2024

Part of neondatabase/cloud#12047.

The basic idea is that for our VMs, we want to enable swap and disable Linux memory overcommit. Alongside these, we should set postgres' dynamic_shared_memory_type to mmap, but we want to avoid setting it to mmap if swap is not enabled.

Implementing this in the control plane would be fiddly, but it's relatively straightforward to add to compute_ctl.

Summary of changes

Change compute_ctl's write_postgres_conf to inject dynamic_shared_memory_type = mmap iff vm.overcommit_memory = 2 (which we can check by reading /proc/sys/vm/overcommit_memory).

Part of neondatabase/cloud#12047.

The basic idea is that for our VMs, we want to enable swap and disable
Linux memory overcommit. Alongside these, we should set postgres'
dynamic_shared_memory_type to mmap, but we want to avoid setting it to
mmap if swap is not enabled.

Implementing this in the control plane would be fiddly, but it's
relatively straightforward to add to compute_ctl.
compute_tools/src/config.rs Outdated Show resolved Hide resolved
compute_tools/src/config.rs Outdated Show resolved Hide resolved
compute_tools/src/pg_helpers.rs Show resolved Hide resolved
Copy link

github-actions bot commented Apr 9, 2024

2754 tests run: 2636 passed, 0 failed, 118 skipped (full report)


Code coverage* (full report)

  • functions: 28.1% (6429 of 22866 functions)
  • lines: 46.8% (45139 of 96400 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
fe5032c at 2024-04-10T13:28:02.477Z :recycle:

@sharnoff
Copy link
Member Author

sharnoff commented Apr 9, 2024

Need to test on staging first, then will merge. 🤞

This reverts commit 3e54a0e.

Apparently cfg!(unix) is valid, but for linux it needs to be
cfg!(target_os = "linux"). :/
@sharnoff
Copy link
Member Author

Tested on staging successfully. Noticed some other issues because I was testing with weird settings: https://neondb.slack.com/archives/C06SW383C79/p1712714106564139

@sharnoff sharnoff enabled auto-merge (squash) April 10, 2024 12:42
@sharnoff sharnoff merged commit f86845f into main Apr 10, 2024
47 of 48 checks passed
@sharnoff sharnoff deleted the sharnoff/compute_ctl-auto-dynamic_shared_memory_type branch April 10, 2024 13:13
sharnoff added a commit that referenced this pull request Apr 10, 2024
Part of neondatabase/cloud#12047.

The basic idea is that for our VMs, we want to enable swap and disable
Linux memory overcommit. Alongside these, we should set postgres'
dynamic_shared_memory_type to mmap, but we want to avoid setting it to
mmap if swap is not enabled.

Implementing this in the control plane would be fiddly, but it's
relatively straightforward to add to compute_ctl.
sharnoff added a commit that referenced this pull request Apr 11, 2024
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.

None yet

2 participants