Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Like this? Share it with your network

Share

Ruby Performance. Part 1 (Garbage Collection)

on

  • 1,496 views

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)

Statistics

Views

Total Views
1,496
Views on SlideShare
1,496
Embed Views
0

Actions

Likes
0
Downloads
2
Comments
1

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

CC Attribution License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Ruby Performance. Part 1 (Garbage Collection) Presentation Transcript

  • 1. Ruby Performance
    scaling your Ruby web app
    Part 1: Garbage collection
  • 2. MRI/REE Facts
    • Mark & sweep GC
    • 3. freelists
    • 4. very expensive
    • 5. All refs are on the heap
    • 6. All code is on the heap
  • GC Settings
    Defaults
    10k
    RUBY_HEAP_MIN_SLOTS
    1.8
    RUBY_HEAP_SLOTS_GROWTH_FACTOR
    10k
    RUBY_HEAP_SLOTS_INCREMENT
    startup
    + 20k
    + 10k
    + 18k
    ...
    10k
    10k + 10k
    10k + 10k + 18k
    10k + 10k + 18k + 32.4k
    ...
    10 000
    20 000
    38 000
    70 400
    128 720
  • 7. A better strategy
    • Stabilize on 1-2 heaps RUBY_HEAP_MIN_SLOTS (480 000)
    • 8. Linear increment to keep it tightRUBY_HEAP_SLOTS_GROWTH_FACTOR 1 RUBY_HEAP_SLOTS_INCREMENT (20 000)
  • 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%)
  • 9. Thanks
    Gleb Mazovetskiy. github.com/glebm