3

I have Ruby 2.1.5 installed on my server and need to configure GC tuning variables for the best/optimum Ruby performance.

Following is the hardware/software information information:

  • Memory - 7697604 KB (8GB)
  • CPU - Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz (2 Cores)
  • Ruby - 2.1.5
  • Rails - 3.2.18
  • Passenger - 4.0.27

Based on this link (http://tmm1.net/ruby21-rgengc/), i found around ~ 476K long lived objects (using GC.stat(:heap_live_slot)), and so i allocated

RUBY_GC_HEAP_INIT_SLOTS=500000

But what about the rest of the variables (mentioned below). What should be appropriate values for these variables ? What more (and how) should i analyze in my environment / server to find appropriate values for these variables ?

RUBY_GC_HEAP_FREE_SLOTS=?
RUBY_GC_HEAP_GROWTH_FACTOR=?
RUBY_GC_HEAP_GROWTH_MAX_SLOTS=?
RUBY_GC_MALLOC_LIMIT=?
RUBY_GC_MALLOC_LIMIT_MAX=?
RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR=?
RUBY_GC_OLDMALLOC_LIMIT=?
RUBY_GC_OLDMALLOC_LIMIT_MAX=?
RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR=?
RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=? 

If any other information is required, let me know !

Ramandeep Singh
  • 5,063
  • 3
  • 28
  • 34

1 Answers1

2

How do I assign those values?

Through env variables e.g.:

RAILS_ENV=production RUBY_GC_MALLOC_LIMIT=90000000 bundle exec thin start
export RUBY_GC_MALLOC_LIMIT=90000000
...

(If I'm misunderstanding the question and you actually mean "What could I assign those values?" Have a loook here and here.)

wpp
  • 7,093
  • 4
  • 33
  • 65
  • By "How do" i meant, what should I analyze in my environment / server to find a suitable value for these variables. By the way, i'll make the modification in my question. And thanx for the links. Will have a look. – Ramandeep Singh Feb 04 '15 at 15:19