Java OOM and full GC issues during OBLOADER execution

Applies to: V2.1.x,V2.2.x,V3.0.x,V3.1.x,V3.2.x,V3.3.x,V4.0.x,V4.1.x,V4.2.x

Applicable versions

All OBLOADER versions.

Problem description

  1. OBLOADER reports a Java out-of-memory error: Java heap space.

  2. Import speed gradually decreases while OBLOADER runs.

Cause

The default OBLOADER JVM memory is 4G. OBLOADER computes concurrency from the system CPU count, defaulting to twice that count. For example, 32 CPUs result in concurrency of 64. For large imports, 4G of JVM memory may be insufficient for this concurrency, leading to frequent full GC, deteriorating performance, or termination due to JVM memory exhaustion.

Diagnosis

Check GC as follows.

  1. Run jps to list Java processes for the current user.

    jps
    
  2. Run jstat to inspect GC statistics for the Java process.

    jstat -gc pid interval count
    

    Real-time metrics are shown below.

    loader

    Focus on FGC and FGCT:

    • FGC: Total full GC count
    • FGCT: Total full GC time

Solution

Increase JVM memory and limit worker concurrency.

  1. Increase JVM memory: in bin/obloader, change -Xms and -Xmx.

    vim bin/obloader
    
    JAVA_OPTS="$JAVA_OPTS -server -Xms32G -Xmx32G -XX:MetaspaceSize=512M -XX:MaxMetaspaceSize=512M -Xss352K"
    
  2. Reduce concurrency by adding --thread xx to the OBLOADER command.

    ./obloader -h 10.x.x.x -P 2883 -u test -p ****** --sys-password ****** -c cluster_a -t mysql -D USERA --sql --all -f /output --thread 8