SlideShare ist ein Scribd-Unternehmen logo
1 von 59
Do Your GC Logs
  Speak To You
Using Measurements to Tune Java
      Memory Management




   Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm
Java Performance Services




                                  About Me
         •   Consultant (www.kodewerk.com)

              •    performance tuning and training seminar

         •   Co-author www.javaperformancetuning.com

         •   Member of Java Champion program

         •   Other stuff... (google is you care to)


                            Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm
Java Performance Services




         •   Most recently founded a tooling company

         •                                  jClarity
         •   We are well on the road to delivering the
             next generation of advanced performance
             tooling




                            Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm
Java Performance Services




                               Disclaimer

                The resemblance of any
                opinion, recommendation or
                comment made during this
                presentation to performance
                tuning advice is merely
                coincidental.

                            Copyright 2012 Kodewerk Ltd. All rights reserved
Why should I monitor GC?




  Copyright 2012 Kodewerk Ltd. All rights reserved
GC logs contain the
information you need to
make informed choices
about how to tune Java
Memory managemet



    Copyright 2012 Kodewerk Ltd. All rights reserved
What is the performance impact of
   logging GC in production?




      Copyright 2012 Kodewerk Ltd. All rights reserved
How do I get a GC log?




 Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm
Java Performance Services



                      -verbose:gc (not recommended)

                      -Xloggc:gc.log (recommended)

                      -XX:+PrintGCDetails

                      -XX:+PrintTenuringDistribution

                      -XX:+PrintHeapAtGC

                      -XX:+UseGCLogFileRotation (7.0 feature)

                            -XX:NumberOfGCLogFiles=10

                            -XX:GCLogFileSize=1g

                             Copyright 2012 Kodewerk Ltd. All rights reserved
What does the output look like?




    Copyright 2012 Kodewerk Ltd. All rights reserved
