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

fix(memory): increase reserved mem to 30% #13648

Merged
merged 2 commits into from
Nov 28, 2023
Merged

Conversation

fuyufjh
Copy link
Member

@fuyufjh fuyufjh commented Nov 25, 2023

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

The reserved_memory is designed for the difference between actual usage (jemalloc_allocated) and process usage (process_resident_memory).

/// Each compute node reserves some memory for stack and code segment of processes, allocation
/// overhead, network buffer, etc. based on `SYSTEM_RESERVED_MEMORY_PROPORTION`. The reserve memory
/// size must be larger than `MIN_SYSTEM_RESERVED_MEMORY_MB`

As being observed in #13610,

  • jemalloc_allocated_bytes: 8.59 GB
  • jemalloc_active_bytes: 9.93 GB
  • Node memory (RSS): 12.3 GB

The ratio is 8.59/12.3 = 0.698 ≈ 0.7.

Passed longevity test: https://buildkite.com/risingwave-test/longevity-test/builds/818 (Previously this would OOM for 2 times)

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

@github-actions github-actions bot added the type/fix Bug fix label Nov 25, 2023
Copy link
Contributor

@KeXiangWang KeXiangWang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Base automatically changed from eric/refactor_memory_management to main November 25, 2023 03:30
Copy link

codecov bot commented Nov 25, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a3ea7c0) 68.18% compared to head (c71a926) 68.18%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13648      +/-   ##
==========================================
- Coverage   68.18%   68.18%   -0.01%     
==========================================
  Files        1521     1521              
  Lines      261709   261709              
==========================================
- Hits       178454   178442      -12     
- Misses      83255    83267      +12     
Flag Coverage Δ
rust 68.18% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fuyufjh fuyufjh force-pushed the eric/increase_reserved_mem branch from b640bc9 to c71a926 Compare November 25, 2023 03:51
@wcy-fdu wcy-fdu requested a review from hzxa21 November 27, 2023 02:16
@wcy-fdu
Copy link
Contributor

wcy-fdu commented Nov 27, 2023

Previously I also made similar adjustments, hoping to pass the longevity test.
My change is:

const SYSTEM_RESERVED_MEMORY_PROPORTION: f64 = 0.35;
const STORAGE_MEMORY_PROPORTION: f64 = 0.15;

and the longevity test passed without limit rdkakfa fetch_queue_size
https://buildkite.com/risingwave-test/longevity-test/builds/787

Not sure whether should we reduce storage memory size in the meantime. cc @hzxa21

Copy link
Collaborator

@hzxa21 hzxa21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yuhao-su
Copy link
Contributor

Should we consider using stats.mapped or stats.resident instead of allocated in this case?

@fuyufjh
Copy link
Member Author

fuyufjh commented Nov 28, 2023

Should we consider using stats.mapped or stats.resident instead of allocated in this case?

stats.mapped or stats.resident is closer to the actual memory usage (rss), but similar with rss, it doesn't reflect the actual bytes allocated by the program. I would tend to use system rss if we really consider stats.allocated to be too inaccurate.

PS. At the beginning, I planned to replace the jemalloc_allocated to system rss, but I would like to try this "conservative" solution first.

@fuyufjh fuyufjh added this pull request to the merge queue Nov 28, 2023
Merged via the queue into main with commit 2ddab6b Nov 28, 2023
26 of 27 checks passed
@fuyufjh fuyufjh deleted the eric/increase_reserved_mem branch November 28, 2023 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/fix Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants