valkey-io / valkey

A new project to resume development on the formerly open-source Redis project. We're calling it Valkey, since it's a twist on the key-value datastore.

Home Page:https://valkey.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[NEW] Consider support for mimalloc allocator

jirutka opened this issue · comments

Can you please consider adding support for mimalloc (v2) as an alternative to jemalloc? mimalloc is faster in benchmarks and smaller than jemalloc.

Related issues:

I have nothing against this, especially if it's done in a way that users can opt-in to. We do have some special code to allow for active defragmentation of Jemalloc arenas, so we might also want to figure out how to implement that in mimalloc. Ideally the next step would be for someone to put together a PoC and validate the performance is actually better.

Agreed. Contributions are welcome.

We do have some special code to allow for active defragmentation of Jemalloc arenas, so we might also want to figure out how to implement that in mimalloc.

defrag is enabled explicitly only when jemalloc is used so this should be fine. in other words, you get defrag with jemalloc only.

I am aligned with adding mimalloc as long as we don't vendor it. On a related note, I think we should move forward and remove the one-off je_get_defrag_hint patch and instead use more generic heuristics for defrag so that other allocators could benefit from the defrag feature as well. jemalloc should be devendored too.

There are indications that jemalloc is faster and uses less memory than mimalloc. See for example: rust-lang/rust-analyzer#1441 (comment)

The used jemalloc version is quite old. The main challenge is related to porting this defrag patch. We need to check what are the alternatives.