Skip to content

Reduce MMseqs2 split-memory-limit to prevent OOM kills#104

Open
dbolotin wants to merge 2 commits into
mainfrom
fix/mmseqs2-memory-headroom
Open

Reduce MMseqs2 split-memory-limit to prevent OOM kills#104
dbolotin wants to merge 2 commits into
mainfrom
fix/mmseqs2-memory-headroom

Conversation

@dbolotin

Copy link
Copy Markdown
Contributor

Summary

  • Reduce --split-memory-limit from 80% to 60% of system RAM
  • The flag only controls prefilter database splitting; actual peak usage is ~125% of the set value
  • Clustering and alignment steps use additional uncontrolled memory on top
  • At 80%, total memory could reach 100%+ of container RAM → OOM kills
  • 60% leaves sufficient headroom for all MMseqs2 stages plus OS overhead

Test plan

  • Run clonotype clustering on a dataset that previously OOM'd
  • Verify clustering results are identical (only memory splitting changes, not algorithm)

The --split-memory-limit flag only controls prefilter database splitting.
Actual peak usage is ~125% of this value, and clustering/alignment steps
use additional uncontrolled memory on top. At 80%, total usage could reach
100%+ of container RAM, causing OOM kills. 60% leaves sufficient headroom.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses Out-Of-Memory (OOM) issues encountered during MMseqs2 execution by strategically lowering the --split-memory-limit configuration. By reducing the allocated memory percentage, the system gains crucial headroom to accommodate peak memory demands from various MMseqs2 stages, ensuring more stable and reliable operation.

Highlights

  • MMseqs2 Memory Limit Adjustment: The --split-memory-limit for MMseqs2 has been reduced from 80% to 60% of system RAM.
  • OOM Prevention: This adjustment aims to prevent Out-Of-Memory (OOM) kills by providing sufficient memory headroom, considering that actual peak usage can exceed the set limit and additional memory is consumed by clustering and alignment steps.
Changelog
  • workflow/src/clustering.tpl.tengo
    • Updated the calculation for memLimit to use 60% of system RAM instead of 80%.
    • Added a new comment explaining the rationale for this memory limit adjustment.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request reduces the MMseqs2 --split-memory-limit from 80% to 60% of system RAM to prevent out-of-memory errors. The change also introduces a minimum memory limit of 1GB and switches from ceil to int (truncation) for the calculation, which are sensible improvements. The code change is correct and aligns with the goal. I have one minor suggestion to improve code readability.

// --split-memory-limit controls only the prefilter database splitting;
// actual peak usage is ~125% of this value, plus uncontrolled memory
// from clustering and alignment steps; 60% leaves headroom for all of that
memLimit := "{int(max(system.ram.gb*60/100,1))}" + "G"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

For better readability and consistency with the previous code that used 0.8, it's clearer to use the floating-point literal 0.6 instead of the expression 60/100. While Tengo's division should handle this correctly, using 0.6 avoids any potential confusion about integer division for future maintainers.

	    memLimit := "{int(max(system.ram.gb * 0.6, 1))}" + "G"

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.

1 participant