SlideShare une entreprise Scribd logo
1  sur  12
Télécharger pour lire hors ligne
JJUG JavaOne 2012 San Francisco 報告会

(LT) G1GC チューニング
                                                             と G1GC Visualizer
  ~ CON6583 – G1 Garbage Collector Performance Tuning より ~

                                                                       2012/11/9

                                        木村英一(@kimuchi583)

               © 2012 EIICHI KIMURA All Rights Reserved.   2012/11/9               1
木村 英一 って、誰 ?
武蔵小杉駅 横須賀線口の前に立つビルで
      Java案件支援, チューニング                   諸々に対応してます。


                                       Twitter : @kimuchi583
                       URL : http://kimuchi583.at.webry.info/
                                                                              http://blog.kimu2.jp/


本セッションの内容は、
http://www.myexpospace.com/JavaOne2012/SessionFiles/CON658
3_PDF_6583_0001.pdf
                      © 2012 EIICHI KIMURA All Rights Reserved.   2012/11/9                     2
オプションは、これだけ !!

         ‐Xms6g
         ‐Xmx6g
      ‐XX:+UseG1GC
‐XX:MaxGCPauseMillis=200
         © 2012 EIICHI KIMURA All Rights Reserved.   2012/11/9   3
これらのオプションはダメ !!
          ‐Xmn
     ‐XX:MaxNewSize
       ‐XX:NewSize
      ‐XX:NewRatio
    ‐XX:SurvivorRatio
Young 領域は目標達成のために自動的に調整される
      (ヒープ全体の20%~80%の範囲で)
          © 2012 EIICHI KIMURA All Rights Reserved.   2012/11/9   4
Young 領域サイズを指定をすると …
   Young 領域のサイズを自動調整しない

  一時停止時間の目標設定は無視する


  私のほうが Java VM より
  上手くチューニングできる
     !! 宣言 !!
         © 2012 EIICHI KIMURA All Rights Reserved.   2012/11/9   5
G1GC の動作状況を分析するには
                              ログ出力用
                   [‐verbosegc | ‐XLoggc:<gc.log>]
                             ‐XX:+PrintGC
                       ‐XX:+PrintGCTimeStamps
                       ‐XX:+PrintGCDateStamps
                          ‐XX:+PrintGCDetails
                     ‐XX:+PrintAdaptiveSizePolicy
 ‐XX:+UnlockExperimentalVMOptions –XX:G1LogLevel=[fine | finer | finest]

                                  チューニング用
                 ‐XX:InitiatingHeapOccupancyPercent=<percent>
              ‐XX:G1OldCSetRegionLiveThresholdPercent=<percent>
                        ‐XX:G1MixedGCCountTarget=<N>
                         ‐XX:G1HeapWastePercent=<N>
 (http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html)

                          © 2012 EIICHI KIMURA All Rights Reserved.   2012/11/9   6
でも使えるのは、これだけ
                             ログ出力用
                  [‐verbosegc | ‐XLoggc:<gc.log>]
                            ‐XX:+PrintGC
                      ‐XX:+PrintGCTimeStamps
                      ‐XX:+PrintGCDateStamps
                         ‐XX:+PrintGCDetails
                    ‐XX:+PrintAdaptiveSizePolicy
‐XX:+UnlockExperimentalVMOptions –XX:G1LogLevel=[fine | finer | finest]

                                 チューニング用
                ‐XX:InitiatingHeapOccupancyPercent=<percent>
             ‐XX:G1OldCSetRegionLiveThresholdPercent=<percent>
                       ‐XX:G1MixedGCCountTarget=<N>
                        ‐XX:G1HeapWastePercent=<N>

(http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html)

                         © 2012 EIICHI KIMURA All Rights Reserved.   2012/11/9   7
G1GC のサイクル
        Initial Mark – STW
Root Region Scanning – Concurrent
 Concurrent Marking – Concurrent
          Remark – STW
   Cleanup – STW + Concurrent
Copying(Young GC/Mixed GC) - STW 8
            © 2012 EIICHI KIMURA All Rights Reserved.   2012/11/9
Mark Phase                                                    Copy phase
Young mode




                 Mark /Remark Phase   Cleanup Phase                                 Copy Phase
             高                    高          高                          高                    高                    高
               高           高           高
