ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: dennisb55@hotmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:87154] [Ruby trunk Feature#14718] Use jemalloc by default?
Date: Fri, 18 May 2018 03:10:47 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-72144.20180518031045.033a43c4bdf8e620@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-14718.20180427161410@ruby-lang.org

Issue #14718 has been updated by bluz71 (Dennis B).


@mperham, @mame, @normalperson,

glibc version 2.10 (2009) malloc was changed to favour scalibility in preference to memory size as noted [here](https://udrepper.livejournal.com/20948.html). Basically Red Hat and Ulrich Drepper did this to favour large clients (big customers, government agencies) where RAM is plentiful and thread-contention was a real problem.

Prior to 2.10 it seems that `MAX_ARENA_MAX=1`.
After 2.10 for 32-bit systems it changed to `2 x core-count` and for 64-bit systems it changed to `8 x core-count`.

This change has since caused a lot of grief for customers in regards to memory usage and fragmentation as noted here:

- https://sourceware.org/bugzilla/show_bug.cgi?id=11261

- https://github.com/prestodb/presto/issues/8993

This has lead to many recommendations:

- https://devcenter.heroku.com/articles/tuning-glibc-memory-behavior

- https://www.ibm.com/developerworks/community/blogs/kevgrig/entry/linux_glibc_2_10_rhel_6_malloc_may_show_excessive_virtual_memory_usage?lang=en

- https://stackoverflow.com/questions/26041117/growing-resident-memory-usage-rss-of-java-process/35610063#35610063

Languages such as Golang and Rust ship their own memory allocators (tcmalloc and jemalloc based respectively). Browsers such as Chrome and Firefox also ship and use  their own allocators (tcmalloc/PartitionAlloc and jemalloc respectively). These technologies have their own reasons for doing this, not always related to memory fragmentation (though that is quite important).

Long-lived Ruby processes are a victim of this 2009 change.

----------------------------------------
Feature #14718: Use jemalloc by default?
https://bugs.ruby-lang.org/issues/14718#change-72144

* Author: mperham (Mike Perham)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
I know Sam opened #9113 4 years ago to suggest this but I'm revisiting the topic to see if there's any movement here for Ruby 2.6 or 2.7.  I supply a major piece of Ruby infrastructure (Sidekiq) and I keep hearing over and over how Ruby is terrible with memory, a huge memory hog with their Rails apps.  My users switch to jemalloc and a miracle occurs: their memory usage drops massively.  Some data points:

https://twitter.com/brandonhilkert/status/987400365627801601
https://twitter.com/d_jones/status/989866391787335680
https://github.com/mperham/sidekiq/issues/3824#issuecomment-383072469

Redis moved to jemalloc many years ago and it solved all of their memory issues too.  Their conclusion: the glibc allocator "sucks really really hard". http://oldblog.antirez.com/post/everything-about-redis-24.html

This is a real pain point for the entire Rails community and would improve Ruby's reputation immensely if we can solve this problem.



-- 
https://bugs.ruby-lang.org/

  parent reply	other threads:[~2018-05-18  3:11 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-14718.20180427161410@ruby-lang.org>
2018-04-27 16:14 ` [ruby-core:86725] [Ruby trunk Feature#14718] Use jemalloc by default? mperham
2018-04-27 18:12   ` [ruby-core:86731] " Eric Wong
2018-04-27 18:13     ` [ruby-core:86732] " Koichi Sasada
2018-04-27 16:30 ` [ruby-core:86726] " merch-redmine
2018-04-27 16:38 ` [ruby-core:86728] " mperham
2018-04-27 18:50 ` [ruby-core:86734] " shevegen
2018-04-27 19:28 ` [ruby-core:86735] " rr.rosas
2018-04-27 19:59 ` [ruby-core:86736] " rr.rosas
2018-04-27 21:59 ` [ruby-core:86738] " mperham
2018-04-28  4:36 ` [ruby-core:86742] " the.codefolio.guy
2018-04-28 19:52 ` [ruby-core:86752] " nobu
2018-04-28 20:33 ` [ruby-core:86753] " mperham
2018-04-29  8:21 ` [ruby-core:86760] " shyouhei
2018-04-30 15:57 ` [ruby-core:86777] " mperham
2018-05-01  1:46 ` [ruby-core:86786] " shyouhei
2018-05-02 17:31 ` [ruby-core:86843] " mperham
2018-05-02 21:00   ` [ruby-core:86844] " Eric Wong
2018-05-15  8:33     ` [ruby-core:87036] " Eric Wong
2018-05-08  2:27 ` [ruby-core:86936] " davidtgoldblatt
2018-05-08  3:34 ` [ruby-core:86938] " mame
2018-05-10  5:11 ` [ruby-core:86962] " dennisb55
2018-05-10  5:37 ` [ruby-core:86964] " dennisb55
2018-05-10  5:55 ` [ruby-core:86965] " merch-redmine
2018-05-10  6:26 ` [ruby-core:86966] " dennisb55
2018-05-10 17:20 ` [ruby-core:86971] " merch-redmine
2018-05-11  1:31 ` [ruby-core:86975] " shyouhei
2018-05-11  2:19   ` [ruby-core:86978] " Eric Wong
2018-05-11  3:01 ` [ruby-core:86979] " mame
2018-05-11  3:28 ` [ruby-core:86982] " dennisb55
2018-05-11  3:38 ` [ruby-core:86984] " dennisb55
2018-05-11  4:00 ` [ruby-core:86985] " dennisb55
2018-05-11  4:07 ` [ruby-core:86986] " dennisb55
2018-05-11 16:23 ` [ruby-core:86999] " mperham
2018-05-12  0:58 ` [ruby-core:87003] " dennisb55
2018-05-14  0:09 ` [ruby-core:87012] " shyouhei
2018-05-14  2:14 ` [ruby-core:87014] " dennisb55
2018-05-14  3:16 ` [ruby-core:87015] " shyouhei
2018-05-14  6:42 ` [ruby-core:87016] " dennisb55
2018-05-14  7:33 ` [ruby-core:87017] " sam.saffron
2018-05-14  7:53 ` [ruby-core:87020] " shyouhei
2018-05-14  8:30 ` [ruby-core:87023] " dennisb55
2018-05-14 15:58 ` [ruby-core:87027] " mperham
2018-05-14 16:31 ` [ruby-core:87028] " wyhaines
2018-05-15  3:49 ` [ruby-core:87031] " mame
2018-05-15  7:17 ` [ruby-core:87033] " sam.saffron
2018-05-15 23:16 ` [ruby-core:87048] " mperham
2018-05-16  5:11 ` [ruby-core:87060] " dennisb55
2018-05-16  5:14 ` [ruby-core:87061] " dennisb55
2018-05-16  5:29 ` [ruby-core:87064] " mperham
2018-05-16  5:54 ` [ruby-core:87065] " dennisb55
2018-05-16  9:09   ` [ruby-core:87071] " Eric Wong
2018-05-16 18:45 ` [ruby-core:87086] " mperham
2018-05-16 19:22 ` [ruby-core:87087] " merch-redmine
2018-05-16 20:12 ` [ruby-core:87088] " mperham
2018-05-16 23:54 ` [ruby-core:87090] " mame
2018-05-17 17:31 ` [ruby-core:87145] " mperham
2018-05-18  3:10 ` dennisb55 [this message]
2018-05-18  3:13 ` [ruby-core:87155] " dennisb55
2018-05-18  3:19 ` [ruby-core:87156] " dennisb55
2018-05-18  3:49 ` [ruby-core:87159] " mperham
2018-05-18  4:10 ` [ruby-core:87160] " dennisb55
2018-05-18  7:59   ` [ruby-core:87164] " Eric Wong
2018-05-19  2:55 ` [ruby-core:87186] " dennisb55
2018-05-22  1:12   ` [ruby-core:87216] " Vladimir Makarov
2018-05-23  2:57   ` [ruby-core:87230] " Eric Wong
2018-05-22 16:25 ` [ruby-core:87224] " mperham
2018-05-22 20:22 ` [ruby-core:87225] " mperham
2018-05-23  0:38 ` [ruby-core:87229] " dennisb55
2018-05-23  4:22 ` [ruby-core:87231] " mperham
2018-05-29 20:34 ` [ruby-core:87299] " edchick
2018-06-23 18:39 ` [ruby-core:87616] " v.ondruch
2018-06-25  0:36 ` [ruby-core:87626] " nobu
2018-07-26 18:51 ` [ruby-core:88127] " carlos
2018-07-29  1:18 ` [ruby-core:88156] " andregsakata
2018-07-29  4:27 ` [ruby-core:88161] " dennisb55
2018-07-29  4:31 ` [ruby-core:88162] " dennisb55
2018-07-29  7:45 ` [ruby-core:88163] " fweimer
2018-07-30 10:16   ` [ruby-core:88192] " Eric Wong
2018-08-01  1:00     ` [ruby-core:88244] " Eric Wong
2018-07-29  8:38 ` [ruby-core:88164] " fweimer
2018-07-29 15:16 ` [ruby-core:88165] " andregsakata
2018-07-29 16:34 ` [ruby-core:88166] " andregsakata
2018-07-29 17:39 ` [ruby-core:88168] " andregsakata
2018-07-30 12:16 ` [ruby-core:88195] " fweimer
2018-07-30 13:16 ` [ruby-core:88196] " andregsakata
2018-07-30 13:20 ` [ruby-core:88197] " fweimer
2018-07-30 16:16 ` [ruby-core:88208] " andregsakata
2018-07-30 20:27 ` [ruby-core:88216] " davidtgoldblatt
2018-07-30 22:46 ` [ruby-core:88220] " andregsakata
2018-07-31  0:31 ` [ruby-core:88223] " dennisb55
2018-08-01  0:14 ` [ruby-core:88238] " sam.saffron
2018-08-01  9:55   ` [ruby-core:88256] " Eric Wong
2018-08-01  0:55 ` [ruby-core:88243] " mperham
2018-08-01  2:12 ` [ruby-core:88245] " sam.saffron
2018-08-01  3:41 ` [ruby-core:88247] " dennisb55
2018-08-02  0:04 ` [ruby-core:88266] " sam.saffron
2019-02-07  3:53 ` [ruby-core:91445] " mame
2019-02-09  4:42 ` [ruby-core:91499] " dennisb55
2019-03-14 16:52 ` [ruby-core:91832] " msiegel
2019-03-14 20:02 ` [ruby-core:91836] " fredngo
2019-03-14 20:35 ` [ruby-core:91838] " sam.saffron
2019-03-15  6:50 ` [ruby-core:91843] " dennisb55

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-72144.20180518031045.033a43c4bdf8e620@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).