YJIT Compiler for Ruby
Tuning Ruby's Global Method Cache - Shopify

Tuning Ruby's Global Method Cache - Shopify

1/21/2015

What this post added

This post details the identification and resolution of a performance bottleneck in Ruby's MRI implementation related to the global method cache. The author used `perf` and `ftrace` user probes to analyze the `st_lookup` function and discovered that the default 2048-entry global method cache was insufficient for Shopify's large application. A new environment variable, `RUBY_GLOBAL_METHOD_CACHE_SIZE`, was introduced upstream to allow dynamic configuration of the cache size, and testing showed that increasing the cache size to around 64K-128K resulted in a ~3% cycle savings.

Read the original post ↗