javamemory-managementorientdbfuturetaskorientdb-2.1

OrientDB - Java process: memory out of control


I've written a paralellized alghoritm to accomplish a calculation on data stored in a Orient table.

To take under control memory, I try to paginate these data and I try to parallelize my alghoritm about increase performance (using Future task).

My Orient settings are:

set ORIENTDB_SETTINGS=-Dprofiler.enabled=true -Dstorage.diskCache.bufferSize=12906

set JAVA_OPTS_SCRIPT=-Xmx4096M -Djna.nosys=true -XX:+HeapDumpOnOutOfMemoryError -XX:PermSize=1024m 
-XX:MaxPermSize=1024m
-Djava.awt.headless=true -Dfile.encoding=UTF8 -Drhino.opt.level=9
-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005

Xmx is fixed on 4 GB (4096MB as upper configuration), I've tried to monitor my Orient process with JVisualVM like the following screenshot:

OServermanager memory usage

On JVIsualVm process uses heap memory always under its limit, but in the Windows processes list the same process (I've highlighted the PID) occupies 7 GB and grows always.

Here my code:

for (Callable worker : workers) {
    Future<Boolean> submit = executor.submit(worker);
    futures.add(submit);
}
workers.clear();
workers = null;
boolean success = true;

for (Future<Boolean> future : futures) {
    try {
        if (Boolean.TRUE.equals(future.get())) {
            [CODE BLOCK]
        } else {
            [CODE BLOCK FOR REPROCESS FUTURE]
        }
    } catch (InterruptedException e) {
        e.printStackTrace();
    } catch (ExecutionException e) {
        e.printStackTrace();
    }
}

Solution

  • According to your picture, process have consumed 7GB of memory, according to your settings -Dstorage.diskCache.bufferSize=12906 you allow to consume for storage a bit less than 13GB of memory. If you wish to process consume less amount of memory you should change maximum limit of consumed memory in settings. Disk cache never frees memory to achieve the minimum query response time for the most wide range of queries.