Your SlideShare is downloading. ×
Ruby Performance. Part 1 (Garbage Collection)
Ruby Performance. Part 1 (Garbage Collection)
Ruby Performance. Part 1 (Garbage Collection)
Ruby Performance. Part 1 (Garbage Collection)
Ruby Performance. Part 1 (Garbage Collection)
Ruby Performance. Part 1 (Garbage Collection)
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Ruby Performance. Part 1 (Garbage Collection)

1,238

Published on

Slides from meetup.com/madruby on tweaking Ruby GC settings. by Gleb Mazovetskiy (2010)

Slides from meetup.com/madruby on tweaking Ruby GC settings. by Gleb Mazovetskiy (2010)

1 Comment
0 Likes
Statistics
Notes
  • Be the first to like this

No Downloads
Views
Total Views
1,238
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
1
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Ruby Performance scaling your Ruby web app Part 1: Garbage collection
  • 2. MRI/REE Facts • Mark & sweep GC • freelists • very expensive • All refs are on the heap • All code is on the heap
  • 3. GC Settings RUBY_HEAP_MIN_SLOTS 10k RUBY_HEAP_SLOTS_GROWTH_FACTOR 1.8 Defaults startup + 20k + 10k + 18k ... 10k 10k + 10k 10k + 10k + 18k 10k + 10k + 18k + 32.4k ... RUBY_HEAP_SLOTS_INCREMENT 10k 10 000 20 000 38 000 70 400 128 720
  • 4. A better strategy • Stabilize on 1-2 heaps RUBY_HEAP_MIN_SLOTS (480 000) • Linear increment to keep it tight RUBY_HEAP_SLOTS_GROWTH_FACTOR 1 RUBY_HEAP_SLOTS_INCREMENT (20 000)
  • 5. Some tools memprof, gdb, scrap [68.63 MB] GET /stats/scrap Number of objects : 815266 (627150 AST nodes, 76.93%) Heap slot size : 20 GC cycles so far : 352 Number of heaps : 7 Total size of objects: 15923.16 KB Total size of heaps : 18036.55 KB (2113.39 KB = 11.72% unused) Leading free slots : 18545 (362.21 KB = 2.01%) Trailing free slots : 0 (0.00 KB = 0.00%) Number of contiguous groups of 16 slots: 2685 (4.65%) Number of terminal objects: 4697 (0.51%)
  • 6. Thanks Gleb Mazovetskiy. github.com/glebm

×