Hello,
I'm surprised at the fact that the driver failed with an OutOfMemoryError. The JPPF driver is supposed to handle jobs larger than its heap without any problem, as it has a mechanism that offloads to disk the jobs that don't fit in memory. I just tried with a driver that has 128 MB of heap and submitted tasks with 512 MB of data and it worked like a charm. Is there any way you could provide a small sample (including driver configuration) that reproduces the problem?
In any case, you can definitely have multiple drivers and configure a JPPF client to balance the load on them both. To
manually configure the connections to the drivers, you can do as in this example:
# disable automatic driver discovery
jppf.discovery.enabled = false
# specifiy the names of the drivers to configure
jppf.drivers = driver-1 driver-2
# configure connection to driver-1
driver-1.jppf.server.host = my.host1.com
driver-1.jppf.server.port = 11111
driver-1.jppf.pool.size = 1
# configure connection to driver-2
driver-2.jppf.server.host = my.host2.com
driver-2.jppf.server.port = 11111
driver-2.jppf.pool.size = 1
Once you have configure this, your client will have two connections to two separate drivers, and will be able to submit up to 2 jobs concurrently. To submit multiple jobs concurrrently, you can use one of the patterns described in the
dedicated documentation. In the following example, we submit two concurrent jobs from the same thread. This requires to set the jobs in non-blocking mode with
JPPFJob.setBlocking(false):
try (JPPFClient client = new JPPFClient()) {
// create job1
JPPFJob job1 = new JPPFJob();
job1.setBlocking(fasle);
job1.add(new MyTask1());
// create job2
JPPFJob job2 = new JPPFJob();
job2.setBlocking(fasle);
job2.add(new MyTask2());
// submit the jobs
client.submitJob(job1);
client.submitJob(job2);
// ... do other things ...
// get the jobs results
List<Task<?>> result1 = job1.awaitResults();
List<Task<?>> result2 = job2.awaitResults();
}
The JPPF client will automatically distribute the jobs over the configured driver connections.
I hope this helps,
-Laurent