-
Bug
-
Resolution: Unresolved
-
P4
-
8, 9
-
x86_64
-
linux
FULL PRODUCT VERSION :
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
ADDITIONAL OS VERSION INFORMATION :
Linux x86_64 GNU/Linux
EXTRA RELEVANT SYSTEM CONFIGURATION :
Amazon ec2 m4.10xlarge
A DESCRIPTION OF THE PROBLEM :
When calling java.util.zip.Deflater#end concurrently from many threads (e.g., 100), we see very poor performance, along with system CPU usage approaching 100%.
This problem seems to occur only on machines with many cores. We've been able to reproduce the problem on Amazon EC2 instances m4.10xlarge and m4.16xlarge (40 and 64 cores, respectively).
The attached code can execute millions of calls per second on a 4 core machine, but struggles to execute thousands per second on a 40 core machine. With a smaller number of threads (e.g., 5) the problem does not occur.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package deflater.test
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicLong;
import java.util.zip.Deflater;
public class DeflaterTest {
static final int NUM_THREADS = 200;
static final AtomicLong counter = new AtomicLong(0);
static final ExecutorService executor = Executors.newFixedThreadPool(NUM_THREADS);
public static void main(String[] args) throws Exception {
for (int i = 0; i < NUM_THREADS; i++) {
executor.submit(() -> {
while (true) {
new Deflater().end();
incrementProgressCounter();
}
});
}
Thread.sleep(Long.MAX_VALUE);
}
private static void incrementProgressCounter() {
long count = counter.incrementAndGet();
if (count % 1000 == 0) {
System.out.println(count + " calls completed");
}
}
}
---------- END SOURCE ----------
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
ADDITIONAL OS VERSION INFORMATION :
Linux x86_64 GNU/Linux
EXTRA RELEVANT SYSTEM CONFIGURATION :
Amazon ec2 m4.10xlarge
A DESCRIPTION OF THE PROBLEM :
When calling java.util.zip.Deflater#end concurrently from many threads (e.g., 100), we see very poor performance, along with system CPU usage approaching 100%.
This problem seems to occur only on machines with many cores. We've been able to reproduce the problem on Amazon EC2 instances m4.10xlarge and m4.16xlarge (40 and 64 cores, respectively).
The attached code can execute millions of calls per second on a 4 core machine, but struggles to execute thousands per second on a 40 core machine. With a smaller number of threads (e.g., 5) the problem does not occur.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package deflater.test
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicLong;
import java.util.zip.Deflater;
public class DeflaterTest {
static final int NUM_THREADS = 200;
static final AtomicLong counter = new AtomicLong(0);
static final ExecutorService executor = Executors.newFixedThreadPool(NUM_THREADS);
public static void main(String[] args) throws Exception {
for (int i = 0; i < NUM_THREADS; i++) {
executor.submit(() -> {
while (true) {
new Deflater().end();
incrementProgressCounter();
}
});
}
Thread.sleep(Long.MAX_VALUE);
}
private static void incrementProgressCounter() {
long count = counter.incrementAndGet();
if (count % 1000 == 0) {
System.out.println(count + " calls completed");
}
}
}
---------- END SOURCE ----------