Mixed mode




             高 高         高 高         高 高
             高     低     高     低     高
             高   高 低   低 高   高 低   低 高   高
               高     低     高     低     高                                                                          低
                  Non-Allocated       Eden          Survivor                                      Old
                                                    Recently copied in Survivor                   Recently copied in Old
                                                 © 2012 EIICHI KIMURA All Rights Reserved.   2012/11/9                     9
こんな GC ログ、読むのは大変
{Heap before GC invocations=0 (full 0):
 garbage-first heap total 16384K, used 5120K [0x03600000, 0x04600000, 0x05a00000)
  region size 1024K, 5 young (5120K), 0 survivors (0K)
 compacting perm gen total 12288K, used 6053K [0x05a00000, 0x06600000, 0x09a00000)
   the space 12288K, 49% used [0x05a00000, 0x05fe9478, 0x05fe9600, 0x06600000)
No shared spaces configured.
2012-08-22T16:37:32.445+0900: G1HR #StartGC 1
0.911: [GC pause (young)
Desired survivor size 524288 bytes, new threshold 15 (max 15)
 0.911: [G1Ergonomics (CSet Construction) start choosing CSet, predicted base time: 83.70 ms, remaining time: 116.30 ms, target pause time: 200.00 ms]
 0.911: [G1Ergonomics (CSet Construction) add young regions to CSet, eden: 5 regions, survivors: 0 regions, predicted young region time: 127.33 ms]
 0.911: [G1Ergonomics (CSet Construction) finish choosing CSet, eden: 5 regions, survivors: 0 regions, old: 0 regions, predicted pause time: 211.03 ms, target
pause time: 200.00 ms]
 G1HR CSET 0x03a00000
:
 G1HR ALLOC(Survivor) 0x03b00000
 G1HR ALLOC(Old) 0x03c00000
 G1HR RETIRE 0x03c00000 0x03ccee20, 0.01186911 secs]
   [Parallel Time: 11.0 ms]
     [GC Worker Start (ms): 911.1 911.1 911.1 911.1         Avg: 911.1, Min: 911.1, Max: 911.1, Diff: 0.0]
     [Ext Root Scanning (ms): 2.6 3.5 3.6 4.6        Avg: 3.6, Min: 2.6, Max: 4.6, Diff: 2.0]
     [Update RS (ms): 0.0 0.1 0.0 0.0        Avg: 0.0, Min: 0.0, Max: 0.1, Diff: 0.1]
       [Processed Buffers : 0 14 0 0    Sum: 14, Avg: 3, Min: 0, Max: 14, Diff: 14]
     [Scan RS (ms): 0.0 0.0 0.0 0.0        Avg: 0.0, Min: 0.0, Max: 0.0, Diff: 0.0]
     [Object Copy (ms): 8.2 7.0 7.0 6.0        Avg: 7.1, Min: 6.0, Max: 8.2, Diff: 2.2]
     [Termination (ms): 0.0 0.0 0.0 0.0        Avg: 0.0, Min: 0.0, Max: 0.0, Diff: 0.0]
       [Termination Attempts : 2 2 1 1     Sum: 6, Avg: 1, Min: 1, Max: 2, Diff: 1]
     [GC Worker End (ms): 921.9 921.9 921.9 921.9          Avg: 921.9, Min: 921.9, Max: 921.9, Diff: 0.0]
     [GC Worker (ms): 10.9 10.9 10.9 10.8          Avg: 10.9, Min: 10.8, Max: 10.9, Diff: 0.0]
     [GC Worker Other (ms): 0.2 0.3 0.3 0.3         Avg: 0.3, Min: 0.2, Max: 0.3, Diff: 0.2]
   [Clear CT: 0.1 ms]
   [Other: 0.7 ms]
     [Choose CSet: 0.0 ms]
     [Ref Proc: 0.5 ms]
                                                            © 2012 EIICHI KIMURA All Rights Reserved. 2012/11/9                                           10
そこで – JavaOne 2012 になかったネタ
                              G1GC ログの可視化したい




         © 2012 EIICHI KIMURA All Rights Reserved.   2012/11/9   11
本セッションの内容は、
                    Fin.
http://www.myexpospace.com/JavaOne2012/SessionFiles/CON6583_PDF_65
83_0001.pdf
                         © 2012 EIICHI KIMURA All Rights Reserved.   2012/11/9   12

Contenu connexe

En vedette

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

En vedette (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

JJUG JavaOne 2012 San Francisco 報告会 LT(G1GC)

  • 1. JJUG JavaOne 2012 San Francisco 報告会 (LT) G1GC チューニング と G1GC Visualizer ~ CON6583 – G1 Garbage Collector Performance Tuning より ~ 2012/11/9 木村英一(@kimuchi583) © 2012 EIICHI KIMURA All Rights Reserved. 2012/11/9 1
  • 2. 木村 英一 って、誰 ? 武蔵小杉駅 横須賀線口の前に立つビルで Java案件支援, チューニング 諸々に対応してます。 Twitter : @kimuchi583 URL : http://kimuchi583.at.webry.info/ http://blog.kimu2.jp/ 本セッションの内容は、 http://www.myexpospace.com/JavaOne2012/SessionFiles/CON658 3_PDF_6583_0001.pdf © 2012 EIICHI KIMURA All Rights Reserved. 2012/11/9 2
  • 3. オプションは、これだけ !! ‐Xms6g ‐Xmx6g ‐XX:+UseG1GC ‐XX:MaxGCPauseMillis=200 © 2012 EIICHI KIMURA All Rights Reserved. 2012/11/9 3
  • 4. これらのオプションはダメ !! ‐Xmn ‐XX:MaxNewSize ‐XX:NewSize ‐XX:NewRatio ‐XX:SurvivorRatio Young 領域は目標達成のために自動的に調整される (ヒープ全体の20%~80%の範囲で) © 2012 EIICHI KIMURA All Rights Reserved. 2012/11/9 4
  • 5. Young 領域サイズを指定をすると … Young 領域のサイズを自動調整しない 一時停止時間の目標設定は無視する 私のほうが Java VM より 上手くチューニングできる !! 宣言 !! © 2012 EIICHI KIMURA All Rights Reserved. 2012/11/9 5
  • 6. G1GC の動作状況を分析するには ログ出力用 [‐verbosegc | ‐XLoggc:<gc.log>] ‐XX:+PrintGC ‐XX:+PrintGCTimeStamps ‐XX:+PrintGCDateStamps ‐XX:+PrintGCDetails ‐XX:+PrintAdaptiveSizePolicy ‐XX:+UnlockExperimentalVMOptions –XX:G1LogLevel=[fine | finer | finest] チューニング用 ‐XX:InitiatingHeapOccupancyPercent=<percent> ‐XX:G1OldCSetRegionLiveThresholdPercent=<percent> ‐XX:G1MixedGCCountTarget=<N> ‐XX:G1HeapWastePercent=<N> (http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html) © 2012 EIICHI KIMURA All Rights Reserved. 2012/11/9 6
  • 7. でも使えるのは、これだけ ログ出力用 [‐verbosegc | ‐XLoggc:<gc.log>] ‐XX:+PrintGC ‐XX:+PrintGCTimeStamps ‐XX:+PrintGCDateStamps ‐XX:+PrintGCDetails ‐XX:+PrintAdaptiveSizePolicy ‐XX:+UnlockExperimentalVMOptions –XX:G1LogLevel=[fine | finer | finest] チューニング用 ‐XX:InitiatingHeapOccupancyPercent=<percent> ‐XX:G1OldCSetRegionLiveThresholdPercent=<percent> ‐XX:G1MixedGCCountTarget=<N> ‐XX:G1HeapWastePercent=<N> (http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html) © 2012 EIICHI KIMURA All Rights Reserved. 2012/11/9 7
  • 8. G1GC のサイクル Initial Mark – STW Root Region Scanning – Concurrent Concurrent Marking – Concurrent Remark – STW Cleanup – STW + Concurrent Copying(Young GC/Mixed GC) - STW 8 © 2012 EIICHI KIMURA All Rights Reserved. 2012/11/9
  • 9. Mark Phase Copy phase Young mode Mark /Remark Phase Cleanup Phase Copy Phase 高 高 高 高 高 高 高 高 高 Mixed mode 高 高 高 高 高 高 高 低 高 低 高 高 高 低 低 高 高 低 低 高 高 高 低 高 低 高 低 Non-Allocated Eden Survivor Old Recently copied in Survivor Recently copied in Old © 2012 EIICHI KIMURA All Rights Reserved. 2012/11/9 9
  • 10. こんな GC ログ、読むのは大変 {Heap before GC invocations=0 (full 0): garbage-first heap total 16384K, used 5120K [0x03600000, 0x04600000, 0x05a00000) region size 1024K, 5 young (5120K), 0 survivors (0K) compacting perm gen total 12288K, used 6053K [0x05a00000, 0x06600000, 0x09a00000) the space 12288K, 49% used [0x05a00000, 0x05fe9478, 0x05fe9600, 0x06600000) No shared spaces configured. 2012-08-22T16:37:32.445+0900: G1HR #StartGC 1 0.911: [GC pause (young) Desired survivor size 524288 bytes, new threshold 15 (max 15) 0.911: [G1Ergonomics (CSet Construction) start choosing CSet, predicted base time: 83.70 ms, remaining time: 116.30 ms, target pause time: 200.00 ms] 0.911: [G1Ergonomics (CSet Construction) add young regions to CSet, eden: 5 regions, survivors: 0 regions, predicted young region time: 127.33 ms] 0.911: [G1Ergonomics (CSet Construction) finish choosing CSet, eden: 5 regions, survivors: 0 regions, old: 0 regions, predicted pause time: 211.03 ms, target pause time: 200.00 ms] G1HR CSET 0x03a00000 : G1HR ALLOC(Survivor) 0x03b00000 G1HR ALLOC(Old) 0x03c00000 G1HR RETIRE 0x03c00000 0x03ccee20, 0.01186911 secs] [Parallel Time: 11.0 ms] [GC Worker Start (ms): 911.1 911.1 911.1 911.1 Avg: 911.1, Min: 911.1, Max: 911.1, Diff: 0.0] [Ext Root Scanning (ms): 2.6 3.5 3.6 4.6 Avg: 3.6, Min: 2.6, Max: 4.6, Diff: 2.0] [Update RS (ms): 0.0 0.1 0.0 0.0 Avg: 0.0, Min: 0.0, Max: 0.1, Diff: 0.1] [Processed Buffers : 0 14 0 0 Sum: 14, Avg: 3, Min: 0, Max: 14, Diff: 14] [Scan RS (ms): 0.0 0.0 0.0 0.0 Avg: 0.0, Min: 0.0, Max: 0.0, Diff: 0.0] [Object Copy (ms): 8.2 7.0 7.0 6.0 Avg: 7.1, Min: 6.0, Max: 8.2, Diff: 2.2] [Termination (ms): 0.0 0.0 0.0 0.0 Avg: 0.0, Min: 0.0, Max: 0.0, Diff: 0.0] [Termination Attempts : 2 2 1 1 Sum: 6, Avg: 1, Min: 1, Max: 2, Diff: 1] [GC Worker End (ms): 921.9 921.9 921.9 921.9 Avg: 921.9, Min: 921.9, Max: 921.9, Diff: 0.0] [GC Worker (ms): 10.9 10.9 10.9 10.8 Avg: 10.9, Min: 10.8, Max: 10.9, Diff: 0.0] [GC Worker Other (ms): 0.2 0.3 0.3 0.3 Avg: 0.3, Min: 0.2, Max: 0.3, Diff: 0.2] [Clear CT: 0.1 ms] [Other: 0.7 ms] [Choose CSet: 0.0 ms] [Ref Proc: 0.5 ms] © 2012 EIICHI KIMURA All Rights Reserved. 2012/11/9 10
  • 11. そこで – JavaOne 2012 になかったネタ G1GC ログの可視化したい © 2012 EIICHI KIMURA All Rights Reserved. 2012/11/9 11
  • 12. 本セッションの内容は、 Fin. http://www.myexpospace.com/JavaOne2012/SessionFiles/CON6583_PDF_65 83_0001.pdf © 2012 EIICHI KIMURA All Rights Reserved. 2012/11/9 12