My app is constantly running Full GC!

后端 未结 3 1549
清酒与你
清酒与你 2021-02-06 06:51

I am a newbie at performance tuning applications and figuring out the workings of GC so probably asking the same question a millionth time!

The problem is that 2 - 3 wee

相关标签:
3条回答
  • 2021-02-06 07:14
    Somewhere your code is creating temporary objects in an memory- less environment.
    Please look at your code (HibernateCommentaryDao.java) 
    
    it is something with n+1 fetch
    

    Excessive GC Time and OutOfMemoryError

    The parallel collector will throw an OutOfMemoryError if too much time is being spent in garbage collection: if more than 98% of the total time is spent in garbage collection and less than 2% of the heap is recovered, an OutOfMemoryError will be thrown. This feature is designed to prevent applications from running for an extended period of time while making little or no progress because the heap is too small. If necessary, this feature can be disabled by adding the option -XX:-UseGCOverheadLimit to the command line

    0 讨论(0)
  • 2021-02-06 07:25

    Eclipse features a great tool called Memory Analyzer. It can analyze exactly those heap dumps you generate on OOM. It draws pretty good charts to help you narrow where the bulk of your memory consumption is - your app, jboss, other parts of your setup - down to a very fine level.

    If you paste its output here we could continue to investigate your problem.

    0 讨论(0)
  • 2021-02-06 07:29

    Running with 4GB RAM and using -Xmx1024m (maximum amount of java heap 1024M) might not be intentional.

    On the other hand, it looks to me your query is returning too many results either because of the joins or using null limit, which turns into an oversized list.

    You could start by taking a heap snapshot in the middle of GCs with

    # jmap -dump:format=b,file=dump.hprof <pid>
    

    And then using the aforementioned Memory Analyzer.

    0 讨论(0)
提交回复
热议问题