SlideShare a Scribd company logo
1 of 48
GC
NO effort CLEAN memory
GC
NO effort CLEAN memory
        SOME
Who am I?

       Alex Naumchuk

Software Architect at
     Consulter at Brightgrove


   alex.naumchuk@gmail.com
What IS GC?
What IS GC?



Developers
80k req/min     10k db queries/sec      125 prod servers




              avg response time: 25ms
Automatic collector reclaiming garbage


               C, C++
Automatic collector reclaiming garbage


               C, C++




           Ruby, Java, .NET
Automatic collector reclaiming garbage


               C, C++          ALLY
                          MA NU
                 D o it




           Ruby, Java, .NET
Automatic collector reclaiming garbage


               C, C++          ALLY
                          MA NU
                 D o it




           Ruby, Java, .NET          about it
                          ’t C ARE
                   Don
Should you care about memory?
Should you care about memory?
           YES!
Should you care about memory?
             YES!
       at least know how it works
REE/MRI Memory organization
Heaps

        slot slot slot slot slot

        slot slot slot slot slot

        slot slot slot slot slot
Slot RVALUE
typedef struct RVALUE {
    union {
  struct {
      unsigned long flags;   /* always 0 for freed obj */
      struct RVALUE *next;
  } free;
  struct RBasic basic;
  struct RObject object;
  struct RClass klass;
  struct RFloat flonum;
  struct RString string;
  struct RArray array;
  struct RRegexp regexp;
  struct RHash   hash;
  struct RData   data;
  struct RStruct rstruct;
  struct RBignum bignum;
  struct RFile   file;
  struct RNode   node;
  struct RMatch match;
  struct RVarmap varmap;
  struct SCOPE   scope;
    } as;
} RVALUE;
REE GC Options
Default Settings

RUBY_HEAP_SLOTS                  10000
Default Settings

RUBY_HEAP_SLOTS                  10000

RUBY_HEAP_SLOTS_INCREMENT        10000
Default Settings

RUBY_HEAP_SLOTS                  10000

RUBY_HEAP_SLOTS_INCREMENT        10000

RUBY_HEAP_SLOTS_GROWTH_FACTOR      1.8
Default Settings

RUBY_HEAP_SLOTS                    10000

RUBY_HEAP_SLOTS_INCREMENT         10000

RUBY_HEAP_SLOTS_GROWTH_FACTOR        1.8

RUBY_GC_MALLOC_LIMIT             8000000
Default Settings

RUBY_HEAP_SLOTS                    10000

RUBY_HEAP_SLOTS_INCREMENT         10000

RUBY_HEAP_SLOTS_GROWTH_FACTOR        1.8

RUBY_GC_MALLOC_LIMIT             8000000

RUBY_HEAP_FREE_MIN                  4096
Ideeli Settings
                                   MM       FE

RUBY_HEAP_SLOTS                 6000000   2400000

RUBY_HEAP_SLOTS_INCREMENT        100000    100000

RUBY_HEAP_SLOTS_GROWTH_FACTOR      1         1

RUBY_GC_MALLOC_LIMIT            100000000 40000000

RUBY_HEAP_FREE_MIN              3500000    100000
When GC runs

      malloc limit exceeded

    min free slots < free slots

not enough slots to allocate value
Mark Phase
GC Flow

  Mark


 Sweep


 Finalize
Statistics
                 >>ObjectSpace.statistics

Number of objects : 1631452 (1291302 AST nodes, 79.15%)
Heap slot size        : 40
GC cycles so far      : 32
Number of heaps : 9
Total size of objects : 63728.59 KB
Total size of heaps : 119579.81 KB (55851.22 KB = 46.71% unused)
Leading free slots : 1154340 (45091.41 KB = 37.71%)
Trailing free slots    : 4 (0.16 KB = 0.00%)
Number of contiguous groups of 16 slots: 76771 (40.13%)
Number of terminal objects: 8973 (0.29%)
Other Stats
GC.enable_stats
GC.disable_stats
GC.collections
GC.time
GC.growth
GC.clear_stats
GC.dump
GC.allocated_size
GC.num_allocations
ObjectSpace.live_objects
ObjectSpace.allocated_objects
Let’s Play
 Let’s play
Code


GC.enable_stats
require ‘config/environment’
GC.time
GC.num_allocations
GC.collections
Default options


GC.enable_stats
require ‘config/environment’
GC.time                     ~2 Seconds
GC.num_allocations          5_635_070
GC.collections              31
ObjectSpace.statistics



Number of objects : 1643029 (1265158 AST nodes, 77.00%)
Heap slot size        : 40
GC cycles so far      : 31
Number of heaps : 9
Total size of objects : 64180.82 KB
Total size of heaps : 119579.42 KB (55398.60 KB = 46.33% unused)
Leading free slots : 1093423 (42711.84 KB = 35.72%)
Trailing free slots    : 0 (0.00 KB = 0.00%)
Number of contiguous groups of 16 slots: 73754 (38.55%)
Number of terminal objects: 7274 (0.24%)
Default options


• Too many GC cycles
• Many heaps
• Bad heap utilization
New options
RUBY_HEAP_MIN_SLOTS = 1_800_000
RUBY_GC_MALLOC_LIMIT = 50_000_000


  GC.time              ~1 Second
  GC.num_allocations   5_634_856
  GC.collections       6
New options
    RUBY_HEAP_MIN_SLOTS = 1_800_000
    RUBY_GC_MALLOC_LIMIT = 50_000_000
Number of objects : 1682325 (1272351 AST nodes, 75.63%)
Heap slot size        : 40
GC cycles so far      :6
Number of heaps : 1
Total size of objects : 65715.82 KB
Total size of heaps : 70312.51 KB (4596.69 KB = 6.54% unused)
Leading free slots : 39246 (1533.05 KB = 2.18%)
Trailing free slots    : 0 (0.00 KB = 0.00%)
Number of contiguous groups of 16 slots: 4305 (3.83%)
Number of terminal objects: 7435 (0.41%)
Can we do it even better?
Can we do it even better?
        YES!
Enhanced options
RUBY_HEAP_MIN_SLOTS = 2_100_000
RUBY_GC_MALLOC_LIMIT = 100_000_000


   GC.time              ~0.8 Second
   GC.num_allocations   5_634_892
   GC.collections       3
Enhanced options
   RUBY_HEAP_MIN_SLOTS = 2_100_000
   RUBY_GC_MALLOC_LIMIT = 100_000_000
Number of objects : 1816515 (1297270 AST nodes, 71.42%)
Heap slot size        : 40
GC cycles so far      :3
Number of heaps : 1
Total size of objects : 70957.62 KB
Total size of heaps : 82031.26 KB (11073.64 KB = 13.50% unused)
Leading free slots : 0 (0.00 KB = 0.00%)
Trailing free slots    : 0 (0.00 KB = 0.00%)
Number of contiguous groups of 16 slots: 5807 (4.42%)
Number of terminal objects: 7969 (0.38%)
What about memory?

 Before 325.9M
 After 347.2M

         21.3M
Garbage Recon
Garbage Recon
                                    AVG GC   AVG Object     AVG Req
              Action
                                    Rounds   Allocations   between GC


         /cart_items/index           0.61      330651          2


         /cart_items/ID/             1.21     651679           1


           /cart_items               0.93     498881           1


/store/confirm_reservation_address    0.15      76084           6


    /store/confirm_reservation        1.37     724095           1
In between request GC

      User Request



       Response



          GC
It’s a trap
The Code
class Test
  attr_accessor :i_val
  def initialize
    @i_val = []
    300_000.times do |i|
      @i_val << "ruby-#{i}" * 10
    end
  end

  def say_hello
    "hello"
  end
end
The Test

test = Test.new
GC.start
t.i_val = nil
t.say_hello
GC.start
t = []
GC.start
Results


test = Test.new # 1504032
t.i_val = nil   # 3922
t = []          # 3916
Conclusion

• be careful with the big sets of data
• don’t store big amount of data in object with long life time
• even if current request wont spend much time in GC the
    next request would do it
•   the more objects - the longer is mark phase
•   symbols are not collected but increase mark phase time
Questions?

More Related Content

What's hot

Gnocchi v4 - past and present
Gnocchi v4 - past and presentGnocchi v4 - past and present
Gnocchi v4 - past and presentGordon Chung
 
Nodejs性能分析优化和分布式设计探讨
Nodejs性能分析优化和分布式设计探讨Nodejs性能分析优化和分布式设计探讨
Nodejs性能分析优化和分布式设计探讨flyinweb
 
GC in Ruby. RubyC, Kiev, 2014.
GC in Ruby. RubyC, Kiev, 2014.GC in Ruby. RubyC, Kiev, 2014.
GC in Ruby. RubyC, Kiev, 2014.Timothy Tsvetkov
 
Gnocchi v4 (preview)
Gnocchi v4 (preview)Gnocchi v4 (preview)
Gnocchi v4 (preview)Gordon Chung
 
JVM performance options. How it works
JVM performance options. How it worksJVM performance options. How it works
JVM performance options. How it worksDmitriy Dumanskiy
 
Tweaking performance on high-load projects
Tweaking performance on high-load projectsTweaking performance on high-load projects
Tweaking performance on high-load projectsDmitriy Dumanskiy
 
Путь мониторинга 2.0 всё стало другим / Всеволод Поляков (Grammarly)
Путь мониторинга 2.0 всё стало другим / Всеволод Поляков (Grammarly)Путь мониторинга 2.0 всё стало другим / Всеволод Поляков (Grammarly)
Путь мониторинга 2.0 всё стало другим / Всеволод Поляков (Grammarly)Ontico
 
"Metrics: Where and How", Vsevolod Polyakov
"Metrics: Where and How", Vsevolod Polyakov"Metrics: Where and How", Vsevolod Polyakov
"Metrics: Where and How", Vsevolod PolyakovYulia Shcherbachova
 
Developing High Performance Application with Aerospike & Go
Developing High Performance Application with Aerospike & GoDeveloping High Performance Application with Aerospike & Go
Developing High Performance Application with Aerospike & GoChris Stivers
 
Anatomy of an action
Anatomy of an actionAnatomy of an action
Anatomy of an actionGordon Chung
 
Gnocchi Profiling 2.1.x
Gnocchi Profiling 2.1.xGnocchi Profiling 2.1.x
Gnocchi Profiling 2.1.xGordon Chung
 
Handling 20 billion requests a month
Handling 20 billion requests a monthHandling 20 billion requests a month
Handling 20 billion requests a monthDmitriy Dumanskiy
 
How to Stop Worrying and Start Caching in Java
How to Stop Worrying and Start Caching in JavaHow to Stop Worrying and Start Caching in Java
How to Stop Worrying and Start Caching in Javasrisatish ambati
 
