Project

General

Profile

Actions

Feature #22466

open

Allow disabling the shape redblack cache via RUBY_SHAPE_REDBLACK_CACHE=disable

Feature #22466: Allow disabling the shape redblack cache via RUBY_SHAPE_REDBLACK_CACHE=disable

Added by jeremyevans0 (Jeremy Evans) about 8 hours ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:127219]

Description

The shape redblack cache mmaps 384MB of memory at startup. There is
currently no way to configure the amount of memory used. The code
already handles an mmap failure cleanly. I would like a way to skip
the mmap attempt, and the simplest way I can think of is an
environment variable.

The reason behind the current behavior (I think) is that ruby
currently assumes that the mmap is basically free, since the memory
is not actually allocated in most cases. However, when operating
system strict memory overcommit is used, this 384MB mmap allocation
can result in the serious problems later with the operating system
killing the process if it is low on memory. This provides a way to
accept a performance hit and avoid the memory allocation.

We are currently working around this issue in production by decreasing
the amount of memory available to the process at startup to 256MB
(causing the mmap allocation to fail), and then increasing it after
startup using Process.setrlimit. However, that results in a lot of
additional complexity that I would prefer to avoid.

If it is preferable to specify the cache size via an environment
variable, instead of just the ability to disable the cache, I can work
on that approach instead.

I submitted a pull request to implement this: https://github.com/ruby/ruby/pull/19499

No data to display

Actions

Also available in: PDF Atom