SlideShare a Scribd company logo
1 of 29
bluedavy
2012-03
   Java Runtime Data Area

                 -Xss

              Local Vars     Native method Stack
               Operator                         -XX:PermSize –
       PC                   Method Area        XX:MaxPermSize
              Stack Frame

            Method Stack       Heap           -Xms -Xmx
   Oracle JDK Java Heap

      -Xmn   New Generation

         Eden               S0      S1   Old Generation
                -XX:SurvivorRatio
   Oracle JDK startup options for memory manage
     -Xms –Xmx –Xmn –XX:PermSize –XX:MaxPermSize
     -XX:SurvivorRatio
     -XX:+UseParallelGC || -XX:+UseParallelOldGC
      ▪ -XX:MaxTenuringThreshold -XX:ParallelGCThreads
      ▪ -XX:-UseAdaptiveSizePolicy
     -XX:+UseConcMarkSweepGC
      ▪ -XX:CMSInitiatingOccupancyFraction -
        XX:+UseCMSInitiatingOccupancyOnly
     -XX:+DisableExplicitGC –
     XX:+ExplicitGCInvokesConcurrent
   Startup options or tools for memory problem solution
       -XX:+PrintGCDateStamps –XX:+PrintGCDetails -Xloggc
       -XX:+HeapDumpOnOutOfMemoryError
       -XX:+HeapDumpBeforeFullGC
       -XX:+PrintFlagsFinal(JDK 6u21+)
       for CMS GC
        ▪ -XX:+PrintPromotionFailure -XX:+CMSDumpAtPromotionFailure
       jinfo
       jstat
       jmap
       MAT
       btrace
       google perf-tools
   OOM
     java.lang.OutOfMemoryError: {$reason}
   Full GC Frequently
   CMS GC
     promotion failed
     concurrent mode failure
-Xms4g –Xmx4g –Xmn2560m
Then to find who use Deflater.init
   java.lang.OutOfMemoryError: {$reason}
     GC overhead limit exceeded
     Java Heap Space
     Unable to create new native thread
     PermGen Space
     Direct buffer memory
     request {} bytes for {}. Out of swap space?
   GC overhead limit exceeded
    Java Heap Space
     if code didn’t catch OutOfMemoryError,thread
      will exit;
     slow response or no response at all
      ▪ because gc did frequently


   Out of Swap
     Java process crash
   GC overhead limit exceeded
    Java Heap Space
     monitor app log & gc log
     heap dump or jmap –histo|-dump when oom
     mat analyze heap dump
     app developer or btrace to find where cause
   Out of swap
     crash log
     google-perftools
     then btrace to find where cause


     ps: maybe u can try delete -XX:+DisableExplicitGC
     if exist,reason can be found in this link。
   use ThreadLocal carefully;
   limit Collection/StringBuilder etc. size;
   limit batch ops size;
   limit the data size return by database;
   avoid infinite loop;
   OOM
     java.lang.OutOfMemoryError: {$reason}
   Full GC Frequently
   CMS GC
     promotion failed
     concurrent mode failure
   Most Cases
     because memory consumes too much
   a special case
     a special frequently GC Case
   slow response or no response at all
   According gc log to see if the reason is
    consuming too much memory
     if yes then add -XX:+HeapDumpBeforeFullGC or
      write a shell file to dump memory when full gc;
     if no then use pstack & source code to see why full
      gc executes;
   OOM
     java.lang.OutOfMemoryError: {$reason}
   Full GC Frequently
   CMS GC
     promotion failed
     concurrent mode failure
   promotion failed Case I
     363439.937: [Full GC 363439.938: [ParNew
      (promotion failed): 523840K->523840K(523840K),
      0.3404490 secs] 1690606K->1712399K(1834560K),
      0.3412880 secs]
     Taobao JDK help to find the reason
      ▪ ==WARNNING== allocating large array: thread_id[0x00002aaac2d85800],
        thread_name[ajp-0.0.0.0-8009-48], array_size[782611408 bytes],
        array_length[195652847 elememts]
   promotion failed Case II
     1768.432: [GC 1768.432: [ParNew (promotion
      failed): 1572827K->1572827K(1572864K),
      0.2845480 secs]
     1972.208: [CMS: 10545160K-
      >5853155K(14680064K), 8.5355320 secs]
      12105682K->5853155K(16252928K), [CMS Perm :
      20907K->20873K(34952K)], 212.3113910 secs]
      [Times: user=53.38 sys=22.45, real=212.28 secs]
     because cms gc fragmention
   four cases
     promotion failed case III
      ▪ because CMSInitiatingOccupancyFraction too high...
     concurrent mode failure case I
      ▪ because CMSInitiatingOccupancyFraction too high...
     concurrent mode failure case II
      ▪ because old gen is too small
     concurrent mode failure case III
      ▪ because permgen
   CMS GC problem will cause serial full gc,so
    the app response time will be very slow...
   According gc log to see if the reason is
    because CMSInitiatingOccupancyFraction is
    too high,if yes then adjust the option;
   if no,then
     promotion failed
      ▪ if because memory ran out,then dump memory;
      ▪ if because cms gc fragmention,currently we only can do
        is execute jmap –histo:live at regular time;
     concurrent mode failure
      ▪ the same as promotion failed...
   OOM
     java.lang.OutOfMemoryError: {$reason}
   Full GC频繁
   CMS GC
     promotion failed
     concurrent mode failure
   Young GC slow
   CMS GC Concurrent-Mark causes app stop...
   ...

