ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:86978] Re: [Ruby trunk Feature#14718] Use jemalloc by default?
Date: Fri, 11 May 2018 02:19:16 +0000	[thread overview]
Message-ID: <20180511021916.GA25853@dcvr> (raw)
In-Reply-To: <redmine.journal-71940.20180511013103.d4ebba095899f7cb@ruby-lang.org>

shyouhei@ruby-lang.org wrote:
> So, I think it's clear people are interested in replacing _glibc_ malloc, not everything that exist in the whole universe.
> 
> Let's discuss how we achieve that.  There can be several ways:
> 
> - Just enable `--with-jemalloc` default on, only for Linux.
>     - pro: This is the easiest to implement.
>     - pro: Arguably works well. Already field proven.
>     - con: Mandates runtime dependency for libjemalloc on those systems.

How about only link against it by default if detected.  It will
be like our optional dependency on GMP.  We will depend on
distros to enable/disable the dependency on it.

I'm not 100% sure jemalloc is the best solution today, nor will
be in the future.  With some of my projects, glibc malloc is
often slightly smaller and faster.  But I realize typical Ruby
code is not written with low memory usage in mind :<

jemalloc itself is a LOT of code for a malloc implementation,
so the icache footprint is non-trivial and that impacts
startup time (but that is currently overshadowed by Rubygems).

> - Detect glibc on startup and try linking jemalloc then.
>     - pro: Even works on systems without jemalloc.
>     - con: Sacrifices process bootup time, which is a bad thing.
>     - con: Tricky to implement, prone to bug.

I'm not sure how that would work since malloc seems to get
called before main() by the linker.

Perhaps we can try mallopt(M_ARENA_MAX, 2) for glibc by
default; along with auto-enabling jemalloc by iff installed.

> - Bundle jemalloc and link it statically.

NAK.  The cons your list are huge and makes life difficult for
distros and code auditing.

>     - pro: No runtime hell.
>     - con: Bloats source distribution.  Costs non-glibc users.
>     - con: Also costs the core devs because they have to sync the bundled jemalloc with the upstream.

  reply	other threads:[~2018-05-11  2:19 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   ` Eric Wong [this message]
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 ` [ruby-core:87154] " dennisb55
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=20180511021916.GA25853@dcvr \
    --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).