Closed dasilvj closed 1 year ago
please try with -Xgc:enableArrayletDoubleMapping
please try with -Xgc:enableArrayletDoubleMapping
I just tried it, and unfortunately it doesn't seem to help )-:
The option only affects behavior on Linux. Is that where you tried?
The option only affects behavior on Linux. Is that where you tried?
Yes, I tried it on CentOS Linux (release 7.9.2009), as the option wasn't even known on Windows (-; I am sure you can easily reproduce the issue locally using the dummy main that I provided.
OK, thanks for quick responses and providing test code. We'll investigate this (cannot promise about the priority) .
Sorry, busy, have not tried the test yet, but another thing to quickly check what's glibc version on that Linux system. Double mapping works on 2.27 onwards. Also, Verbose GC will report if enabling double mapping really succeeded in VGC initialize block.
Thanks for the info! I quickly checked and the CentOS Linux where I made the test with the double mapping was using the GLIBC 2.17 (so it was probably not enabled properly). I unfortunately don't have much more time to make more tests, I simply removed the usage of gzip for now to workaround the issue.
From JVM point of view, we don't have a short term workaround for this (inefficiency when Java using natives for processing of large arrays), either (other than as already said for newer Linux disros)
Long term (some time next year) we do work on a major redesigned, that will remove this limitation in Balanced GC, for all platforms that we support.
Isn't there a possible workaround involving increasing the region size?
yes, increasing the region size bigger than zip size could avoid to using arraylet for accessing the zip, then preventing "copy" during calling jniCriticals, please try below the java options, see if it would help.
-Xgcpolicy:balanced -Xmx4G -Xms4G -Xgc:regionSize=67108864 -XXgc:tarokNurseryMaxAge=1 -XXgc:tarokRegionMaxAge=2
Balanced with -Xgc:enableArrayletDoubleMapping
has been tested and it actually helps:
> lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.5 LTS
Release: 18.04
Codename: bionic
> ldd --version
ldd (Ubuntu GLIBC 2.27-3ubuntu1.4) 2.27
> ./jdk-17.0.5+8/bin/java -Xmx5g -Xgcpolicy:balanced -Xgc:enableArrayletDoubleMapping TestOpenJ9GCBalancedGZipOutputStreamIssue
Write GZIP file '/tmp/TestOpenJ9GCBalancedGZipOutputStreamIssue4614104854497781635' with '10000' values
BEGIN_WRITE [dataBytesLen='488890']
END_WRITE [durationInMillis='7']
Deleted '/tmp/TestOpenJ9GCBalancedGZipOutputStreamIssue4614104854497781635'
Write GZIP file '/tmp/TestOpenJ9GCBalancedGZipOutputStreamIssue11218347477169836263' with '100000' values
BEGIN_WRITE [dataBytesLen='4988890']
END_WRITE [durationInMillis='44']
Deleted '/tmp/TestOpenJ9GCBalancedGZipOutputStreamIssue11218347477169836263'
Write GZIP file '/tmp/TestOpenJ9GCBalancedGZipOutputStreamIssue13860107713856738643' with '1000000' values
BEGIN_WRITE [dataBytesLen='50888890']
END_WRITE [durationInMillis='394']
Deleted '/tmp/TestOpenJ9GCBalancedGZipOutputStreamIssue13860107713856738643'
Write GZIP file '/tmp/TestOpenJ9GCBalancedGZipOutputStreamIssue9298862989241367693' with '10000000' values
BEGIN_WRITE [dataBytesLen='518888890']
END_WRITE [durationInMillis='3871']
Deleted '/tmp/TestOpenJ9GCBalancedGZipOutputStreamIssue9298862989241367693'
This known problem is going to be addressed with new feature https://github.com/eclipse-openj9/openj9/issues/14005 scheduled to be delivered in 2023. Meanwhile -Xgc:enableArrayletDoubleMapping
can be used as workaround (Linux glibc version 2.27+ only)
The write of a 50MB gzip file using
java.util.zip.GZIPOutputStream
takes less than a second using the default GC policy. Using the balanced GC policy (-Xgcpolicy:balanced
), it takes a few minutes.Issue spotted using the following versions on Windows & Linux:
Reproducible with the following Java main:
Default GC main output
Balanced GC main output