More Related Content

What's hot

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
 
NoSQL 동향
NoSQL 동향NoSQL 동향
NoSQL 동향
NAVER D2
 

What's hot (20)

Pick diamonds from garbage
Pick diamonds from garbagePick diamonds from garbage
Pick diamonds from garbage
 
Shared Memory Performance: Beyond TCP/IP with Ben Cotton, JPMorgan
Shared Memory Performance: Beyond TCP/IP with Ben Cotton, JPMorganShared Memory Performance: Beyond TCP/IP with Ben Cotton, JPMorgan
Shared Memory Performance: Beyond TCP/IP with Ben Cotton, JPMorgan
 
Am I reading GC logs Correctly?
Am I reading GC logs Correctly?Am I reading GC logs Correctly?
Am I reading GC logs Correctly?
 
NoSQL 동향
NoSQL 동향NoSQL 동향
NoSQL 동향
 
7 jvm-arguments-v1
7 jvm-arguments-v17 jvm-arguments-v1
7 jvm-arguments-v1
 
Java 어플리케이션 성능튜닝 Part1
Java 어플리케이션 성능튜닝 Part1Java 어플리케이션 성능튜닝 Part1
Java 어플리케이션 성능튜닝 Part1
 
Jvm problem diagnostics
Jvm problem diagnosticsJvm problem diagnostics
Jvm problem diagnostics
 
Thanos - Prometheus on Scale
Thanos - Prometheus on ScaleThanos - Prometheus on Scale
Thanos - Prometheus on Scale
 
7 jvm-arguments-Confoo
7 jvm-arguments-Confoo7 jvm-arguments-Confoo
7 jvm-arguments-Confoo
 
Shenandoah GC: Java Without The Garbage Collection Hiccups (Christine Flood)
Shenandoah GC: Java Without The Garbage Collection Hiccups (Christine Flood)Shenandoah GC: Java Without The Garbage Collection Hiccups (Christine Flood)
Shenandoah GC: Java Without The Garbage Collection Hiccups (Christine Flood)
 
Redis ndc2013
Redis ndc2013Redis ndc2013
Redis ndc2013
 
9.4 the hard way
9.4 the hard way9.4 the hard way
9.4 the hard way
 
Jvm & Garbage collection tuning for low latencies application
Jvm & Garbage collection tuning for low latencies applicationJvm & Garbage collection tuning for low latencies application
Jvm & Garbage collection tuning for low latencies application
 
Become a Garbage Collection Hero
Become a Garbage Collection HeroBecome a Garbage Collection Hero
Become a Garbage Collection Hero
 
Cram
CramCram
Cram
 
JVM Tuning and Profiling
JVM Tuning and ProfilingJVM Tuning and Profiling
JVM Tuning and Profiling
 
7 Ways To Crash Postgres
7 Ways To Crash Postgres7 Ways To Crash Postgres
7 Ways To Crash Postgres
 
Exactly once with spark streaming
Exactly once with spark streamingExactly once with spark streaming
Exactly once with spark streaming
 
Как построить видеоплатформу на 200 Гбитс / Ольховченков Вячеслав (Integros)
Как построить видеоплатформу на 200 Гбитс / Ольховченков Вячеслав (Integros)Как построить видеоплатформу на 200 Гбитс / Ольховченков Вячеслав (Integros)
Как построить видеоплатформу на 200 Гбитс / Ольховченков Вячеслав (Integros)
 
Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.
 

Viewers also liked

Viewers also liked (19)

VMIL keynote : Lessons from a production JVM runtime developer
VMIL keynote : Lessons from a production JVM runtime developerVMIL keynote : Lessons from a production JVM runtime developer
VMIL keynote : Lessons from a production JVM runtime developer
 
账务系统设计及应用
账务系统设计及应用账务系统设计及应用
账务系统设计及应用
 
Git 实战
Git 实战Git 实战
Git 实战
 
高性能的Java代码编写及常见问题排查
高性能的Java代码编写及常见问题排查高性能的Java代码编写及常见问题排查
高性能的Java代码编写及常见问题排查
 
C1000K高性能服务器构建技术
C1000K高性能服务器构建技术C1000K高性能服务器构建技术
C1000K高性能服务器构建技术
 
Implementing a JavaScript Engine
Implementing a JavaScript EngineImplementing a JavaScript Engine
Implementing a JavaScript Engine
 
Java常见问题排查
Java常见问题排查Java常见问题排查
Java常见问题排查
 
线上问题排查交流
线上问题排查交流线上问题排查交流
线上问题排查交流
 
沒有 GUI 的 Git
沒有 GUI 的 Git沒有 GUI 的 Git
沒有 GUI 的 Git
 
Strata Beijing - Deep Learning in Production on Spark
Strata Beijing - Deep Learning in Production on SparkStrata Beijing - Deep Learning in Production on Spark
Strata Beijing - Deep Learning in Production on Spark
 
美团点评技术沙龙14:美团四层负载均衡
美团点评技术沙龙14:美团四层负载均衡美团点评技术沙龙14:美团四层负载均衡
美团点评技术沙龙14:美团四层负载均衡
 
如何针对业务做DB优化
如何针对业务做DB优化如何针对业务做DB优化
如何针对业务做DB优化
 
程序猿都该知道的MySQL秘籍
程序猿都该知道的MySQL秘籍程序猿都该知道的MySQL秘籍
程序猿都该知道的MySQL秘籍
 
寫給大家的 Git 教學
寫給大家的 Git 教學寫給大家的 Git 教學
寫給大家的 Git 教學
 
MySQL技术分享:一步到位实现mysql优化
MySQL技术分享:一步到位实现mysql优化MySQL技术分享:一步到位实现mysql优化
MySQL技术分享:一步到位实现mysql优化
 
20120613联动优势数据访问层DAL架构和实践4(刘胜)最新特性
20120613联动优势数据访问层DAL架构和实践4(刘胜)最新特性20120613联动优势数据访问层DAL架构和实践4(刘胜)最新特性
20120613联动优势数据访问层DAL架构和实践4(刘胜)最新特性
 
2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare
 
What to Upload to SlideShare
What to Upload to SlideShareWhat to Upload to SlideShare
What to Upload to SlideShare
 
Getting Started With SlideShare
Getting Started With SlideShareGetting Started With SlideShare
Getting Started With SlideShare
 

Similar to Java memory problem cases solutions

Similar to Java memory problem cases solutions (20)

JVM memory management & Diagnostics
JVM memory management & DiagnosticsJVM memory management & Diagnostics
JVM memory management & Diagnostics
 
Mastering java in containers - MadridJUG
Mastering java in containers - MadridJUGMastering java in containers - MadridJUG
Mastering java in containers - MadridJUG
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
Performance tuning jvm
Performance tuning jvmPerformance tuning jvm
Performance tuning jvm
 
7-JVM-arguments-JaxLondon-2023.pptx
7-JVM-arguments-JaxLondon-2023.pptx7-JVM-arguments-JaxLondon-2023.pptx
7-JVM-arguments-JaxLondon-2023.pptx
 
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
 
16 artifacts to capture when there is a production problem
16 artifacts to capture when there is a production problem16 artifacts to capture when there is a production problem
16 artifacts to capture when there is a production problem
 
Gc algorithms
Gc algorithmsGc algorithms
Gc algorithms
 
