From 27e6397eec0e04214e68b277d71dcccab10b9acc Mon Sep 17 00:00:00 2001 From: Kentaro Hayashi Date: Tue, 21 Jul 2026 17:04:42 +0900 Subject: [PATCH 1/3] jemalloc: upgrade from 3.6.0 to 5.3.1 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 --- fluent-package/Rakefile | 5 +++-- fluent-package/config.rb | 4 ++-- fluent-package/templates/etc/systemd/fluentd.service.erb | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/fluent-package/Rakefile b/fluent-package/Rakefile index bfb4bcd20..13d2b9daf 100755 --- a/fluent-package/Rakefile +++ b/fluent-package/Rakefile @@ -693,8 +693,9 @@ class BuildTask puts "::group::Build jemalloc from source" if ENV["CI"] tarball = @download_task.file_jemalloc_source source_dir = tarball.sub(/\.tar\.bz2$/, '') + tar_options = ["--no-same-owner"] - sh(*tar_command, "xvf", tarball, "-C", DOWNLOADS_DIR) + sh(*tar_command, "xvf", tarball, "-C", DOWNLOADS_DIR, *tar_options) configure_opts = [ "--prefix=#{install_prefix}", @@ -1051,7 +1052,7 @@ class BuildTask tarball = @download_task.file_jemalloc_source source_dir = File.basename(tarball.sub(/\.tar\.bz2$/, '')) license_file = File.join(source_dir, "COPYING") - tar_options = [] + tar_options = ["--no-same-owner"] tar_options << "--force-local" if windows? sh(*tar_command, "xf", tarball, license_file, *tar_options) mv(license_file, "LICENSE-jemalloc.txt") diff --git a/fluent-package/config.rb b/fluent-package/config.rb index 11d6f3e46..172efc8f6 100644 --- a/fluent-package/config.rb +++ b/fluent-package/config.rb @@ -13,8 +13,8 @@ # https://github.com/jemalloc/jemalloc/releases # Use jemalloc 3.x to reduce memory usage # See https://github.com/fluent-plugins-nursery/fluent-package-builder/issues/305 -JEMALLOC_VERSION = "3.6.0" -#JEMALLOC_VERSION = "5.2.1" +#JEMALLOC_VERSION = "3.6.0" +JEMALLOC_VERSION = "5.3.1" # https://www.openssl.org/source/ OPENSSL_FOR_MACOS_VERSION = "3.0.8" diff --git a/fluent-package/templates/etc/systemd/fluentd.service.erb b/fluent-package/templates/etc/systemd/fluentd.service.erb index 5c3844159..94f73b15c 100644 --- a/fluent-package/templates/etc/systemd/fluentd.service.erb +++ b/fluent-package/templates/etc/systemd/fluentd.service.erb @@ -19,6 +19,7 @@ Environment=FLUENT_CONF_INCLUDE_DIR=/etc/<%= package_dir %>/conf.d Environment=FLUENT_PLUGIN=/etc/<%= package_dir %>/plugin Environment=FLUENT_SOCKET=/var/run/<%= package_dir %>/<%= service_name %>.sock Environment=FLUENT_PACKAGE_LOG_FILE=/var/log/<%= package_dir %>/<%= service_name %>.log +Environment=MALLOC_CONF="dirty_decay_ms:400,muzzy_decay_ms:0,narenas:2,background_thread:true,thp:never,abort_conf:true" <% if pkg_type == 'deb' %> EnvironmentFile=-/etc/default/<%= service_name %> <% else %> From b0e46cb0580ebf42000e386b1c70e05c3d5af0ad Mon Sep 17 00:00:00 2001 From: Kentaro Hayashi Date: Fri, 7 Aug 2026 16:40:15 +0900 Subject: [PATCH 2/3] yum: improve compatibility with kernel-64K It supports 4k kernel and kernel-64 runtime. There is no need to apply only el7 and el8. Signed-off-by: Kentaro Hayashi --- fluent-package/Rakefile | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/fluent-package/Rakefile b/fluent-package/Rakefile index 13d2b9daf..441607da6 100755 --- a/fluent-package/Rakefile +++ b/fluent-package/Rakefile @@ -702,19 +702,10 @@ class BuildTask ] if JEMALLOC_VERSION.split('.')[0].to_i >= 4 - if ENV["FLUENT_PACKAGE_STAGING_PATH"] and - (ENV["FLUENT_PACKAGE_STAGING_PATH"].end_with?("el8.aarch64") or - ENV["FLUENT_PACKAGE_STAGING_PATH"].end_with?("el7.aarch64")) - # NOTE: There is a case that PAGE_SIZE detection on - # CentOS 7 CentOS 8 with aarch64 AWS ARM instance. - # So, explicitly set PAGE_SIZE by with-lg-page 16 (2^16 = 65536) - configure_opts.concat(["--with-lg-page=16"]) - end - if ENV["FLUENT_PACKAGE_STAGING_PATH"] and - ENV["FLUENT_PACKAGE_STAGING_PATH"].end_with?("el8.ppc64le") - # NOTE: There is a case that PAGE_SIZE detection on - # CentOS 8 with ppc64le. - # So, explicitly set PAGE_SIZE by with-lg-page 16 (2^16 = 65536) + if ["aarch64", "ppc64le"].include?(Etc.uname[:machine]) + # NOTE: Improve compatibility with kernel-64K. + # Then, explicitly set PAGE_SIZE=16 by --with-lg-page 16 (2^16 = 65536) + # Forcing PAGE_SIZE=16 to avoid "Unsuported system page size" runtime error. configure_opts.concat(["--with-lg-page=16"]) end end From 248a9e78a77e2d024d8e5789652447635376122d Mon Sep 17 00:00:00 2001 From: Kentaro Hayashi Date: Fri, 7 Aug 2026 18:03:37 +0900 Subject: [PATCH 3/3] yum: drop needless libstdc++ dependency Signed-off-by: Kentaro Hayashi --- fluent-package/Rakefile | 1 + 1 file changed, 1 insertion(+) diff --git a/fluent-package/Rakefile b/fluent-package/Rakefile index 441607da6..47b061ed5 100755 --- a/fluent-package/Rakefile +++ b/fluent-package/Rakefile @@ -699,6 +699,7 @@ class BuildTask configure_opts = [ "--prefix=#{install_prefix}", + "--disable-cxx" ] if JEMALLOC_VERSION.split('.')[0].to_i >= 4