3 Replies Latest reply on Feb 14, 2010 10:16 AM by damianharvey.damianharvey.gmail.com

    Memory Consumption Very high

    rnicholson10

      Hi, I was wondering what is the best way to reduce memory consumption using Seam.


      In our application it appears that pretty much all of the memory is allocated to the Session and the majority of that to HashSet (70%), which leads me to think that the majority of our memory issues are to do with EntityManager. All of our entity mangers use conversation scope.


      With only 10 users on the system we bounce between 60% and 90% percent of available heap where the total heap size is 16GB. I don't think I've ever had an app that's been able to use this much memory!


      Now we do use quite a lot of entities actively (read/write) on a single page but even by my most exaggerated calculations I can't imagine it's more that 100MB a user (and that's a stretch).


      It would be great to hear of some views regarding best practices for memory usage especially in relation to hibernate (which appears to be where a lot of memory usage resides).


      Cheers,


      R.


        • 1. Re: Memory Consumption Very high
          ssamayoagt

          Java applications creates a lot of short lived objects, thats why you see the high heap usage but doesnt means that all is currently referenced, is just garbage.


          Garbage Collector runs only when free memory is needed. And since you have a lot of heap memory GC runs when there is no more free memory for new objects which occurs when heap is almost full: about 16GB.


          Which JVM are using you?

          • 2. Re: Memory Consumption Very high
            You can try to use different algorithm of GC (if you are using JDK5 and above).

            Try using this argument in your App Server:
            -XX:+UseParallelGC
            You can also specify the number of gc threads:
            -XX:ParallelGCThreads=n

            Please bear in mind this is useful when you have more than one processor in your pc/server.
            • 3. Re: Memory Consumption Very high
              damianharvey.damianharvey.gmail.com

              I've noticed the same. Try MessAdmin to look at your Session size.


              I haven't profiled my Session's yet but that is the next step. Would be interesting to know what is being stored as my sessions immediately jump to >70MB when a page using the EntityManager is first hit.


              Cheers,


              D..