Skip to content

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

@NitinAtIntel

Description

@NitinAtIntel

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.stale

    Type

    No type

    Projects

    Status

    Awaiting Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions