Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8014364

SoftReference clearing needs to improve when memory is constrained

    Details

    • Subcomponent:
      gc
    • CPU:
      generic
    • OS:
      generic

      Description

      HotSpot has issues with memory pressure when using fully-expanded heaps and lots of soft references.

      Assume we have a 10GB heap (Xms == Xmx). With a default NewRatio, we'll have a 6.6 GB old gen and a 3.3 GB new gen. After a full GC, we might end up with old gen containing 6.5GB. The next young collection will promote more than .1GB, causing yet another full GC. Just enough gets cleared to handle the promotion from young gen, but old gen still 6.5 GB or so filled. So the next young gen collection will still cause a full GC to handle the promoted objects. And so on...performance will be terrible because we do a full GC every time the young gen fills up.

      When LRUMaxHeapPolicy::setup calculates the interval used to determine if a softreference should be free, it uses the MaxHeap (10GB) - the amount of used space at the last GC (6.5 GB). So the free space is calculated to be 3.5GB (3.333 from young gen, .1 from old gen). No soft reference that has been touched in the last 3500 seconds -- almost a full hour -- will be eligible to be collected, despite that fact that we are really severely constrained for memory.

      This can be tuned a little bit by aggressively setting SoftRefLRUPolicyMSPerMB, though there is such a large amount of free MB from the young generation that we effectively end up turning off softref caching. plus it is quite awkward to tune an obscure setting like that for a common case; when we are constrained for memory, we should do something to discard more aggressively. One simple thought is to calculate the free space based on the size of the OldGen in this case.

        Activity

        Hide
        brutisso Bengt Rutisson (Inactive) added a comment -
        Making this an enhancement rather than a bug.
        Show
        brutisso Bengt Rutisson (Inactive) added a comment - Making this an enhancement rather than a bug.
        Hide
        pssu Paul Su added a comment -
        Deferral justification: A global change to the soft reference handling policy, which would affect all Hotspot users, cannot be developed and tested before the 7u40 deadline. Settings for a flag to increase performance has been proposed by the Java performance team for the 7u40 release.
        Show
        pssu Paul Su added a comment - Deferral justification: A global change to the soft reference handling policy, which would affect all Hotspot users, cannot be developed and tested before the 7u40 deadline. Settings for a flag to increase performance has been proposed by the Java performance team for the 7u40 release.
        Hide
        idergali Ilya Dergalin added a comment -
        SQE ok to defer from 7u40. This was escalated by other oracle team to be fixed in 7u40. RT needs to make sure that escalation is properly addresses.
        Show
        idergali Ilya Dergalin added a comment - SQE ok to defer from 7u40. This was escalated by other oracle team to be fixed in 7u40. RT needs to make sure that escalation is properly addresses.
        Hide
        prhenry Penni Henry (Inactive) added a comment -
        Paul S - Have you reached out to Alexei yet? I don't want to approve this deferral until there is communication and ideally agreement to the deferral - hopefully some kind of a workaround that they can live with.
        Show
        prhenry Penni Henry (Inactive) added a comment - Paul S - Have you reached out to Alexei yet? I don't want to approve this deferral until there is communication and ideally agreement to the deferral - hopefully some kind of a workaround that they can live with.
        Hide
        pssu Paul Su added a comment -
        I've notified Alexei that we are deferring the issue.
        Show
        pssu Paul Su added a comment - I've notified Alexei that we are deferring the issue.
        Hide
        prhenry Penni Henry (Inactive) added a comment -
        Feeback from Bob Carina on 07/10 - We have measured our performance and scalability with JDK 7 with the optimization options set as you recommended. The negative impact from 16561819 is still significant to our scalability. We would like to wait on the deferral of this bug until we have another round of testing with JDK 7 but if the release timing is bad for a risky fix such as this, it can probably wait until the next JDK update. It will take another 3-5 days to obtain new results on our side and we will keep you updated on our progress. We would appreciate this bug being addressed in the next JDK release as it currently shows up to a 10% degradation when compared to JRockit. Can we plan on that?

        Show
        prhenry Penni Henry (Inactive) added a comment - Feeback from Bob Carina on 07/10 - We have measured our performance and scalability with JDK 7 with the optimization options set as you recommended. The negative impact from 16561819 is still significant to our scalability. We would like to wait on the deferral of this bug until we have another round of testing with JDK 7 but if the release timing is bad for a risky fix such as this, it can probably wait until the next JDK update. It will take another 3-5 days to obtain new results on our side and we will keep you updated on our progress. We would appreciate this bug being addressed in the next JDK release as it currently shows up to a 10% degradation when compared to JRockit. Can we plan on that?
        Hide
        prhenry Penni Henry (Inactive) added a comment -
        Update from Paul Su via email on 07/10:
         I’m ready to defer this issue, although we cannot commit to providing a change to the soft reference policy in the next release. But I’ll work with Bob and Alexei on explaining the case and working out a timeline for investigation.

        Based on this message, SQE-OK, justification and confirmation from FMW - I'm removing the nmi and marking this as defer-approved.
        Show
        prhenry Penni Henry (Inactive) added a comment - Update from Paul Su via email on 07/10:  I’m ready to defer this issue, although we cannot commit to providing a change to the soft reference policy in the next release. But I’ll work with Bob and Alexei on explaining the case and working out a timeline for investigation. Based on this message, SQE-OK, justification and confirmation from FMW - I'm removing the nmi and marking this as defer-approved.

          People

          • Assignee:
            pssu Paul Su
            Reporter:
            soaks Scott Oaks
          • Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

            • Created:
              Updated: