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: Inaccurate Memory Resource Example #25023

Conversation

robert-c-ewing
Copy link
Contributor

Description

Fix: Inaccurate Memory Resource Example

Nomad memory sizes are always in binary units (plenty of places with e.g. MemoryMB * 1024 * 1024 around the codebase). This snippet of documentation, however, is misleading, and implies that Nomad manages/tracks memory with decimal units.

Without going crazy changing "MB"->"MiB" everywhere, causing mass confusion and horrid edit wars, let's just change this one number! This is a subtle but effective way to signal to developers that we're using binary-based sizes.

(Even if this argument fails, this documentation is plain wrong: MemoryMB = 2000 will use ~2.1GB: 2000 binary megabytes, 1048576 bytes each.)

Testing & Reproduction steps

N/A

Links

Example of size computation in Docker driver, clearly computing mibibytes

Contributor Checklist

  • Changelog Entry If this PR changes user-facing behavior, please generate and add a
    changelog entry using the make cl command.
  • Testing Please add tests to cover any new functionality or to demonstrate bug fixes and
    ensure regressions will be caught.
  • Documentation If the change impacts user-facing functionality such as the CLI, API, UI,
    and job configuration, please update the Nomad website documentation to reflect this. Refer to
    the website README for docs guidelines. Please also consider whether the
    change requires notes within the upgrade guide.

Reviewer Checklist

  • Backport Labels Please add the correct backport labels as described by the internal
    backporting document.
  • Commit Type Ensure the correct merge method is selected which should be "squash and merge"
    in the majority of situations. The main exceptions are long-lived feature branches or merges where
    history should be preserved.
  • Enterprise PRs If this is an enterprise only PR, please add any required changelog entry
    within the public repository.

Internally, sizes are always in binary units; this documentation is misleading and implies that they work in decimal units.

Without going through and replacing _every_ "MB" -> "MiB" this is the best way to hint to developers that binary sizes are used.
@robert-c-ewing robert-c-ewing requested review from a team as code owners February 4, 2025 17:40
Copy link

hashicorp-cla-app bot commented Feb 4, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

Copy link
Contributor

@aimeeu aimeeu left a comment

Choose a reason for hiding this comment

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

Thanks for addressing this. Looks like this slipped in over 5 years ago.

@aimeeu aimeeu added theme/docs Documentation issues and enhancements backport/website This will backport PR changes to `stable-website` && the latest release-branch backport/1.7.x backport to 1.7.x release line backport/ent/1.7.x+ent Changes are backported to 1.7.x+ent backport/ent/1.8.x+ent Changes are backported to 1.8.x+ent backport/1.8.x backport to 1.8.x release line backport/1.9.x backport to 1.9.x release line labels Feb 4, 2025
@aimeeu aimeeu merged commit 824d362 into hashicorp:main Feb 4, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/ent/1.7.x+ent Changes are backported to 1.7.x+ent backport/ent/1.8.x+ent Changes are backported to 1.8.x+ent backport/website This will backport PR changes to `stable-website` && the latest release-branch backport/1.7.x backport to 1.7.x release line backport/1.8.x backport to 1.8.x release line backport/1.9.x backport to 1.9.x release line theme/docs Documentation issues and enhancements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants