Skip to content

Add support to use jemalloc as memory allocator for supported platforms #9496

Open
@VijayanB

Description

@VijayanB

Is your feature request related to a problem? Please describe.
Since OpenSearch KNN Plugin's native engine libraries are written in C++, they can suffer from both internal and external fragmentation by default memory locator(glibc). By adding support (preferably bundle jemalloc with OpenSearch similar to jdk ) to use jemalloc in supported platforms, knn query performance can be improved.

From multiple experiments it is clear that memory allocator can affect the query performance of database engines. jemalloc is a general purpose malloc implementation that emphasizes fragmentation avoidance and scalable concurrency support. It is also used as default memory allocator for applications like Redis, Facebook, Cassandra, Firefox, etc.

Describe the solution you'd like
In supported platforms, jemalloc can be bundled with OpenSearch and used as memory allocator at runtime by updating LD_PRELOAD. This doesn't require any code changes in opensearch knn plugin.

Describe alternatives you've considered
N/A

Additional context
OpenSearch knn team conducted experiments and verified that using jemalloc as memory allocator reduces memory fragmentation and improves query performance . Please see more details here

Metadata

Metadata

Assignees

No one assigned

    Labels

    Build Libraries & InterfacesPerformanceThis is for any performance related enhancements or bugsenhancementEnhancement or improvement to existing feature or request

    Type

    No type

    Projects

    Status

    Open

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions