Skip to content

jemalloc: upgrade from 3.6.0 to 5.3.1 - #1096

Draft
kenhys wants to merge 1 commit into
fluent:masterfrom
kenhys:jemalloc531
Draft

jemalloc: upgrade from 3.6.0 to 5.3.1#1096
kenhys wants to merge 1 commit into
fluent:masterfrom
kenhys:jemalloc531

Conversation

@kenhys

@kenhys kenhys commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

In the historical reasons, there are memory consumption issue between 4.x and 5.2.x for fluent-package.

Since 5.3.x, the situation seems changed about that issue, upgrade it from 3.6.0.

There are trade of about memory and performance, adopted already tuned MALLOC_CONF parameters from here:

https://gist.github.com/jjb/9ff0d3f622c8bbe904fe7a82e35152fc

@kenhys kenhys added the pending Blocked by something label Jul 21, 2026
@kenhys
kenhys force-pushed the jemalloc531 branch 3 times, most recently from 03bf43c to 815684f Compare July 27, 2026 07:31
@kenhys

kenhys commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

Recently checked memory usage trends: RSS and PSS

image

@kenhys

kenhys commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

Another aspects : ref fluent/fluentd#1657

image
  • Executed on single node.
  • Recorded sampling RSS during processing out_forward => in_forward => flush to file
  • Applied export MALLOC_CONF="dirty_decay_ms:0,muzzy_decay_ms:0,narenas:2,background_thread:true,thp:never,abort_conf:true" for jemalloc 5.3.1-tuned
  • Some performance degration was observed for jemalloc-5.3.1-tuned.

@kenhys

kenhys commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

in_tail with 1 GB file (rake benchmark:run:in_tail with fluent-package-builder master)

It seems that total execution time takes a bit longer for jemalloc 5.3.1+MALLOC_CONF.

jemalloc 3.6.0

       user     system      total        real
  11.471232   1.479785  12.951017 ( 13.461987)

jemalloc 5.3.1 vanilla

       user     system      total        real
  11.465409   1.506601  12.972010 ( 12.855354)

jemalloc 5.3.1 + MALLOC_CONF tuning

       user     system      total        real
  12.204533   4.434312  16.638845 ( 15.979180)

In the historical reasons, there are memory consumption issue between
4.x and 5.2.x for fluent-package.

There are trade off about memory usage and performance, see MALLOC_CONF
parameters in details:

https://gist.github.com/jjb/9ff0d3f622c8bbe904fe7a82e35152fc

With dirty_decay_ms:0, it behaves similar to 3.6.0, but you must pay
performance penalty.
dirty_decay_ms:1000 might be conservative approach for performance and
memory usage, but it tends to use more memory in contrast to 3.6.0.

dirty_decay_ms:400 strikes a well-balanced
between memory usage and performance.
(That situation might be changed in future jemalloc release or other
practical benchmarks)

Signed-off-by: Kentaro Hayashi <hayashi@clear-code.com>
@kenhys

kenhys commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

With dirty_decay_ms:0, it behaves similar to 3.6.0, but you must pay
performance penalty.
dirty_decay_ms:1000 might be conservative approach for performance and
memory usage, but it tends to use more memory in contrast to 3.6.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending Blocked by something

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant