Collection of My Favorite Ruby and Rails Performance and Memory Articles

June 30, 2015

This is a collection of my favorite articles on Ruby and Rails performance/memory issues. I’ll be updating it from time to time.

Benchmarking / Performance

http://www.schneems.com/2014/10/31/benchmarking-rack-middleware.html

http://www.sitepoint.com/rubygems-slow/

ActiveRecord

http://aokolish.me/blog/2015/05/26/how-to-simplify-active-record-scopes-that-reference-other-tables/

Memory

http://www.sitepoint.com/ruby-uses-memory/ – how Ruby uses memory

https://blog.engineyard.com/2009/thats-not-a-memory-leak-its-bloat/ – bloat

http://www.schneems.com/2014/11/07/i-ram-what-i-ram.html – 36% smaller Rails memory footprint through Benchmarking

Heap dumps for debugging memory leaks

http://gavinmiller.io/2015/debugging-memory-leaks-on-heroku/

http://blog.skylight.io/hunting-for-leaks-in-ruby/

http://samsaffron.com/archive/2015/03/31/debugging-memory-leaks-in-ruby

How to get process id of Rails running locally

ps -aef | grep rails

bruce 4679 4433 1 12:10 pts/17 00:01:17 /home/bruce/.rvm/rubies/ruby-2.2.1/bin/ruby bin/rails s -p 3001

bruce 5030 3378 0 12:21 pts/0 00:00:11 /home/bruce/.rvm/rubies/ruby-2.2.1/bin/ruby bin/rails s

http://www.scimedsolutions.com/articles/36-rbtrace-is-awesome

bundle exec rbtrace -p 11697 -u 300 -e 'Thread.new{require "objspace"; ObjectSpace.trace_object_allocations_start; GC.start(); ObjectSpace.dump_all(output: File.open("heap.json", "w"))}.join'

Profile picture

Written by Bruce Park who lives and works in the USA building useful things. He is sometimes around on Twitter.