34404.738: [GC
Desired survivor size 38535168 bytes, new threshold 3 (max 15)
[PSYoungGen: 148069K->5859K (206720K)] 3917704K ->
3775494K(4156736K), 0.0088250 secs]
34549.200: [Full GC [PSYoungGen: 8202K->0K(303360K)]
[ParOldGen: 3946352K->3836581K(4015744K)] 3954555K-
>3836581K(4319104K) [PSPermGen: 225220K->225178K(226048K)],
2.2787100 secs]
34551.642: [GC
Desired survivor size 34078720 bytes, new threshold 1 (max 15)
[PSYoungGen: 295104K->7480K(307584K)] 4131685K-
>3844062K(4323328K), 0.0091790 secs]
34551.750: [GC
Desired survivor size 32702464 bytes, new threshold 1 (max 15)
[PSYoungGen: 293240K->4081K(280896K)] 4129822K-
>3847294K(4296640K), 0.0086640 secs]
34551.862: [GC
Desired survivor size 31260672 bytes, new threshold 1 (max 15)

             Copyright 2012 Kodewerk Ltd. All rights reserved
What is this gobbledygook trying
            to tell me?




     Copyright 2012 Kodewerk Ltd. All rights reserved
Java Heap



Java heap is reserved as a contiguous
block from C heap

 (-mx<size>)




        Copyright 2012 Kodewerk Ltd. All rights reserved
young                                 old


Sub-divide to create generational spaces

 segregate data by age

Young size is defined by

 -XX:NewRatio=n, default is 8

 -mn=<size>

Old is what remains

        Copyright 2012 Kodewerk Ltd. All rights reserved
reserved




                                                            reserved
eden S0 S1                           tenured
 n    1 1

Allocate 4 memory pools from reserved

  initial sizes calculated using -ms<size>

In young we have

  eden survivor 0 and survivor 1

  -XX:SurvivorRatio=n

Tenured is allocated from old
         Copyright 2012 Kodewerk Ltd. All rights reserved
reserved




                                                            reserved
eden S0 S1                           tenured



Eden is consumed by application threads

  otherwise known as mutator threads

Allocation failure triggers a garbage
collections to recover deferenced memory

  safe pointing assures mutually exclusive
  access (-XX:+PrintSafepointStatistics)

         Copyright 2012 Kodewerk Ltd. All rights reserved
reserved




                                                           reserved
eden S0 S1                          tenured



Two types of collections

  scavange

    allocation failure in a memory pool

    reach an occupancy threshold

Full collects all memory pools in a single
event

        Copyright 2012 Kodewerk Ltd. All rights reserved
reserved




                                                            reserved
eden S0 S1                           tenured


Mark and Sweep

  pick a memory pool and scan for it’s
  GC roots

  trace and mark all objects reachable
  from those GC roots

  sweep cleans out dead objects

    well, sort of
         Copyright 2012 Kodewerk Ltd. All rights reserved
reserved




                                                           reserved
eden S0 S1                          tenured


Eden is evacuated to the inactive survivor
space

Active survivor space is evacuated to

  inactive survivor space

  tenured (-XX:MaxTenuringDistribuion=n)

  inactive survivor space made active

All evacuated spaces are empty after a GC
        Copyright 2012 Kodewerk Ltd. All rights reserved
reserved




                                                            reserved
eden S0 S1                           tenured



Before GC starts, calculate if tenured
needs to be collected

  in place collection (expensive)

  free list management

  fragmentation

    compaction

         Copyright 2012 Kodewerk Ltd. All rights reserved
reserved




                                                                    reserved
    eden S0 S1                               tenured

uint i = 0;
if (UseSerialGC)                                       i++;
if (UseConcMarkSweepGC || UseParNewGC) i++;
if (UseParallelGC || UseParallelOldGC)                 i++;
if (UseG1GC)                                           i++;
if (i > 1) {
    jio_fprintf(defaultStream::error_stream(),
               "Conflicting collector combinations in option list; "
               "please refer to the release notes for the
combinations "
               "allowedn");
    status = false;
}

                 Copyright 2012 Kodewerk Ltd. All rights reserved
34404.738: [GC
Desired survivor size 38535168 bytes, new threshold 3 (max 15)
[PSYoungGen: 148069K->5859K (206720K)] 3917704K ->
3775494K(4156736K), 0.0088250 secs]
34549.200: [Full GC [PSYoungGen: 8202K->0K(303360K)]
[ParOldGen: 3946352K->3836581K(4015744K)] 3954555K-
>3836581K(4319104K) [PSPermGen: 225220K->225178K(226048K)],
2.2787100 secs]
34551.642: [GC
Desired survivor size 34078720 bytes, new threshold 1 (max 15)
[PSYoungGen: 295104K->7480K(307584K)] 4131685K-
>3844062K(4323328K), 0.0091790 secs]
34551.750: [GC
Desired survivor size 32702464 bytes, new threshold 1 (max 15)
[PSYoungGen: 293240K->4081K(280896K)] 4129822K-
>3847294K(4296640K), 0.0086640 secs]
34551.862: [GC
Desired survivor size 31260672 bytes, new threshold 1 (max 15)

             Copyright 2012 Kodewerk Ltd. All rights reserved
34404.738: [GC
Desired survivor size 38535168 bytes, new threshold 3 (max 15)
[PSYoungGen: 148069K->5859K (206720K)] 3917704K ->
3775494K(4156736K), 0.0088250 secs]




             Copyright 2012 Kodewerk Ltd. All rights reserved
34404.738: [GC
Desired survivor size 38535168 bytes, new threshold 3 (max 15)
[PSYoungGen: 148069K->5859K (206720K)] 3917704K ->
3775494K(4156736K), 0.0088250 secs]




                 reserved




                                                                   reserved
eden S0 S1                                   old

 Collection called for @                  34404.738      seconds
 after VM startup

 Pause time =               0.0088250   seconds

 Scavange algorithm:                PSYoungGen

   UseParallelOldGC collects both tenured and young gen
             Copyright 2012 Kodewerk Ltd. All rights reserved
34404.738: [GC
Desired survivor size 38535168 bytes, new threshold 3 (max 15)
[PSYoungGen: 148069K->5859K (206720K)] 3917704K ->
3775494K(4156736K), 0.0088250 secs]




Configured size:                4156736K               reserved


 Outer block provides a global picture

 Adaptive sizing calculates size based on
 recent activity

   grow or shrink heap in an attempt to
   improve GC effecency
             Copyright 2012 Kodewerk Ltd. All rights reserved
34404.738: [GC
Desired survivor size 38535168 bytes, new threshold 3 (max 15)
[PSYoungGen: 148069K->5859K (206720K)] 3917704K ->
3775494K(4156736K), 0.0088250 secs]




                                                       reserved


 occupancy before = 3917704K




             Copyright 2012 Kodewerk Ltd. All rights reserved
34404.738: [GC
Desired survivor size 38535168 bytes, new threshold 3 (max 15)
[PSYoungGen: 148069K->5859K (206720K)] 3917704K ->
3775494K(4156736K), 0.0088250 secs]




                                                       reserved


 occupancy before = 3917704K

 occupancy after = 3775494K




             Copyright 2012 Kodewerk Ltd. All rights reserved
34404.738: [GC
Desired survivor size 38535168 bytes, new threshold 3 (max 15)
[PSYoungGen: 148069K->5859K (206720K)] 3917704K ->
3775494K(4156736K), 0.0088250 secs]




                                                       reserved


 occupancy before = 3917704K

 occupancy after = 3775494K

 heap recovered = 3917704K - 3775494K

                          = 14220K

             Copyright 2012 Kodewerk Ltd. All rights reserved
34404.738: [GC
Desired survivor size 38535168 bytes, new threshold 3 (max 15)
[PSYoungGen: 148069K->5859K (206720K)] 3917704K ->
3775494K(4156736K), 0.0088250 secs]




                 reserved




                                                                reserved
eden S0 S1                               tenured

 For PSYoungGen

   configured size =              206720K


   occupancy before =                148069K


      survivor occupancy after =                       5859K


   recovered = 14220K
             Copyright 2012 Kodewerk Ltd. All rights reserved
34404.738: [GC
Desired survivor size 38535168 bytes, new threshold 3 (max 15)
[PSYoungGen: 148069K->5859K (206720K)] 3917704K ->
3775494K(4156736K), 0.0088250 secs]




                 reserved




                                                                reserved
eden S0 S1                               tenured


 old = total - young

   occupancy before =                3917704K - 148069K = 3769635K


   occupancy after =               3775494K - 5859K = 3769635K


   promoted = 14220 -14220 = 0K
             Copyright 2012 Kodewerk Ltd. All rights reserved
34404.738: [GC
Desired survivor size 38535168 bytes, new threshold 3 (max 15)
[PSYoungGen: 148069K->5859K (206720K)] 3917704K ->
3775494K(4156736K), 0.0088250 secs]




                 reserved




                                                                reserved
eden S0 S1                               tenured

 For survivor spaces

   survivor size =           38535168


 -XX:MaxTenuringThreshold=n, default 4/15

   new threshold (1..n), < n premature
   promotion
             Copyright 2012 Kodewerk Ltd. All rights reserved
Full GC Record
34401.996: [Full GC [PSYoungGen: 14634K->0K(160384K)]
[ParOldGen: 3971552K->3769634K(3950016K)] 3986187K-
>3769634K(4110400K) [PSPermGen: 225242K->225175K(226048K)],
2.4645280 secs] [Times: user=26.03 sys=0.01, real=2.47 secs]


  Full GC collections both young and tenured spaces
  Report on
     Young Gen: completely empties, resize
     Old Gen: occupancy and resize
     Total heap: occupancy and resize
     Perm Gen: occupancy and resize
     Timing: Time GC called for and pause time

               Copyright 2012 Kodewerk Ltd. All rights reserved
163.028: [GC 163.028: [DefNew
Desired survivor size 115671040 bytes, new threshold 15 (max 15)
- age   1:      736 bytes,           736 total
- age   2:      112 bytes,          848 total
- age   4:       40 bytes,            888 total
- age   6:      232 bytes,          1120 total
- age   7:       32 bytes,         1152 total
- age 11:        96 bytes,          1248 total
: 226048K->1K(451968K), 0.0018054 secs] 669064K-
>443016K(1129856K), 0.0018580 secs]


  ParNew

    breakdown of survivor occupancy by age




               Copyright 2012 Kodewerk Ltd. All rights reserved
0.333: [GC [1 CMS-initial-mark: 0K(2015232K)] 4907K(2097088K),
0.0173905 secs]
0.351: [CMS-concurrent-mark-start]
0.979: [CMS-concurrent-mark: 0.619/0.628 secs]
0.979: [CMS-concurrent-preclean-start]
1.029: [CMS-concurrent-preclean: 0.050/0.050 secs]
1.029: [CMS-concurrent-abortable-preclean-start]
9.341: [CMS-concurrent-abortable-preclean: 2.271/8.312 secs]
9.343: [GC[YG occupancy: 40921 K (81856 K)]9.343: [Rescan
(parallel) , 0.0240270 secs]9.367: [weak refs processing, 0.0000358
secs] [1 CMS-remark: 0K(2015232K)] 40921K(2097088K), 0.0244228
secs]
9.368: [CMS-concurrent-sweep-start]
9.368: [CMS-concurrent-sweep: 0.000/0.000 secs]
9.368: [CMS-concurrent-reset-start]
9.816: [CMS-concurrent-reset: 0.447/0.448 secs]



                  Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm
Java Performance Services




               Use the GC logs to improve
               performance of a web app

                        run 5tx/sec

               Goals

                        reduce response time

                        improve transactional throughput

                        reduce hardware consumption

                        eliminate stalls
                            Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm




                      Run 1 (defauts)
Java Performance Services




2012-09-26 21:57:58.636::WARN: Error for /j1/bench
java.lang.OutOfMemoryError: Java heap space




            Most likely default heap size is too
            small



                            Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm




                     Heap Occupancy
Java Performance Services




                            Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm
Java Performance Services




                            Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm




                               Run 2 (1g)
Java Performance Services




                                                                 25 < CPU < 70

                                                                 ~60%



                            Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm
Java Performance Services




        GC pause is 15.56% of run time

              should be less than 5%

        ParNew is working harder than it
        should

              GC frequency too high

                     promoting too many object
                            Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm
Java Performance Services




             Premature promotion @ 83.3%

                            Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm
Java Performance Services




                            Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm
Java Performance Services




             Increase size of tenured spaces

                   increase size of young gen

                            -XX:NewSize=512m

                             young = 512m, tenured = 512m

                            SurvivorRatio=1

                             all 3 spaces are ~170m


                             Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
                                        Run 2
   tm
Java Performance Services




                                        Run 3




                            Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm




                                Run 3 CPU
Java Performance Services




                                                                  20 < CPU < 50

                                                                  ~40%

                                                                      -20%




                            Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm
Java Performance Services




   Eliminated premature promotions




                            Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm
Java Performance Services




    ParNew is working less frequently @ 1.42/
    sec

          because of the bigger space

          object now die in young gen

    GC pause down to 3.13%

    Can we improve the memory footprint?
                            Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm
Java Performance Services




   We are using much less memory

         but only because we gave it more
                            Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm
Java Performance Services




   Looks likeSurvivor could be about 60m

         will induce some premature promotion
                            Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm
Java Performance Services




  Suggest tenuring threshold should ~5

        eliminate some copy costs
                            Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm




                                        Run 4
Java Performance Services




             Configure eden to 180m

                   maintain GC frequency

             S0/S1 to 60m each

             Eden + S0 + S1 <= Tenured

                   180+60+60=300+300=600m

                   survivor ratio = 3

             Tenured should be 5 (maybe 4)
                            Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
                                        Run 2
   tm
Java Performance Services




                                        Run 3


                                       Run 4

                            Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm




                               Run 4 CPU
Java Performance Services




                                                                  20 < CPU < 50

                                                                  ~40%

                                                                      no change




                            Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm
Java Performance Services




    ParNew is working about the same (was
    1.42 runs/sec)

    GC puase remains about the same (was
    3.13%)

    Much improved memory footprint

          600m vs. 1024m
                            Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm
Java Performance Services




                                                   GC adapts to a
                                                   configuration we
                                                   calculated




                            Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm
Java Performance Services




                            Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm
Java Performance Services




Could the JVM have
done this on it’s own?



                            Copyright 2012 Kodewerk Ltd. All rights reserved
Kodewerk
   tm




                                     Yeabut....
Java Performance Services




             Set max heap 1G, new ratio and
             survivor ratio to 1

                   JVM will produce identical results

                            but only after a warmup

                            and only under a set of ideal
                            conditions

                             results can vary run to run

                             Copyright 2012 Kodewerk Ltd. All rights reserved
Questions



Copyright 2012 Kodewerk Ltd. All rights reserved

Weitere ähnliche Inhalte

Was ist angesagt?

Openstack presentation
Openstack presentationOpenstack presentation
Openstack presentationbodepd
 
Fight with Metaspace OOM
Fight with Metaspace OOMFight with Metaspace OOM
Fight with Metaspace OOMLeon Chen
 
淺談 Java GC 原理、調教和 新發展
淺談 Java GC 原理、調教和新發展淺談 Java GC 原理、調教和新發展
淺談 Java GC 原理、調教和 新發展Leon Chen
 
GoodFit: Multi-Resource Packing of Tasks with Dependencies
GoodFit: Multi-Resource Packing of Tasks with DependenciesGoodFit: Multi-Resource Packing of Tasks with Dependencies
GoodFit: Multi-Resource Packing of Tasks with DependenciesDataWorks Summit/Hadoop Summit
 
Static Analysis and Code Optimizations in Glasgow Haskell Compiler
Static Analysis and Code Optimizations in Glasgow Haskell CompilerStatic Analysis and Code Optimizations in Glasgow Haskell Compiler
Static Analysis and Code Optimizations in Glasgow Haskell CompilerIlya Sergey
 
Distributed caching and computing v3.7
Distributed caching and computing v3.7Distributed caching and computing v3.7
Distributed caching and computing v3.7Rahul Gupta
 
Christo kutrovsky oracle, memory & linux
Christo kutrovsky   oracle, memory & linuxChristo kutrovsky   oracle, memory & linux
Christo kutrovsky oracle, memory & linuxKyle Hailey
 
Monitoring with Ganglia
Monitoring with GangliaMonitoring with Ganglia
Monitoring with GangliaFastly
 
Processing Big Data in Real-Time - Yanai Franchi, Tikal
Processing Big Data in Real-Time - Yanai Franchi, TikalProcessing Big Data in Real-Time - Yanai Franchi, Tikal
Processing Big Data in Real-Time - Yanai Franchi, TikalCodemotion Tel Aviv
 
GPUs in Big Data - StampedeCon 2014
GPUs in Big Data - StampedeCon 2014GPUs in Big Data - StampedeCon 2014
GPUs in Big Data - StampedeCon 2014StampedeCon
 
Large volume data analysis on the Typesafe Reactive Platform
Large volume data analysis on the Typesafe Reactive PlatformLarge volume data analysis on the Typesafe Reactive Platform
Large volume data analysis on the Typesafe Reactive PlatformMartin Zapletal
 
Effective testing for spark programs Strata NY 2015
Effective testing for spark programs   Strata NY 2015Effective testing for spark programs   Strata NY 2015
Effective testing for spark programs Strata NY 2015Holden Karau
 
Obtaining the Perfect Smoke By Monitoring Your BBQ with InfluxDB and Telegraf
Obtaining the Perfect Smoke By Monitoring Your BBQ with InfluxDB and TelegrafObtaining the Perfect Smoke By Monitoring Your BBQ with InfluxDB and Telegraf
Obtaining the Perfect Smoke By Monitoring Your BBQ with InfluxDB and TelegrafInfluxData
 
Modus operandi of Spark Streaming - Recipes for Running your Streaming Applic...
Modus operandi of Spark Streaming - Recipes for Running your Streaming Applic...Modus operandi of Spark Streaming - Recipes for Running your Streaming Applic...
Modus operandi of Spark Streaming - Recipes for Running your Streaming Applic...DataWorks Summit
 
Dive into Catalyst
Dive into CatalystDive into Catalyst
Dive into CatalystCheng Lian
 
What is in All of Those SSTable Files Not Just the Data One but All the Rest ...
What is in All of Those SSTable Files Not Just the Data One but All the Rest ...What is in All of Those SSTable Files Not Just the Data One but All the Rest ...
What is in All of Those SSTable Files Not Just the Data One but All the Rest ...DataStax
 
NoSQL @ CodeMash 2010
NoSQL @ CodeMash 2010NoSQL @ CodeMash 2010
NoSQL @ CodeMash 2010Ben Scofield
 

Was ist angesagt? (20)

Openstack presentation
Openstack presentationOpenstack presentation
Openstack presentation
 
Fight with Metaspace OOM
Fight with Metaspace OOMFight with Metaspace OOM
Fight with Metaspace OOM
 
淺談 Java GC 原理、調教和 新發展
淺談 Java GC 原理、調教和新發展淺談 Java GC 原理、調教和新發展
淺談 Java GC 原理、調教和 新發展
 
GoodFit: Multi-Resource Packing of Tasks with Dependencies
GoodFit: Multi-Resource Packing of Tasks with DependenciesGoodFit: Multi-Resource Packing of Tasks with Dependencies
GoodFit: Multi-Resource Packing of Tasks with Dependencies
 
Static Analysis and Code Optimizations in Glasgow Haskell Compiler
Static Analysis and Code Optimizations in Glasgow Haskell CompilerStatic Analysis and Code Optimizations in Glasgow Haskell Compiler
Static Analysis and Code Optimizations in Glasgow Haskell Compiler
 
Distributed caching and computing v3.7
Distributed caching and computing v3.7Distributed caching and computing v3.7
Distributed caching and computing v3.7
 
Christo kutrovsky oracle, memory & linux
Christo kutrovsky   oracle, memory & linuxChristo kutrovsky   oracle, memory & linux
Christo kutrovsky oracle, memory & linux
 
Monitoring with Ganglia
Monitoring with GangliaMonitoring with Ganglia
Monitoring with Ganglia
 
Thanos - Prometheus on Scale
Thanos - Prometheus on ScaleThanos - Prometheus on Scale
Thanos - Prometheus on Scale
 
Processing Big Data in Real-Time - Yanai Franchi, Tikal
Processing Big Data in Real-Time - Yanai Franchi, TikalProcessing Big Data in Real-Time - Yanai Franchi, Tikal
Processing Big Data in Real-Time - Yanai Franchi, Tikal
 
GPUs in Big Data - StampedeCon 2014
GPUs in Big Data - StampedeCon 2014GPUs in Big Data - StampedeCon 2014
GPUs in Big Data - StampedeCon 2014
 
Large volume data analysis on the Typesafe Reactive Platform
Large volume data analysis on the Typesafe Reactive PlatformLarge volume data analysis on the Typesafe Reactive Platform
Large volume data analysis on the Typesafe Reactive Platform
 
Effective testing for spark programs Strata NY 2015
Effective testing for spark programs   Strata NY 2015Effective testing for spark programs   Strata NY 2015
Effective testing for spark programs Strata NY 2015
 
Metrics with Ganglia
Metrics with GangliaMetrics with Ganglia
Metrics with Ganglia
 
Obtaining the Perfect Smoke By Monitoring Your BBQ with InfluxDB and Telegraf
Obtaining the Perfect Smoke By Monitoring Your BBQ with InfluxDB and TelegrafObtaining the Perfect Smoke By Monitoring Your BBQ with InfluxDB and Telegraf
Obtaining the Perfect Smoke By Monitoring Your BBQ with InfluxDB and Telegraf
 
Jvm heap
Jvm heapJvm heap
Jvm heap
 
Modus operandi of Spark Streaming - Recipes for Running your Streaming Applic...
Modus operandi of Spark Streaming - Recipes for Running your Streaming Applic...Modus operandi of Spark Streaming - Recipes for Running your Streaming Applic...
Modus operandi of Spark Streaming - Recipes for Running your Streaming Applic...
 
Dive into Catalyst
Dive into CatalystDive into Catalyst
Dive into Catalyst
 
What is in All of Those SSTable Files Not Just the Data One but All the Rest ...
What is in All of Those SSTable Files Not Just the Data One but All the Rest ...What is in All of Those SSTable Files Not Just the Data One but All the Rest ...
What is in All of Those SSTable Files Not Just the Data One but All the Rest ...
 
NoSQL @ CodeMash 2010
NoSQL @ CodeMash 2010NoSQL @ CodeMash 2010
NoSQL @ CodeMash 2010
 

Andere mochten auch

SQLBits VI - Improving database performance by removing the database
SQLBits VI - Improving database performance by removing the databaseSQLBits VI - Improving database performance by removing the database
SQLBits VI - Improving database performance by removing the databaseSimon Munro
 
Performance Tuning: You’re doing it wrong! by Kirk Pepperdine
Performance Tuning: You’re doing it wrong! by Kirk PepperdinePerformance Tuning: You’re doing it wrong! by Kirk Pepperdine
Performance Tuning: You’re doing it wrong! by Kirk PepperdineBaruch Sadogursky
 
El Proyecto TecnolóGico
El  Proyecto  TecnolóGicoEl  Proyecto  TecnolóGico
El Proyecto TecnolóGicoWalter Galarza
 
Garbage Collection - The Useful Parts
Garbage Collection - The Useful PartsGarbage Collection - The Useful Parts
Garbage Collection - The Useful PartsMartijn Verburg
 

Andere mochten auch (6)

Gclogs jdd
Gclogs jddGclogs jdd
Gclogs jdd
 
Gclogs
GclogsGclogs
Gclogs
 
SQLBits VI - Improving database performance by removing the database
SQLBits VI - Improving database performance by removing the databaseSQLBits VI - Improving database performance by removing the database
SQLBits VI - Improving database performance by removing the database
 
Performance Tuning: You’re doing it wrong! by Kirk Pepperdine
Performance Tuning: You’re doing it wrong! by Kirk PepperdinePerformance Tuning: You’re doing it wrong! by Kirk Pepperdine
Performance Tuning: You’re doing it wrong! by Kirk Pepperdine
 
El Proyecto TecnolóGico
El  Proyecto  TecnolóGicoEl  Proyecto  TecnolóGico
El Proyecto TecnolóGico
 
Garbage Collection - The Useful Parts
Garbage Collection - The Useful PartsGarbage Collection - The Useful Parts
Garbage Collection - The Useful Parts
 

Ähnlich wie Gclogs j1

JVM and Garbage Collection Tuning
JVM and Garbage Collection TuningJVM and Garbage Collection Tuning
JVM and Garbage Collection TuningKai Koenig
 
ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...
ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...
ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...Istanbul Tech Talks
 
Performance tuning jvm
Performance tuning jvmPerformance tuning jvm
Performance tuning jvmPrem Kuppumani
 
Taming GC Pauses for Humongous Java Heaps in Spark Graph Computing-(Eric Kacz...
Taming GC Pauses for Humongous Java Heaps in Spark Graph Computing-(Eric Kacz...Taming GC Pauses for Humongous Java Heaps in Spark Graph Computing-(Eric Kacz...
Taming GC Pauses for Humongous Java Heaps in Spark Graph Computing-(Eric Kacz...Spark Summit
 
Java and Serverless - A Match Made In Heaven, Part 2
Java and Serverless - A Match Made In Heaven, Part 2Java and Serverless - A Match Made In Heaven, Part 2
Java and Serverless - A Match Made In Heaven, Part 2Curity
 
Let's Learn to Talk to GC Logs in Java 9
Let's Learn to Talk to GC Logs in Java 9Let's Learn to Talk to GC Logs in Java 9
Let's Learn to Talk to GC Logs in Java 9Poonam Bajaj Parhar
 
Troubleshooting Memory Problems in Java Applications
Troubleshooting Memory Problems in Java ApplicationsTroubleshooting Memory Problems in Java Applications
Troubleshooting Memory Problems in Java ApplicationsPoonam Bajaj Parhar
 
GC Tuning & Troubleshooting Crash Course
GC Tuning & Troubleshooting Crash CourseGC Tuning & Troubleshooting Crash Course
GC Tuning & Troubleshooting Crash CourseTier1 app
 
Become a Garbage Collection Hero
Become a Garbage Collection HeroBecome a Garbage Collection Hero
Become a Garbage Collection HeroTier1app
 
HBaseCon 2015: Taming GC Pauses for Large Java Heap in HBase
HBaseCon 2015: Taming GC Pauses for Large Java Heap in HBaseHBaseCon 2015: Taming GC Pauses for Large Java Heap in HBase
HBaseCon 2015: Taming GC Pauses for Large Java Heap in HBaseHBaseCon
 
“Quantum” Performance Effects: beyond the Core
“Quantum” Performance Effects: beyond the Core“Quantum” Performance Effects: beyond the Core
“Quantum” Performance Effects: beyond the CoreC4Media
 
Apache Pinot Meetup Sept02, 2020
Apache Pinot Meetup Sept02, 2020Apache Pinot Meetup Sept02, 2020
Apache Pinot Meetup Sept02, 2020Mayank Shrivastava
 
Examining Oracle GoldenGate Trail Files
Examining Oracle GoldenGate Trail FilesExamining Oracle GoldenGate Trail Files
Examining Oracle GoldenGate Trail FilesBobby Curtis
 
Extreme Replication - RMOUG Presentation
Extreme Replication - RMOUG PresentationExtreme Replication - RMOUG Presentation
Extreme Replication - RMOUG PresentationBobby Curtis
 
G1: To Infinity and Beyond
G1: To Infinity and BeyondG1: To Infinity and Beyond
G1: To Infinity and BeyondScyllaDB
 

Ähnlich wie Gclogs j1 (20)

JVM and Garbage Collection Tuning
JVM and Garbage Collection TuningJVM and Garbage Collection Tuning
JVM and Garbage Collection Tuning
 
ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...
ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...
ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...
 
Performance tuning jvm
Performance tuning jvmPerformance tuning jvm
Performance tuning jvm
 
Taming GC Pauses for Humongous Java Heaps in Spark Graph Computing-(Eric Kacz...
Taming GC Pauses for Humongous Java Heaps in Spark Graph Computing-(Eric Kacz...Taming GC Pauses for Humongous Java Heaps in Spark Graph Computing-(Eric Kacz...
Taming GC Pauses for Humongous Java Heaps in Spark Graph Computing-(Eric Kacz...
 
Java and Serverless - A Match Made In Heaven, Part 2
Java and Serverless - A Match Made In Heaven, Part 2Java and Serverless - A Match Made In Heaven, Part 2
Java and Serverless - A Match Made In Heaven, Part 2
 
Tuning the g1gc
Tuning the g1gcTuning the g1gc
Tuning the g1gc
 
Let's Learn to Talk to GC Logs in Java 9
Let's Learn to Talk to GC Logs in Java 9Let's Learn to Talk to GC Logs in Java 9
Let's Learn to Talk to GC Logs in Java 9
 
Le guide de dépannage de la jvm
Le guide de dépannage de la jvmLe guide de dépannage de la jvm
Le guide de dépannage de la jvm
 
Troubleshooting Memory Problems in Java Applications
Troubleshooting Memory Problems in Java ApplicationsTroubleshooting Memory Problems in Java Applications
Troubleshooting Memory Problems in Java Applications
 
A G1GC Saga-KCJUG.pptx
A G1GC Saga-KCJUG.pptxA G1GC Saga-KCJUG.pptx
A G1GC Saga-KCJUG.pptx
 
GC Tuning & Troubleshooting Crash Course
GC Tuning & Troubleshooting Crash CourseGC Tuning & Troubleshooting Crash Course
GC Tuning & Troubleshooting Crash Course
 
Tools for Metaspace
Tools for MetaspaceTools for Metaspace
Tools for Metaspace
 
Become a Garbage Collection Hero
Become a Garbage Collection HeroBecome a Garbage Collection Hero
Become a Garbage Collection Hero
 
HBaseCon 2015: Taming GC Pauses for Large Java Heap in HBase
HBaseCon 2015: Taming GC Pauses for Large Java Heap in HBaseHBaseCon 2015: Taming GC Pauses for Large Java Heap in HBase
HBaseCon 2015: Taming GC Pauses for Large Java Heap in HBase
 
“Quantum” Performance Effects: beyond the Core
“Quantum” Performance Effects: beyond the Core“Quantum” Performance Effects: beyond the Core
“Quantum” Performance Effects: beyond the Core
 
Pitch v2.2
Pitch v2.2Pitch v2.2
Pitch v2.2
 
Apache Pinot Meetup Sept02, 2020
Apache Pinot Meetup Sept02, 2020Apache Pinot Meetup Sept02, 2020
Apache Pinot Meetup Sept02, 2020
 
Examining Oracle GoldenGate Trail Files
Examining Oracle GoldenGate Trail FilesExamining Oracle GoldenGate Trail Files
Examining Oracle GoldenGate Trail Files
 
Extreme Replication - RMOUG Presentation
Extreme Replication - RMOUG PresentationExtreme Replication - RMOUG Presentation
Extreme Replication - RMOUG Presentation
 
G1: To Infinity and Beyond
G1: To Infinity and BeyondG1: To Infinity and Beyond
G1: To Infinity and Beyond
 

Kürzlich hochgeladen

20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?IES VE
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 

Kürzlich hochgeladen (20)

20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 

Gclogs j1

  • 1. Do Your GC Logs Speak To You Using Measurements to Tune Java Memory Management Copyright 2012 Kodewerk Ltd. All rights reserved
  • 2. Kodewerk tm Java Performance Services About Me • Consultant (www.kodewerk.com) • performance tuning and training seminar • Co-author www.javaperformancetuning.com • Member of Java Champion program • Other stuff... (google is you care to) Copyright 2012 Kodewerk Ltd. All rights reserved
  • 3. Kodewerk tm Java Performance Services • Most recently founded a tooling company • jClarity • We are well on the road to delivering the next generation of advanced performance tooling Copyright 2012 Kodewerk Ltd. All rights reserved
  • 4. Kodewerk tm Java Performance Services Disclaimer The resemblance of any opinion, recommendation or comment made during this presentation to performance tuning advice is merely coincidental. Copyright 2012 Kodewerk Ltd. All rights reserved
  • 5. Why should I monitor GC? Copyright 2012 Kodewerk Ltd. All rights reserved
  • 6. GC logs contain the information you need to make informed choices about how to tune Java Memory managemet Copyright 2012 Kodewerk Ltd. All rights reserved
  • 7. What is the performance impact of logging GC in production? Copyright 2012 Kodewerk Ltd. All rights reserved
  • 8. How do I get a GC log? Copyright 2012 Kodewerk Ltd. All rights reserved
  • 9. Kodewerk tm Java Performance Services -verbose:gc (not recommended) -Xloggc:gc.log (recommended) -XX:+PrintGCDetails -XX:+PrintTenuringDistribution -XX:+PrintHeapAtGC -XX:+UseGCLogFileRotation (7.0 feature) -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=1g Copyright 2012 Kodewerk Ltd. All rights reserved
  • 10. What does the output look like? Copyright 2012 Kodewerk Ltd. All rights reserved
  • 11. 34404.738: [GC Desired survivor size 38535168 bytes, new threshold 3 (max 15) [PSYoungGen: 148069K->5859K (206720K)] 3917704K -> 3775494K(4156736K), 0.0088250 secs] 34549.200: [Full GC [PSYoungGen: 8202K->0K(303360K)] [ParOldGen: 3946352K->3836581K(4015744K)] 3954555K- >3836581K(4319104K) [PSPermGen: 225220K->225178K(226048K)], 2.2787100 secs] 34551.642: [GC Desired survivor size 34078720 bytes, new threshold 1 (max 15) [PSYoungGen: 295104K->7480K(307584K)] 4131685K- >3844062K(4323328K), 0.0091790 secs] 34551.750: [GC Desired survivor size 32702464 bytes, new threshold 1 (max 15) [PSYoungGen: 293240K->4081K(280896K)] 4129822K- >3847294K(4296640K), 0.0086640 secs] 34551.862: [GC Desired survivor size 31260672 bytes, new threshold 1 (max 15) Copyright 2012 Kodewerk Ltd. All rights reserved
  • 12. What is this gobbledygook trying to tell me? Copyright 2012 Kodewerk Ltd. All rights reserved
  • 13. Java Heap Java heap is reserved as a contiguous block from C heap (-mx<size>) Copyright 2012 Kodewerk Ltd. All rights reserved
  • 14. young old Sub-divide to create generational spaces segregate data by age Young size is defined by -XX:NewRatio=n, default is 8 -mn=<size> Old is what remains Copyright 2012 Kodewerk Ltd. All rights reserved
  • 15. reserved reserved eden S0 S1 tenured n 1 1 Allocate 4 memory pools from reserved initial sizes calculated using -ms<size> In young we have eden survivor 0 and survivor 1 -XX:SurvivorRatio=n Tenured is allocated from old Copyright 2012 Kodewerk Ltd. All rights reserved
  • 16. reserved reserved eden S0 S1 tenured Eden is consumed by application threads otherwise known as mutator threads Allocation failure triggers a garbage collections to recover deferenced memory safe pointing assures mutually exclusive access (-XX:+PrintSafepointStatistics) Copyright 2012 Kodewerk Ltd. All rights reserved
  • 17. reserved reserved eden S0 S1 tenured Two types of collections scavange allocation failure in a memory pool reach an occupancy threshold Full collects all memory pools in a single event Copyright 2012 Kodewerk Ltd. All rights reserved
  • 18. reserved reserved eden S0 S1 tenured Mark and Sweep pick a memory pool and scan for it’s GC roots trace and mark all objects reachable from those GC roots sweep cleans out dead objects well, sort of Copyright 2012 Kodewerk Ltd. All rights reserved
  • 19. reserved reserved eden S0 S1 tenured Eden is evacuated to the inactive survivor space Active survivor space is evacuated to inactive survivor space tenured (-XX:MaxTenuringDistribuion=n) inactive survivor space made active All evacuated spaces are empty after a GC Copyright 2012 Kodewerk Ltd. All rights reserved
  • 20. reserved reserved eden S0 S1 tenured Before GC starts, calculate if tenured needs to be collected in place collection (expensive) free list management fragmentation compaction Copyright 2012 Kodewerk Ltd. All rights reserved
  • 21. reserved reserved eden S0 S1 tenured uint i = 0; if (UseSerialGC) i++; if (UseConcMarkSweepGC || UseParNewGC) i++; if (UseParallelGC || UseParallelOldGC) i++; if (UseG1GC) i++; if (i > 1) { jio_fprintf(defaultStream::error_stream(), "Conflicting collector combinations in option list; " "please refer to the release notes for the combinations " "allowedn"); status = false; } Copyright 2012 Kodewerk Ltd. All rights reserved
  • 22. 34404.738: [GC Desired survivor size 38535168 bytes, new threshold 3 (max 15) [PSYoungGen: 148069K->5859K (206720K)] 3917704K -> 3775494K(4156736K), 0.0088250 secs] 34549.200: [Full GC [PSYoungGen: 8202K->0K(303360K)] [ParOldGen: 3946352K->3836581K(4015744K)] 3954555K- >3836581K(4319104K) [PSPermGen: 225220K->225178K(226048K)], 2.2787100 secs] 34551.642: [GC Desired survivor size 34078720 bytes, new threshold 1 (max 15) [PSYoungGen: 295104K->7480K(307584K)] 4131685K- >3844062K(4323328K), 0.0091790 secs] 34551.750: [GC Desired survivor size 32702464 bytes, new threshold 1 (max 15) [PSYoungGen: 293240K->4081K(280896K)] 4129822K- >3847294K(4296640K), 0.0086640 secs] 34551.862: [GC Desired survivor size 31260672 bytes, new threshold 1 (max 15) Copyright 2012 Kodewerk Ltd. All rights reserved
  • 23. 34404.738: [GC Desired survivor size 38535168 bytes, new threshold 3 (max 15) [PSYoungGen: 148069K->5859K (206720K)] 3917704K -> 3775494K(4156736K), 0.0088250 secs] Copyright 2012 Kodewerk Ltd. All rights reserved
  • 24. 34404.738: [GC Desired survivor size 38535168 bytes, new threshold 3 (max 15) [PSYoungGen: 148069K->5859K (206720K)] 3917704K -> 3775494K(4156736K), 0.0088250 secs] reserved reserved eden S0 S1 old Collection called for @ 34404.738 seconds after VM startup Pause time = 0.0088250 seconds Scavange algorithm: PSYoungGen UseParallelOldGC collects both tenured and young gen Copyright 2012 Kodewerk Ltd. All rights reserved
  • 25. 34404.738: [GC Desired survivor size 38535168 bytes, new threshold 3 (max 15) [PSYoungGen: 148069K->5859K (206720K)] 3917704K -> 3775494K(4156736K), 0.0088250 secs] Configured size: 4156736K reserved Outer block provides a global picture Adaptive sizing calculates size based on recent activity grow or shrink heap in an attempt to improve GC effecency Copyright 2012 Kodewerk Ltd. All rights reserved
  • 26. 34404.738: [GC Desired survivor size 38535168 bytes, new threshold 3 (max 15) [PSYoungGen: 148069K->5859K (206720K)] 3917704K -> 3775494K(4156736K), 0.0088250 secs] reserved occupancy before = 3917704K Copyright 2012 Kodewerk Ltd. All rights reserved
  • 27. 34404.738: [GC Desired survivor size 38535168 bytes, new threshold 3 (max 15) [PSYoungGen: 148069K->5859K (206720K)] 3917704K -> 3775494K(4156736K), 0.0088250 secs] reserved occupancy before = 3917704K occupancy after = 3775494K Copyright 2012 Kodewerk Ltd. All rights reserved
  • 28. 34404.738: [GC Desired survivor size 38535168 bytes, new threshold 3 (max 15) [PSYoungGen: 148069K->5859K (206720K)] 3917704K -> 3775494K(4156736K), 0.0088250 secs] reserved occupancy before = 3917704K occupancy after = 3775494K heap recovered = 3917704K - 3775494K = 14220K Copyright 2012 Kodewerk Ltd. All rights reserved
  • 29. 34404.738: [GC Desired survivor size 38535168 bytes, new threshold 3 (max 15) [PSYoungGen: 148069K->5859K (206720K)] 3917704K -> 3775494K(4156736K), 0.0088250 secs] reserved reserved eden S0 S1 tenured For PSYoungGen configured size = 206720K occupancy before = 148069K survivor occupancy after = 5859K recovered = 14220K Copyright 2012 Kodewerk Ltd. All rights reserved
  • 30. 34404.738: [GC Desired survivor size 38535168 bytes, new threshold 3 (max 15) [PSYoungGen: 148069K->5859K (206720K)] 3917704K -> 3775494K(4156736K), 0.0088250 secs] reserved reserved eden S0 S1 tenured old = total - young occupancy before = 3917704K - 148069K = 3769635K occupancy after = 3775494K - 5859K = 3769635K promoted = 14220 -14220 = 0K Copyright 2012 Kodewerk Ltd. All rights reserved
  • 31. 34404.738: [GC Desired survivor size 38535168 bytes, new threshold 3 (max 15) [PSYoungGen: 148069K->5859K (206720K)] 3917704K -> 3775494K(4156736K), 0.0088250 secs] reserved reserved eden S0 S1 tenured For survivor spaces survivor size = 38535168 -XX:MaxTenuringThreshold=n, default 4/15 new threshold (1..n), < n premature promotion Copyright 2012 Kodewerk Ltd. All rights reserved
  • 32. Full GC Record 34401.996: [Full GC [PSYoungGen: 14634K->0K(160384K)] [ParOldGen: 3971552K->3769634K(3950016K)] 3986187K- >3769634K(4110400K) [PSPermGen: 225242K->225175K(226048K)], 2.4645280 secs] [Times: user=26.03 sys=0.01, real=2.47 secs] Full GC collections both young and tenured spaces Report on Young Gen: completely empties, resize Old Gen: occupancy and resize Total heap: occupancy and resize Perm Gen: occupancy and resize Timing: Time GC called for and pause time Copyright 2012 Kodewerk Ltd. All rights reserved
  • 33. 163.028: [GC 163.028: [DefNew Desired survivor size 115671040 bytes, new threshold 15 (max 15) - age 1: 736 bytes, 736 total - age 2: 112 bytes, 848 total - age 4: 40 bytes, 888 total - age 6: 232 bytes, 1120 total - age 7: 32 bytes, 1152 total - age 11: 96 bytes, 1248 total : 226048K->1K(451968K), 0.0018054 secs] 669064K- >443016K(1129856K), 0.0018580 secs] ParNew breakdown of survivor occupancy by age Copyright 2012 Kodewerk Ltd. All rights reserved
  • 34. 0.333: [GC [1 CMS-initial-mark: 0K(2015232K)] 4907K(2097088K), 0.0173905 secs] 0.351: [CMS-concurrent-mark-start] 0.979: [CMS-concurrent-mark: 0.619/0.628 secs] 0.979: [CMS-concurrent-preclean-start] 1.029: [CMS-concurrent-preclean: 0.050/0.050 secs] 1.029: [CMS-concurrent-abortable-preclean-start] 9.341: [CMS-concurrent-abortable-preclean: 2.271/8.312 secs] 9.343: [GC[YG occupancy: 40921 K (81856 K)]9.343: [Rescan (parallel) , 0.0240270 secs]9.367: [weak refs processing, 0.0000358 secs] [1 CMS-remark: 0K(2015232K)] 40921K(2097088K), 0.0244228 secs] 9.368: [CMS-concurrent-sweep-start] 9.368: [CMS-concurrent-sweep: 0.000/0.000 secs] 9.368: [CMS-concurrent-reset-start] 9.816: [CMS-concurrent-reset: 0.447/0.448 secs] Copyright 2012 Kodewerk Ltd. All rights reserved
  • 35. Kodewerk tm Java Performance Services Use the GC logs to improve performance of a web app run 5tx/sec Goals reduce response time improve transactional throughput reduce hardware consumption eliminate stalls Copyright 2012 Kodewerk Ltd. All rights reserved
  • 36. Kodewerk tm Run 1 (defauts) Java Performance Services 2012-09-26 21:57:58.636::WARN: Error for /j1/bench java.lang.OutOfMemoryError: Java heap space Most likely default heap size is too small Copyright 2012 Kodewerk Ltd. All rights reserved
  • 37. Kodewerk tm Heap Occupancy Java Performance Services Copyright 2012 Kodewerk Ltd. All rights reserved
  • 38. Kodewerk tm Java Performance Services Copyright 2012 Kodewerk Ltd. All rights reserved
  • 39. Kodewerk tm Run 2 (1g) Java Performance Services 25 < CPU < 70 ~60% Copyright 2012 Kodewerk Ltd. All rights reserved
  • 40. Kodewerk tm Java Performance Services GC pause is 15.56% of run time should be less than 5% ParNew is working harder than it should GC frequency too high promoting too many object Copyright 2012 Kodewerk Ltd. All rights reserved
  • 41. Kodewerk tm Java Performance Services Premature promotion @ 83.3% Copyright 2012 Kodewerk Ltd. All rights reserved
  • 42. Kodewerk tm Java Performance Services Copyright 2012 Kodewerk Ltd. All rights reserved
  • 43. Kodewerk tm Java Performance Services Increase size of tenured spaces increase size of young gen -XX:NewSize=512m young = 512m, tenured = 512m SurvivorRatio=1 all 3 spaces are ~170m Copyright 2012 Kodewerk Ltd. All rights reserved
  • 44. Kodewerk Run 2 tm Java Performance Services Run 3 Copyright 2012 Kodewerk Ltd. All rights reserved
  • 45. Kodewerk tm Run 3 CPU Java Performance Services 20 < CPU < 50 ~40% -20% Copyright 2012 Kodewerk Ltd. All rights reserved
  • 46. Kodewerk tm Java Performance Services Eliminated premature promotions Copyright 2012 Kodewerk Ltd. All rights reserved
  • 47. Kodewerk tm Java Performance Services ParNew is working less frequently @ 1.42/ sec because of the bigger space object now die in young gen GC pause down to 3.13% Can we improve the memory footprint? Copyright 2012 Kodewerk Ltd. All rights reserved
  • 48. Kodewerk tm Java Performance Services We are using much less memory but only because we gave it more Copyright 2012 Kodewerk Ltd. All rights reserved
  • 49. Kodewerk tm Java Performance Services Looks likeSurvivor could be about 60m will induce some premature promotion Copyright 2012 Kodewerk Ltd. All rights reserved
  • 50. Kodewerk tm Java Performance Services Suggest tenuring threshold should ~5 eliminate some copy costs Copyright 2012 Kodewerk Ltd. All rights reserved
  • 51. Kodewerk tm Run 4 Java Performance Services Configure eden to 180m maintain GC frequency S0/S1 to 60m each Eden + S0 + S1 <= Tenured 180+60+60=300+300=600m survivor ratio = 3 Tenured should be 5 (maybe 4) Copyright 2012 Kodewerk Ltd. All rights reserved
  • 52. Kodewerk Run 2 tm Java Performance Services Run 3 Run 4 Copyright 2012 Kodewerk Ltd. All rights reserved
  • 53. Kodewerk tm Run 4 CPU Java Performance Services 20 < CPU < 50 ~40% no change Copyright 2012 Kodewerk Ltd. All rights reserved
  • 54. Kodewerk tm Java Performance Services ParNew is working about the same (was 1.42 runs/sec) GC puase remains about the same (was 3.13%) Much improved memory footprint 600m vs. 1024m Copyright 2012 Kodewerk Ltd. All rights reserved
  • 55. Kodewerk tm Java Performance Services GC adapts to a configuration we calculated Copyright 2012 Kodewerk Ltd. All rights reserved
  • 56. Kodewerk tm Java Performance Services Copyright 2012 Kodewerk Ltd. All rights reserved
  • 57. Kodewerk tm Java Performance Services Could the JVM have done this on it’s own? Copyright 2012 Kodewerk Ltd. All rights reserved
  • 58. Kodewerk tm Yeabut.... Java Performance Services Set max heap 1G, new ratio and survivor ratio to 1 JVM will produce identical results but only after a warmup and only under a set of ideal conditions results can vary run to run Copyright 2012 Kodewerk Ltd. All rights reserved
  • 59. Questions Copyright 2012 Kodewerk Ltd. All rights reserved