Faster Apps, Less Memory Thrash: Get Your Memory Config Exactly Right, by Noah Gibbs

Abstract: (600 chars or less)

The Ruby memory system can be tricky. Configuring it isn't easy. I'll show you a new simple tool to optimize your Ruby binary's memory settings.
You'll learn about the CRuby memory resources and how you check them. Let's optimize your memory usage to keep memory small and keep garbage collection fast.

Details: (Outlines, Outcomes, Intended Audience)

This talk covers the CRuby memory system: slots, allocations, garbage collection, heap. It'll cover GC.stat, GC profiling mode and how to measure overhead and fragmentation. I introduce a new tool to use a GC.stat dump from your application to configure its memory environment variables for later runs.

The planned topics:

  • Values, Slots, Heap and allocations - how different sizes of Ruby object are allocated
  • GC.stat - what's in it
  • Memory environment variables - what they are, what they do
  • Slots Don't Move - allocations, slot fragmentation and the difficulty with freeing pages
  • GC.Profile to measure garbage collection time/overhead
  • Turning on extra GC profile settings by compiling a custom Ruby
  • Malloc vs jemalloc vs tcmalloc
  • rlimit - setting a cap on memory and how it works out

This will be an intermediate/advanced talk. Intermediate developers will get simple concrete recommendations, while advanced developers especially will get more background on CRuby's memory system.

Pitch: (what makes you qualified to speak on this topic)

I've written several CRuby memory profiling posts for our company blog (http://engineering.appfolio.com) and the talk expands on those. I do a lot of measuring Ruby, then writing and speaking about it.

I'm a long-time C programmer (15+ years) turned Ruby programmer (10+ years) and SRE/DevOps (3+ years). I've spent lots of quality time with the Ruby source code, including memory and how it's profiled. I also do a lot of Ruby benchmarking in my job.

Edit proposal

Submissions

RubyKaigi 2018 - Accepted [Edit]

Add submission