QCon 2017 - Java/JVM com Docker em produção: lições das trincheiras
QCon 2017 - Java/JVM com Docker em produção: lições das trincheirasQCon 2017 - Java/JVM com Docker em produção: lições das trincheiras
QCon 2017 - Java/JVM com Docker em produção: lições das trincheiras
 
Cold fusion is racecar fast
Cold fusion is racecar fastCold fusion is racecar fast
Cold fusion is racecar fast
 
Garbage collection in JVM
Garbage collection in JVMGarbage collection in JVM
Garbage collection in JVM
 
Jvm gc那点事
Jvm gc那点事Jvm gc那点事
Jvm gc那点事
 
millions-gc-jax-2022.pptx
millions-gc-jax-2022.pptxmillions-gc-jax-2022.pptx
millions-gc-jax-2022.pptx
 
Elastic JVM for Scalable Java EE Applications Running in Containers #Jakart...
Elastic JVM  for Scalable Java EE Applications  Running in Containers #Jakart...Elastic JVM  for Scalable Java EE Applications  Running in Containers #Jakart...
Elastic JVM for Scalable Java EE Applications Running in Containers #Jakart...
 
Troubleshooting Memory Problems in Java Applications
Troubleshooting Memory Problems in Java ApplicationsTroubleshooting Memory Problems in Java Applications
Troubleshooting Memory Problems in Java Applications
 
Garbage collection in JVM
Garbage collection in JVMGarbage collection in JVM
Garbage collection in JVM
 
this-is-garbage-talk-2022.pptx
this-is-garbage-talk-2022.pptxthis-is-garbage-talk-2022.pptx
this-is-garbage-talk-2022.pptx
 
Inside the JVM - Performance & Garbage Collector Tuning in JAVA
Inside the JVM - Performance & Garbage Collector Tuning in JAVA Inside the JVM - Performance & Garbage Collector Tuning in JAVA
Inside the JVM - Performance & Garbage Collector Tuning in JAVA
 
jvm goes to big data
jvm goes to big datajvm goes to big data
jvm goes to big data
 
Living with garbage
Living with garbageLiving with garbage
Living with garbage
 

More from bluedavy lin (9)

Java内存管理问题案例分享
Java内存管理问题案例分享Java内存管理问题案例分享
Java内存管理问题案例分享
 
HBase@taobao for 技术沙龙
HBase@taobao for 技术沙龙HBase@taobao for 技术沙龙
HBase@taobao for 技术沙龙
 
Hbase简介与实践分享
Hbase简介与实践分享Hbase简介与实践分享
Hbase简介与实践分享
 
菜鸟看Hbase
菜鸟看Hbase菜鸟看Hbase
菜鸟看Hbase
 
Sun JDK 1.6内存管理 -调优篇
Sun JDK 1.6内存管理 -调优篇Sun JDK 1.6内存管理 -调优篇
Sun JDK 1.6内存管理 -调优篇
 
Sun jdk 1.6内存管理 -使用篇
Sun jdk 1.6内存管理 -使用篇Sun jdk 1.6内存管理 -使用篇
Sun jdk 1.6内存管理 -使用篇
 
Sun jdk 1.6 gc
Sun jdk 1.6 gcSun jdk 1.6 gc
Sun jdk 1.6 gc
 
并发编程交流
并发编程交流并发编程交流
并发编程交流
 
