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

Performance improvement via hints to/heuristics in memory allocator to use huge pages for large data #57740

Open
NitinAtIntel opened this issue Apr 4, 2025 · 0 comments
Labels
feature request Issues that request new features to be added to Node.js.

Comments

@NitinAtIntel
Copy link

NitinAtIntel commented Apr 4, 2025

What is the problem this feature will solve?

Running the built in node benchmark suite for base64 encode/decode utilizing transparent huge pages set to always results in performance of 106% to 172% vs running with madvise (when tested with commit 5812a61).
Note, when tested with LTS 22.14 the range was 172% to 309%.

For methodology, the tests below were run 100 times each for both always and madvise and their results averaged.

The table below shows the value for the average result with always / average result with madvise.

Benchmark Test buffer-base64-decode size=8388608 n=32 buffer-base64-decode-wrapped n=32 linesCount=524288 charsPerLine=76 buffer-base64-encode n=32 len=67108864 buffer-base64url-decode size=8388608 n=32 buffer-base64url-encode n=32 len=67108864
Node 22.14 3.079115679 2.774162727 1.727336591 3.091227005 1.747503062
Node main commit 5812a61 1.067634277 1.099233215 1.722381376 1.06085614 1.580911119

What is the feature you are proposing to solve the problem?

The proposal is to provide a either a hinting mechanism to the memory allocator or a heuristics based method for the allocator to allocate 2MB huge pages when larger, contiguous data is detected.

What alternatives have you considered?

The primary alternative would be to rely on the user to configure their THP setting manually. However, when used globally in this way, memory fragmentation could result and it does not appear to be an efficient solution.

@NitinAtIntel NitinAtIntel added the feature request Issues that request new features to be added to Node.js. label Apr 4, 2025
@github-project-automation github-project-automation bot moved this to Awaiting Triage in Node.js feature requests Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js.
Projects
Status: Awaiting Triage
Development

No branches or pull requests

1 participant