JDK-8297639 : Remove preventive GCs in G1
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 21
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-11-25
  • Updated: 2023-11-13
  • Resolved: 2022-12-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 21
21 b02Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
After obsoleting it in JDK20, remove the functionality for the next release (i.e. JDK 21). No good application for it has been found, and investing more time in fixing it seems too much work for too little gain.
Comments
The disabling and subsequent removal of preventive GC has caused issues for Elasticsearch, when running with JDK 20 and 21. The particular scenario that encounters problems is one where hundreds of documents are retrieved from a search, each with a large(ish) 4MB size. These documents comprise a ~400 MB pytorch model being transfered from a data node to an ML (Machine Learning) node. The pytorch model is chunked and stored in separate documents that are retrieved one at a time by the ML node. When repeatedly allocating these large arrays, we see memory pressure distinctly increase in JDK 20.0.1. For JDK 20.x we set -XX:+G1UsePreventiveGC. For JDK 21, since no such flag is available, we obviously do not set it, but the behaviour is slightly better ( GC exhibit's slightly better behaviour, but not as good as JDK 20 with the aforementioned flag ). Elasticsearch endeavours to workaround this issue, by 1) reducing the size of the chunks to say 1MB, and 2) reusing the memory backed by the arrays for subsequent chunks. See https://github.com/elastic/elasticsearch/issues/99592 for further details. ( there are many other related issues with Elasticsearch, but this one is the most relevant and coherent ).
13-11-2023

Changeset: 8ff2928a Author: Thomas Schatzl <tschatzl@openjdk.org> Date: 2022-12-14 17:55:15 +0000 URL: https://git.openjdk.org/jdk/commit/8ff2928a04aeec8c09ff4a1ec4e83d4c9010950e
14-12-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/11654 Date: 2022-12-13 16:29:59 +0000
13-12-2022