OSGi理论与实战
OSGi理论与实战OSGi理论与实战
OSGi理论与实战
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Java memory problem cases solutions

  • 2. Java Runtime Data Area -Xss Local Vars Native method Stack Operator -XX:PermSize – PC Method Area XX:MaxPermSize Stack Frame Method Stack Heap -Xms -Xmx
  • 3. Oracle JDK Java Heap -Xmn New Generation Eden S0 S1 Old Generation -XX:SurvivorRatio
  • 4. Oracle JDK startup options for memory manage  -Xms –Xmx –Xmn –XX:PermSize –XX:MaxPermSize  -XX:SurvivorRatio  -XX:+UseParallelGC || -XX:+UseParallelOldGC ▪ -XX:MaxTenuringThreshold -XX:ParallelGCThreads ▪ -XX:-UseAdaptiveSizePolicy  -XX:+UseConcMarkSweepGC ▪ -XX:CMSInitiatingOccupancyFraction - XX:+UseCMSInitiatingOccupancyOnly  -XX:+DisableExplicitGC – XX:+ExplicitGCInvokesConcurrent
  • 5. Startup options or tools for memory problem solution  -XX:+PrintGCDateStamps –XX:+PrintGCDetails -Xloggc  -XX:+HeapDumpOnOutOfMemoryError  -XX:+HeapDumpBeforeFullGC  -XX:+PrintFlagsFinal(JDK 6u21+)  for CMS GC ▪ -XX:+PrintPromotionFailure -XX:+CMSDumpAtPromotionFailure  jinfo  jstat  jmap  MAT  btrace  google perf-tools
  • 6. OOM  java.lang.OutOfMemoryError: {$reason}  Full GC Frequently  CMS GC  promotion failed  concurrent mode failure
  • 7.
  • 8.
  • 10.
  • 11.
  • 12. Then to find who use Deflater.init
  • 13. java.lang.OutOfMemoryError: {$reason}  GC overhead limit exceeded  Java Heap Space  Unable to create new native thread  PermGen Space  Direct buffer memory  request {} bytes for {}. Out of swap space?
  • 14. GC overhead limit exceeded Java Heap Space  if code didn’t catch OutOfMemoryError,thread will exit;  slow response or no response at all ▪ because gc did frequently  Out of Swap  Java process crash
  • 15. GC overhead limit exceeded Java Heap Space  monitor app log & gc log  heap dump or jmap –histo|-dump when oom  mat analyze heap dump  app developer or btrace to find where cause
  • 16. Out of swap  crash log  google-perftools  then btrace to find where cause  ps: maybe u can try delete -XX:+DisableExplicitGC if exist,reason can be found in this link。
  • 17. use ThreadLocal carefully;  limit Collection/StringBuilder etc. size;  limit batch ops size;  limit the data size return by database;  avoid infinite loop;
  • 18. OOM  java.lang.OutOfMemoryError: {$reason}  Full GC Frequently  CMS GC  promotion failed  concurrent mode failure
  • 19. Most Cases  because memory consumes too much  a special case  a special frequently GC Case
  • 20. slow response or no response at all
  • 21. According gc log to see if the reason is consuming too much memory  if yes then add -XX:+HeapDumpBeforeFullGC or write a shell file to dump memory when full gc;  if no then use pstack & source code to see why full gc executes;
  • 22. OOM  java.lang.OutOfMemoryError: {$reason}  Full GC Frequently  CMS GC  promotion failed  concurrent mode failure
  • 23. promotion failed Case I  363439.937: [Full GC 363439.938: [ParNew (promotion failed): 523840K->523840K(523840K), 0.3404490 secs] 1690606K->1712399K(1834560K), 0.3412880 secs]  Taobao JDK help to find the reason ▪ ==WARNNING== allocating large array: thread_id[0x00002aaac2d85800], thread_name[ajp-0.0.0.0-8009-48], array_size[782611408 bytes], array_length[195652847 elememts]
  • 24. promotion failed Case II  1768.432: [GC 1768.432: [ParNew (promotion failed): 1572827K->1572827K(1572864K), 0.2845480 secs]  1972.208: [CMS: 10545160K- >5853155K(14680064K), 8.5355320 secs] 12105682K->5853155K(16252928K), [CMS Perm : 20907K->20873K(34952K)], 212.3113910 secs] [Times: user=53.38 sys=22.45, real=212.28 secs]  because cms gc fragmention
  • 25. four cases  promotion failed case III ▪ because CMSInitiatingOccupancyFraction too high...  concurrent mode failure case I ▪ because CMSInitiatingOccupancyFraction too high...  concurrent mode failure case II ▪ because old gen is too small  concurrent mode failure case III ▪ because permgen
  • 26. CMS GC problem will cause serial full gc,so the app response time will be very slow...
  • 27. According gc log to see if the reason is because CMSInitiatingOccupancyFraction is too high,if yes then adjust the option;  if no,then  promotion failed ▪ if because memory ran out,then dump memory; ▪ if because cms gc fragmention,currently we only can do is execute jmap –histo:live at regular time;  concurrent mode failure ▪ the same as promotion failed...
  • 28. OOM  java.lang.OutOfMemoryError: {$reason}  Full GC频繁  CMS GC  promotion failed  concurrent mode failure
  • 29. Young GC slow  CMS GC Concurrent-Mark causes app stop...  ...