Building a Fast, Resilient Time Series Store with Cassandra (Alex Petrov, Dat...
Building a Fast, Resilient Time Series Store with Cassandra (Alex Petrov, Dat...Building a Fast, Resilient Time Series Store with Cassandra (Alex Petrov, Dat...
Building a Fast, Resilient Time Series Store with Cassandra (Alex Petrov, Dat...DataStax
 
Druinsky_SIAMCSE15
Druinsky_SIAMCSE15Druinsky_SIAMCSE15
Druinsky_SIAMCSE15Karen Pao
 
Declarative Infrastructure Tools
Declarative Infrastructure Tools Declarative Infrastructure Tools
Declarative Infrastructure Tools Yulia Shcherbachova
 
Sessionization with Spark streaming
Sessionization with Spark streamingSessionization with Spark streaming
Sessionization with Spark streamingRamūnas Urbonas
 
Cassandra is great but how do I test my application?
Cassandra is great but how do I test my application?Cassandra is great but how do I test my application?
Cassandra is great but how do I test my application?Christopher Batey
 

What's hot (20)

Gnocchi v4 - past and present
Gnocchi v4 - past and presentGnocchi v4 - past and present
Gnocchi v4 - past and present
 
Nodejs性能分析优化和分布式设计探讨
Nodejs性能分析优化和分布式设计探讨Nodejs性能分析优化和分布式设计探讨
Nodejs性能分析优化和分布式设计探讨
 
GC in Ruby. RubyC, Kiev, 2014.
GC in Ruby. RubyC, Kiev, 2014.GC in Ruby. RubyC, Kiev, 2014.
GC in Ruby. RubyC, Kiev, 2014.
 
Gnocchi v4 (preview)
Gnocchi v4 (preview)Gnocchi v4 (preview)
Gnocchi v4 (preview)
 
JVM performance options. How it works
JVM performance options. How it worksJVM performance options. How it works
JVM performance options. How it works
 
Tweaking performance on high-load projects
Tweaking performance on high-load projectsTweaking performance on high-load projects
Tweaking performance on high-load projects
 
Путь мониторинга 2.0 всё стало другим / Всеволод Поляков (Grammarly)
Путь мониторинга 2.0 всё стало другим / Всеволод Поляков (Grammarly)Путь мониторинга 2.0 всё стало другим / Всеволод Поляков (Grammarly)
Путь мониторинга 2.0 всё стало другим / Всеволод Поляков (Grammarly)
 
"Metrics: Where and How", Vsevolod Polyakov
"Metrics: Where and How", Vsevolod Polyakov"Metrics: Where and How", Vsevolod Polyakov
"Metrics: Where and How", Vsevolod Polyakov
 
Developing High Performance Application with Aerospike & Go
Developing High Performance Application with Aerospike & GoDeveloping High Performance Application with Aerospike & Go
Developing High Performance Application with Aerospike & Go
 
Anatomy of an action
Anatomy of an actionAnatomy of an action
Anatomy of an action
 
Gnocchi v3
Gnocchi v3Gnocchi v3
Gnocchi v3
 
Gnocchi Profiling 2.1.x
Gnocchi Profiling 2.1.xGnocchi Profiling 2.1.x
Gnocchi Profiling 2.1.x
 
Handling 20 billion requests a month
Handling 20 billion requests a monthHandling 20 billion requests a month
Handling 20 billion requests a month
 
How to Stop Worrying and Start Caching in Java
How to Stop Worrying and Start Caching in JavaHow to Stop Worrying and Start Caching in Java
How to Stop Worrying and Start Caching in Java
 
Building a Fast, Resilient Time Series Store with Cassandra (Alex Petrov, Dat...
Building a Fast, Resilient Time Series Store with Cassandra (Alex Petrov, Dat...Building a Fast, Resilient Time Series Store with Cassandra (Alex Petrov, Dat...
Building a Fast, Resilient Time Series Store with Cassandra (Alex Petrov, Dat...
 
Druinsky_SIAMCSE15
Druinsky_SIAMCSE15Druinsky_SIAMCSE15
Druinsky_SIAMCSE15
 
Openstack 簡介
Openstack 簡介Openstack 簡介
Openstack 簡介
 
Declarative Infrastructure Tools
Declarative Infrastructure Tools Declarative Infrastructure Tools
Declarative Infrastructure Tools
 
Sessionization with Spark streaming
Sessionization with Spark streamingSessionization with Spark streaming
Sessionization with Spark streaming
 
Cassandra is great but how do I test my application?
Cassandra is great but how do I test my application?Cassandra is great but how do I test my application?
Cassandra is great but how do I test my application?
 

Viewers also liked

MarkLittle_EnterpriseMiddlewareForThe21stCentury
MarkLittle_EnterpriseMiddlewareForThe21stCenturyMarkLittle_EnterpriseMiddlewareForThe21stCentury
MarkLittle_EnterpriseMiddlewareForThe21stCenturyKostas Mavridis
 
Enlaces interesantes de aprendizaje cooperartivo y ABP
Enlaces interesantes de aprendizaje cooperartivo y ABPEnlaces interesantes de aprendizaje cooperartivo y ABP
Enlaces interesantes de aprendizaje cooperartivo y ABPJuan Sánchez Martos
 
SiddharthAnand_NetflixsCloudDataArchitecture
SiddharthAnand_NetflixsCloudDataArchitectureSiddharthAnand_NetflixsCloudDataArchitecture
SiddharthAnand_NetflixsCloudDataArchitectureKostas Mavridis
 
fuser interface-development-using-jquery
fuser interface-development-using-jqueryfuser interface-development-using-jquery
fuser interface-development-using-jqueryKostas Mavridis
 
KevlinHenney_PuttingThereIntoArchitecture
KevlinHenney_PuttingThereIntoArchitectureKevlinHenney_PuttingThereIntoArchitecture
KevlinHenney_PuttingThereIntoArchitectureKostas Mavridis
 
EoinWoods_WhereDidMyArchitectureGoPreservingSoftwareArchitectureInItsImplemen...
EoinWoods_WhereDidMyArchitectureGoPreservingSoftwareArchitectureInItsImplemen...EoinWoods_WhereDidMyArchitectureGoPreservingSoftwareArchitectureInItsImplemen...
EoinWoods_WhereDidMyArchitectureGoPreservingSoftwareArchitectureInItsImplemen...Kostas Mavridis
 
GlennVanderburg_CraftAndSoftwareEngineering
GlennVanderburg_CraftAndSoftwareEngineeringGlennVanderburg_CraftAndSoftwareEngineering
GlennVanderburg_CraftAndSoftwareEngineeringKostas Mavridis
 
PatrickKua_TheBeginnersMind
PatrickKua_TheBeginnersMindPatrickKua_TheBeginnersMind
PatrickKua_TheBeginnersMindKostas Mavridis
 
RoyOsherove_TeamLeadershipInTheAgeOfAgile
RoyOsherove_TeamLeadershipInTheAgeOfAgileRoyOsherove_TeamLeadershipInTheAgeOfAgile
RoyOsherove_TeamLeadershipInTheAgeOfAgileKostas Mavridis
 
BernhardMerkle_StopTheArchitectureErosion
BernhardMerkle_StopTheArchitectureErosionBernhardMerkle_StopTheArchitectureErosion
BernhardMerkle_StopTheArchitectureErosionKostas Mavridis
 
NickKallen_DataArchitectureAtTwitterScale
NickKallen_DataArchitectureAtTwitterScaleNickKallen_DataArchitectureAtTwitterScale
NickKallen_DataArchitectureAtTwitterScaleKostas Mavridis
 
The Growing Awareness of Quality Early Childhood Education in Asia
The Growing Awareness of Quality Early Childhood Education in AsiaThe Growing Awareness of Quality Early Childhood Education in Asia
The Growing Awareness of Quality Early Childhood Education in AsiaSMTKU
 
Sofis tudung
Sofis tudungSofis tudung
Sofis tudungAzua Liza
 

Viewers also liked (18)

MarkLittle_EnterpriseMiddlewareForThe21stCentury
MarkLittle_EnterpriseMiddlewareForThe21stCenturyMarkLittle_EnterpriseMiddlewareForThe21stCentury
MarkLittle_EnterpriseMiddlewareForThe21stCentury
 
Enlaces interesantes de aprendizaje cooperartivo y ABP
Enlaces interesantes de aprendizaje cooperartivo y ABPEnlaces interesantes de aprendizaje cooperartivo y ABP
Enlaces interesantes de aprendizaje cooperartivo y ABP
 
SiddharthAnand_NetflixsCloudDataArchitecture
SiddharthAnand_NetflixsCloudDataArchitectureSiddharthAnand_NetflixsCloudDataArchitecture
SiddharthAnand_NetflixsCloudDataArchitecture
 
fuser interface-development-using-jquery
fuser interface-development-using-jqueryfuser interface-development-using-jquery
fuser interface-development-using-jquery
 
KevlinHenney_PuttingThereIntoArchitecture
KevlinHenney_PuttingThereIntoArchitectureKevlinHenney_PuttingThereIntoArchitecture
KevlinHenney_PuttingThereIntoArchitecture
 
EoinWoods_WhereDidMyArchitectureGoPreservingSoftwareArchitectureInItsImplemen...
EoinWoods_WhereDidMyArchitectureGoPreservingSoftwareArchitectureInItsImplemen...EoinWoods_WhereDidMyArchitectureGoPreservingSoftwareArchitectureInItsImplemen...
EoinWoods_WhereDidMyArchitectureGoPreservingSoftwareArchitectureInItsImplemen...
 
GlennVanderburg_CraftAndSoftwareEngineering
GlennVanderburg_CraftAndSoftwareEngineeringGlennVanderburg_CraftAndSoftwareEngineering
GlennVanderburg_CraftAndSoftwareEngineering
 
PatrickKua_TheBeginnersMind
PatrickKua_TheBeginnersMindPatrickKua_TheBeginnersMind
PatrickKua_TheBeginnersMind
 
RoyOsherove_TeamLeadershipInTheAgeOfAgile
RoyOsherove_TeamLeadershipInTheAgeOfAgileRoyOsherove_TeamLeadershipInTheAgeOfAgile
RoyOsherove_TeamLeadershipInTheAgeOfAgile
 
BernhardMerkle_StopTheArchitectureErosion
BernhardMerkle_StopTheArchitectureErosionBernhardMerkle_StopTheArchitectureErosion
BernhardMerkle_StopTheArchitectureErosion
 
NickKallen_DataArchitectureAtTwitterScale
NickKallen_DataArchitectureAtTwitterScaleNickKallen_DataArchitectureAtTwitterScale
NickKallen_DataArchitectureAtTwitterScale
 
The Growing Awareness of Quality Early Childhood Education in Asia
The Growing Awareness of Quality Early Childhood Education in AsiaThe Growing Awareness of Quality Early Childhood Education in Asia
The Growing Awareness of Quality Early Childhood Education in Asia
 
Keyword Research
Keyword ResearchKeyword Research
Keyword Research
 
Team work-powerpoint
Team work-powerpointTeam work-powerpoint
Team work-powerpoint
 
Fases ABP
Fases ABPFases ABP
Fases ABP
 
Prótesis valvulares
Prótesis valvularesPrótesis valvulares
Prótesis valvulares
 
percubaan
percubaanpercubaan
percubaan
 
Sofis tudung
Sofis tudungSofis tudung
Sofis tudung
 

Similar to Use Ruby GC in full..

Performance tuning jvm
Performance tuning jvmPerformance tuning jvm
Performance tuning jvmPrem Kuppumani
 
Ruby Performance. Part 1 (Garbage Collection)
Ruby Performance. Part 1 (Garbage Collection)Ruby Performance. Part 1 (Garbage Collection)
Ruby Performance. Part 1 (Garbage Collection)Gleb Mazovetskiy
 
Performance Optimization of Rails Applications
Performance Optimization of Rails ApplicationsPerformance Optimization of Rails Applications
Performance Optimization of Rails ApplicationsSerge Smetana
 
Taming Java Garbage Collector
Taming Java Garbage CollectorTaming Java Garbage Collector
Taming Java Garbage CollectorDaya Atapattu
 
Am I reading GC logs Correctly?
Am I reading GC logs Correctly?Am I reading GC logs Correctly?
Am I reading GC logs Correctly?Tier1 App
 
Практический опыт профайлинга и оптимизации производительности Ruby-приложений
Практический опыт профайлинга и оптимизации производительности Ruby-приложенийПрактический опыт профайлинга и оптимизации производительности Ruby-приложений
Практический опыт профайлинга и оптимизации производительности Ruby-приложенийOlga Lavrentieva
 
this-is-garbage-talk-2022.pptx
this-is-garbage-talk-2022.pptxthis-is-garbage-talk-2022.pptx
this-is-garbage-talk-2022.pptxTier1 app
 
JVM memory management & Diagnostics
JVM memory management & DiagnosticsJVM memory management & Diagnostics
JVM memory management & DiagnosticsDhaval Shah
 
SOLR Power FTW: short version
SOLR Power FTW: short versionSOLR Power FTW: short version
SOLR Power FTW: short versionAlex Pinkin
 
Alexander Dymo - RailsConf 2014 - Improve performance: Optimize Memory and Up...
Alexander Dymo - RailsConf 2014 - Improve performance: Optimize Memory and Up...Alexander Dymo - RailsConf 2014 - Improve performance: Optimize Memory and Up...
Alexander Dymo - RailsConf 2014 - Improve performance: Optimize Memory and Up...Alexander Dymo
 
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14Jayesh Thakrar
 
millions-gc-jax-2022.pptx
millions-gc-jax-2022.pptxmillions-gc-jax-2022.pptx
millions-gc-jax-2022.pptxTier1 app
 
The Ruby GC is your friend!
The Ruby GC is your friend!The Ruby GC is your friend!
The Ruby GC is your friend!sdwolf
 
High Performance Solr and JVM Tuning Strategies used for MapQuest’s Search Ah...
High Performance Solr and JVM Tuning Strategies used for MapQuest’s Search Ah...High Performance Solr and JVM Tuning Strategies used for MapQuest’s Search Ah...
High Performance Solr and JVM Tuning Strategies used for MapQuest’s Search Ah...Lucidworks
 
Java 9: The (G1) GC Awakens!
Java 9: The (G1) GC Awakens!Java 9: The (G1) GC Awakens!
Java 9: The (G1) GC Awakens!Monica Beckwith
 
JRuby 9000 - Taipei Ruby User's Group 2015
JRuby 9000 - Taipei Ruby User's Group 2015JRuby 9000 - Taipei Ruby User's Group 2015
JRuby 9000 - Taipei Ruby User's Group 2015Charles Nutter
 

Similar to Use Ruby GC in full.. (20)

Performance tuning jvm
Performance tuning jvmPerformance tuning jvm
Performance tuning jvm
 
Ruby Performance. Part 1 (Garbage Collection)
Ruby Performance. Part 1 (Garbage Collection)Ruby Performance. Part 1 (Garbage Collection)
Ruby Performance. Part 1 (Garbage Collection)
 
Performance Optimization of Rails Applications
Performance Optimization of Rails ApplicationsPerformance Optimization of Rails Applications
Performance Optimization of Rails Applications
 
Taming Java Garbage Collector
Taming Java Garbage CollectorTaming Java Garbage Collector
Taming Java Garbage Collector
 
Am I reading GC logs Correctly?
Am I reading GC logs Correctly?Am I reading GC logs Correctly?
Am I reading GC logs Correctly?
 
Практический опыт профайлинга и оптимизации производительности Ruby-приложений
Практический опыт профайлинга и оптимизации производительности Ruby-приложенийПрактический опыт профайлинга и оптимизации производительности Ruby-приложений
Практический опыт профайлинга и оптимизации производительности Ruby-приложений
 
this-is-garbage-talk-2022.pptx
this-is-garbage-talk-2022.pptxthis-is-garbage-talk-2022.pptx
this-is-garbage-talk-2022.pptx
 
JVM memory management & Diagnostics
JVM memory management & DiagnosticsJVM memory management & Diagnostics
JVM memory management & Diagnostics
 
There and Back Again
There and Back AgainThere and Back Again
There and Back Again
 
SOLR Power FTW: short version
SOLR Power FTW: short versionSOLR Power FTW: short version
SOLR Power FTW: short version
 
Alexander Dymo - RailsConf 2014 - Improve performance: Optimize Memory and Up...
Alexander Dymo - RailsConf 2014 - Improve performance: Optimize Memory and Up...Alexander Dymo - RailsConf 2014 - Improve performance: Optimize Memory and Up...
Alexander Dymo - RailsConf 2014 - Improve performance: Optimize Memory and Up...
 
Garbage Collection In Micorosoft
Garbage Collection In  MicorosoftGarbage Collection In  Micorosoft
Garbage Collection In Micorosoft
 
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
 
millions-gc-jax-2022.pptx
millions-gc-jax-2022.pptxmillions-gc-jax-2022.pptx
millions-gc-jax-2022.pptx
 
The Ruby GC is your friend!
The Ruby GC is your friend!The Ruby GC is your friend!
The Ruby GC is your friend!
 
A G1GC Saga-KCJUG.pptx
A G1GC Saga-KCJUG.pptxA G1GC Saga-KCJUG.pptx
A G1GC Saga-KCJUG.pptx
 
High Performance Solr and JVM Tuning Strategies used for MapQuest’s Search Ah...
High Performance Solr and JVM Tuning Strategies used for MapQuest’s Search Ah...High Performance Solr and JVM Tuning Strategies used for MapQuest’s Search Ah...
High Performance Solr and JVM Tuning Strategies used for MapQuest’s Search Ah...
 
Java 9: The (G1) GC Awakens!
Java 9: The (G1) GC Awakens!Java 9: The (G1) GC Awakens!
Java 9: The (G1) GC Awakens!
 
Run Node Run
Run Node RunRun Node Run
Run Node Run
 
JRuby 9000 - Taipei Ruby User's Group 2015
JRuby 9000 - Taipei Ruby User's Group 2015JRuby 9000 - Taipei Ruby User's Group 2015
JRuby 9000 - Taipei Ruby User's Group 2015
 

Recently uploaded

Call US '' 8377087607'' !! Call Girls In Model Town Metro (Delhi NCR)
Call US '' 8377087607'' !! Call Girls In Model Town Metro (Delhi NCR)Call US '' 8377087607'' !! Call Girls In Model Town Metro (Delhi NCR)
Call US '' 8377087607'' !! Call Girls In Model Town Metro (Delhi NCR)dollysharma2066
 
Gripping Adult Web Series You Can't Afford to Miss
Gripping Adult Web Series You Can't Afford to MissGripping Adult Web Series You Can't Afford to Miss
Gripping Adult Web Series You Can't Afford to Missget joys
 
Taken Pilot Episode Story pitch Document
Taken Pilot Episode Story pitch DocumentTaken Pilot Episode Story pitch Document
Taken Pilot Episode Story pitch Documentf4ssvxpz62
 
North Avenue Call Girls Services, Hire Now for Full Fun
North Avenue Call Girls Services, Hire Now for Full FunNorth Avenue Call Girls Services, Hire Now for Full Fun
North Avenue Call Girls Services, Hire Now for Full FunKomal Khan
 
5* Hotel Call Girls In Goa 7028418221 Call Girls In Calangute Beach Escort Se...
5* Hotel Call Girls In Goa 7028418221 Call Girls In Calangute Beach Escort Se...5* Hotel Call Girls In Goa 7028418221 Call Girls In Calangute Beach Escort Se...
5* Hotel Call Girls In Goa 7028418221 Call Girls In Calangute Beach Escort Se...Apsara Of India
 
Call Girls CG Road 7397865700 Independent Call Girls
Call Girls CG Road 7397865700  Independent Call GirlsCall Girls CG Road 7397865700  Independent Call Girls
Call Girls CG Road 7397865700 Independent Call Girlsssuser7cb4ff
 
Kolkata Call Girls Service +918240919228 - Kolkatanightgirls.com
Kolkata Call Girls Service +918240919228 - Kolkatanightgirls.comKolkata Call Girls Service +918240919228 - Kolkatanightgirls.com
Kolkata Call Girls Service +918240919228 - Kolkatanightgirls.comKolkata Call Girls
 
Fun Call Girls In Goa 7028418221 Call Girl Service In Panaji Escorts
Fun Call Girls In Goa 7028418221 Call Girl Service In Panaji EscortsFun Call Girls In Goa 7028418221 Call Girl Service In Panaji Escorts
Fun Call Girls In Goa 7028418221 Call Girl Service In Panaji EscortsApsara Of India
 
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...First NO1 World Amil baba in Faisalabad
 
Hifi Laxmi Nagar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ D...
Hifi Laxmi Nagar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ D...Hifi Laxmi Nagar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ D...
Hifi Laxmi Nagar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ D...srsj9000
 
Call Girls in Faridabad 9000000000 Faridabad Escorts Service
Call Girls in Faridabad 9000000000 Faridabad Escorts ServiceCall Girls in Faridabad 9000000000 Faridabad Escorts Service
Call Girls in Faridabad 9000000000 Faridabad Escorts ServiceTina Ji
 
1681275559_haunting-adeline and hunting.pdf
1681275559_haunting-adeline and hunting.pdf1681275559_haunting-adeline and hunting.pdf
1681275559_haunting-adeline and hunting.pdfTanjirokamado769606
 
ViP Call Girls In Udaipur 9602870969 Gulab Bagh Escorts SeRvIcE
ViP Call Girls In Udaipur 9602870969 Gulab Bagh Escorts SeRvIcEViP Call Girls In Udaipur 9602870969 Gulab Bagh Escorts SeRvIcE
ViP Call Girls In Udaipur 9602870969 Gulab Bagh Escorts SeRvIcEApsara Of India
 
Hi Class Call Girls In Goa 7028418221 Call Girls In Anjuna Beach Escort Services
Hi Class Call Girls In Goa 7028418221 Call Girls In Anjuna Beach Escort ServicesHi Class Call Girls In Goa 7028418221 Call Girls In Anjuna Beach Escort Services
Hi Class Call Girls In Goa 7028418221 Call Girls In Anjuna Beach Escort ServicesApsara Of India
 
NO1 WorldWide Amil baba in pakistan Amil Baba in Karachi Black Magic Islamaba...
NO1 WorldWide Amil baba in pakistan Amil Baba in Karachi Black Magic Islamaba...NO1 WorldWide Amil baba in pakistan Amil Baba in Karachi Black Magic Islamaba...
NO1 WorldWide Amil baba in pakistan Amil Baba in Karachi Black Magic Islamaba...Amil baba
 
Call Girls Somajiguda Sarani 7001305949 all area service COD available Any Time
Call Girls Somajiguda Sarani 7001305949 all area service COD available Any TimeCall Girls Somajiguda Sarani 7001305949 all area service COD available Any Time
Call Girls Somajiguda Sarani 7001305949 all area service COD available Any Timedelhimodelshub1
 
Call Girls SG Highway 7397865700 Ridhima Hire Me Full Night
Call Girls SG Highway 7397865700 Ridhima Hire Me Full NightCall Girls SG Highway 7397865700 Ridhima Hire Me Full Night
Call Girls SG Highway 7397865700 Ridhima Hire Me Full Nightssuser7cb4ff
 
The Fine Line Between Honest and Evil Comics by Salty Vixen
The Fine Line Between Honest and Evil Comics by Salty VixenThe Fine Line Between Honest and Evil Comics by Salty Vixen
The Fine Line Between Honest and Evil Comics by Salty VixenSalty Vixen Stories & More
 
Amil baba in Pakistan amil baba Karachi amil baba in pakistan amil baba in la...
Amil baba in Pakistan amil baba Karachi amil baba in pakistan amil baba in la...Amil baba in Pakistan amil baba Karachi amil baba in pakistan amil baba in la...
Amil baba in Pakistan amil baba Karachi amil baba in pakistan amil baba in la...Amil Baba Company
 
Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...
Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...
Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...Amil Baba Company
 

Recently uploaded (20)

Call US '' 8377087607'' !! Call Girls In Model Town Metro (Delhi NCR)
Call US '' 8377087607'' !! Call Girls In Model Town Metro (Delhi NCR)Call US '' 8377087607'' !! Call Girls In Model Town Metro (Delhi NCR)
Call US '' 8377087607'' !! Call Girls In Model Town Metro (Delhi NCR)
 
Gripping Adult Web Series You Can't Afford to Miss
Gripping Adult Web Series You Can't Afford to MissGripping Adult Web Series You Can't Afford to Miss
Gripping Adult Web Series You Can't Afford to Miss
 
Taken Pilot Episode Story pitch Document
Taken Pilot Episode Story pitch DocumentTaken Pilot Episode Story pitch Document
Taken Pilot Episode Story pitch Document
 
North Avenue Call Girls Services, Hire Now for Full Fun
North Avenue Call Girls Services, Hire Now for Full FunNorth Avenue Call Girls Services, Hire Now for Full Fun
North Avenue Call Girls Services, Hire Now for Full Fun
 
5* Hotel Call Girls In Goa 7028418221 Call Girls In Calangute Beach Escort Se...
5* Hotel Call Girls In Goa 7028418221 Call Girls In Calangute Beach Escort Se...5* Hotel Call Girls In Goa 7028418221 Call Girls In Calangute Beach Escort Se...
5* Hotel Call Girls In Goa 7028418221 Call Girls In Calangute Beach Escort Se...
 
Call Girls CG Road 7397865700 Independent Call Girls
Call Girls CG Road 7397865700  Independent Call GirlsCall Girls CG Road 7397865700  Independent Call Girls
Call Girls CG Road 7397865700 Independent Call Girls
 
Kolkata Call Girls Service +918240919228 - Kolkatanightgirls.com
Kolkata Call Girls Service +918240919228 - Kolkatanightgirls.comKolkata Call Girls Service +918240919228 - Kolkatanightgirls.com
Kolkata Call Girls Service +918240919228 - Kolkatanightgirls.com
 
Fun Call Girls In Goa 7028418221 Call Girl Service In Panaji Escorts
Fun Call Girls In Goa 7028418221 Call Girl Service In Panaji EscortsFun Call Girls In Goa 7028418221 Call Girl Service In Panaji Escorts
Fun Call Girls In Goa 7028418221 Call Girl Service In Panaji Escorts
 
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
 
Hifi Laxmi Nagar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ D...
Hifi Laxmi Nagar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ D...Hifi Laxmi Nagar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ D...
Hifi Laxmi Nagar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ D...
 
Call Girls in Faridabad 9000000000 Faridabad Escorts Service
Call Girls in Faridabad 9000000000 Faridabad Escorts ServiceCall Girls in Faridabad 9000000000 Faridabad Escorts Service
Call Girls in Faridabad 9000000000 Faridabad Escorts Service
 
1681275559_haunting-adeline and hunting.pdf
1681275559_haunting-adeline and hunting.pdf1681275559_haunting-adeline and hunting.pdf
1681275559_haunting-adeline and hunting.pdf
 
ViP Call Girls In Udaipur 9602870969 Gulab Bagh Escorts SeRvIcE
ViP Call Girls In Udaipur 9602870969 Gulab Bagh Escorts SeRvIcEViP Call Girls In Udaipur 9602870969 Gulab Bagh Escorts SeRvIcE
ViP Call Girls In Udaipur 9602870969 Gulab Bagh Escorts SeRvIcE
 
Hi Class Call Girls In Goa 7028418221 Call Girls In Anjuna Beach Escort Services
Hi Class Call Girls In Goa 7028418221 Call Girls In Anjuna Beach Escort ServicesHi Class Call Girls In Goa 7028418221 Call Girls In Anjuna Beach Escort Services
Hi Class Call Girls In Goa 7028418221 Call Girls In Anjuna Beach Escort Services
 
NO1 WorldWide Amil baba in pakistan Amil Baba in Karachi Black Magic Islamaba...
NO1 WorldWide Amil baba in pakistan Amil Baba in Karachi Black Magic Islamaba...NO1 WorldWide Amil baba in pakistan Amil Baba in Karachi Black Magic Islamaba...
NO1 WorldWide Amil baba in pakistan Amil Baba in Karachi Black Magic Islamaba...
 
Call Girls Somajiguda Sarani 7001305949 all area service COD available Any Time
Call Girls Somajiguda Sarani 7001305949 all area service COD available Any TimeCall Girls Somajiguda Sarani 7001305949 all area service COD available Any Time
Call Girls Somajiguda Sarani 7001305949 all area service COD available Any Time
 
Call Girls SG Highway 7397865700 Ridhima Hire Me Full Night
Call Girls SG Highway 7397865700 Ridhima Hire Me Full NightCall Girls SG Highway 7397865700 Ridhima Hire Me Full Night
Call Girls SG Highway 7397865700 Ridhima Hire Me Full Night
 
The Fine Line Between Honest and Evil Comics by Salty Vixen
The Fine Line Between Honest and Evil Comics by Salty VixenThe Fine Line Between Honest and Evil Comics by Salty Vixen
The Fine Line Between Honest and Evil Comics by Salty Vixen
 
Amil baba in Pakistan amil baba Karachi amil baba in pakistan amil baba in la...
Amil baba in Pakistan amil baba Karachi amil baba in pakistan amil baba in la...Amil baba in Pakistan amil baba Karachi amil baba in pakistan amil baba in la...
Amil baba in Pakistan amil baba Karachi amil baba in pakistan amil baba in la...
 
Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...
Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...
Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...
 

Use Ruby GC in full..

Editor's Notes

  1. \n\n
  2. \n\n
  3. \n
  4. we are dealing with gc every day, saw that brown piece in newrelic?\n
  5. Is that that brow bar at the bottom in newrelic?\n
  6. GC is automtic collector that reclaiming garbage or memory occupied by objects.\n\nIn some languages you manage memory manually: C, C++\n You have to free all allocations, you have to avoid memory leaks, you have deal with double free problems, dangling pointer bugs. And tons of other problems that give you permanent headache.\n\nBut we are cool dynamic devs and do not care about that.\n\n \n
  7. GC is automtic collector that reclaiming garbage or memory occupied by objects.\n\nIn some languages you manage memory manually: C, C++\n You have to free all allocations, you have to avoid memory leaks, you have deal with double free problems, dangling pointer bugs. And tons of other problems that give you permanent headache.\n\nBut we are cool dynamic devs and do not care about that.\n\n \n
  8. GC is automtic collector that reclaiming garbage or memory occupied by objects.\n\nIn some languages you manage memory manually: C, C++\n You have to free all allocations, you have to avoid memory leaks, you have deal with double free problems, dangling pointer bugs. And tons of other problems that give you permanent headache.\n\nBut we are cool dynamic devs and do not care about that.\n\n \n
  9. But should we care about it?\nAnswer is yes - we should\nWe are not managing memory manually but we should know how it work.\n\n
  10. But should we care about it?\nAnswer is yes - we should\nWe are not managing memory manually but we should know how it work.\n\n
  11. All ruby objects are stored in heaps. Each heap have number of slots within it.\n\n
  12. Each slot of a heap hold RVALUE structure.\nIt&amp;#x2019;s a union of all possible ruby data objects. Even source node tree is stored in heap.\nBut that structure is not representing actual data storage. Like object references i_val table that is reference to different RVALUE objects.\n\n
  13. \n
  14. H_SLOTS - Number of initial slots in heap\nH_SLOTS_INC - Number of additional heap slots\nGROWTH_FACTOR - Multiplier to increase heap slots size\nG_MALLOC_LIMIT - limit of allocations before GC, literally how many times malloc has been called\nFREE_MIN - NUMBER of \n
  15. H_SLOTS - Number of initial slots in heap\nH_SLOTS_INC - Number of additional heap slots\nGROWTH_FACTOR - Multiplier to increase heap slots size\nG_MALLOC_LIMIT - limit of allocations before GC, literally how many times malloc has been called\nFREE_MIN - NUMBER of \n
  16. H_SLOTS - Number of initial slots in heap\nH_SLOTS_INC - Number of additional heap slots\nGROWTH_FACTOR - Multiplier to increase heap slots size\nG_MALLOC_LIMIT - limit of allocations before GC, literally how many times malloc has been called\nFREE_MIN - NUMBER of \n
  17. H_SLOTS - Number of initial slots in heap\nH_SLOTS_INC - Number of additional heap slots\nGROWTH_FACTOR - Multiplier to increase heap slots size\nG_MALLOC_LIMIT - limit of allocations before GC, literally how many times malloc has been called\nFREE_MIN - NUMBER of \n
  18. H_SLOTS - Number of initial slots in heap\nH_SLOTS_INC - Number of additional heap slots\nGROWTH_FACTOR - Multiplier to increase heap slots size\nG_MALLOC_LIMIT - limit of allocations before GC, literally how many times malloc has been called\nFREE_MIN - NUMBER of \n
  19. The ideeli settings were chosen ob node purpose and average stat for that kind of node\n
  20. Every object creation checks available allocations\nGC can run at any moment\n
  21. At mark phase interpreter looks for a current variables references. It&amp;#x2019;s not ref based, it&amp;#x2019;s scope and lookup based.\n
  22. In sweep phase any allocations are prohibited\n\n
  23. REE specific. Stats are collected across all process life time frame so the GC cycles increasing\nAst nodes is clas varmap scope singelton etc. Terminal objects are non-object types (regex, file, float, bignum, node)\n
  24. The last couple one do not require gc stats to be enabled.\nNum allocations is the num of objects that were allocated since the script started\n
  25. \n
  26. Simple code that load&amp;#x2019;s our app env in dev mode\n
  27. Spent 2 sec in GC, allocated 5.5m objects and made 31!!!! GC cycles\n
  28. \n
  29. Have 31 GC cycle, 9 heaps and 46% unused almost half of it\n
  30. increase min slots to fit app into one heap\n
  31. Much more better utilization, only 6% unused, but it might be dangerous as well because of it&amp;#x2019;s only env loaded.\n
  32. \n
  33. Give some more space for heap, and increase malloc limit.\n
  34. As a result decent heap utilization, low number of gc cycles\n
  35. Memory consumption increased by 21 Mb.\n
  36. Simple middleware the gathering GC stats\n
  37. Sample stats got for mm node\n
  38. Unicorn supports in between req gc. It&amp;#x2019;s made in between of user requests. That&amp;#x2019;s simple middleware that can be controlled. Gotcha is that wrong params may lead to significant throughput drop. \nGC.start - forces garbage collection weather or not it&amp;#x2019;s required\n
  39. \n
  40. \n
  41. \n
  42. any of 2 last lines would have the same effect - dramatically decreasing live objects number\nWithout explicitly setting instance variable - the whole object set would live until object is in scope\n\n
  43. Every object creation checks available allocations\n\n
  44. \n