JPPF, java, parallel computing, distributed computing, grid computing, parallel, distributed, cluster, grid, cloud, open source, android, .net
JPPF

The open source
grid computing
solution

 Home   About   Features   Download   Documentation   On Github   Forums 
June 04, 2023, 08:36:31 AM *
Welcome,
Please login or register.

Login with username, password and session length
Advanced search  
News: New users, please read this message. Thank you!
  Home Help Search Login Register  
Pages: [1]   Go Down

Author Topic: More than one driver  (Read 1774 times)

aburak

  • JPPF Padawan
  • *
  • Posts: 4
More than one driver
« on: October 10, 2017, 08:01:51 AM »

Hi again,

In our work, when we increment the task input's size(512 MB byte array) and send more than one job to the driver, the driver down because of Java Heap Space. We increment Java Heap Space size but I think it is not a solution for this kind of situation. Is it possible to configure topology which has more than one driver and jppf client do not know which driver execute which job. JPPF client only send request and one of the drivers executes it. How should I make a configuration to establish such a kind of topology. I will be glad if you help me to solve this problem.

Best Regards
Logged

lolo

  • Administrator
  • JPPF Council Member
  • *****
  • Posts: 2272
    • JPPF Web site
Re: More than one driver
« Reply #1 on: October 10, 2017, 08:42:44 PM »

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:

Code: [Select]
# 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):

Code: [Select]
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
Logged

aburak

  • JPPF Padawan
  • *
  • Posts: 4
Re: More than one driver
« Reply #2 on: October 18, 2017, 02:25:45 PM »

Hi again,

Sorry for late response, I just tried your suggestions.

You are right the driver handles inputs larger than its heap without any problem, there is a problem about our algorithm, we fixed it. But the purpose of asking more than one driver question is to ensure that other drivers continue to work when a driver is down while a job is running. I tried the solution you suggested, but when I shutdown a driver manually which has responsible to run jobs, the jppf client do not give jobs to the others. System goes to standby. Is there any solution to solve this problem.

Best Regards
Logged

lolo

  • Administrator
  • JPPF Council Member
  • *****
  • Posts: 2272
    • JPPF Web site
Re: More than one driver
« Reply #3 on: October 19, 2017, 12:00:10 PM »

Hello,

What I'm suspecting here is that the jobthat was executing on the terminated driver remains stuck in the client queue, because the connection to the other driver is already busy with another job and there is no more available connection. Thus, the first job will remain in the client queue until the second job has finished executing.

As a reminder:

1) The total number of driver connections held by the client determines the maximum number of job that this client can execute concurrently. If there are more jobs than connections, then extraneous jobs will wait in the client queue unti a connection becomes available.

2) The driver connections defined in the configuration are in fact connection pools, where the pool has a default size of one connection. The pool size can be defined statically in the configuration (e.g. "driver-1.jppf.pool.size = 5") or dynamically via API (see JPPFConnectionPool.setSize(int)).

The following code sample shows how connection failures can be detected and new connection(s) can be added to the surviving driver connection pool when this happens, using a combination of connection pool listener and connection status listener:

Code: [Select]
public static class MyConnectionPoolListener extends ConnectionPoolListenerAdapter implements ClientConnectionStatusListener {
  // implementation of ConnectionPoolListenerAdapter
  @Override
  public void connectionAdded(ConnectionPoolEvent event) {
    // add a status listener to the new connection
    event.getConnection().addClientConnectionStatusListener(this);
  }

  // implementation of ClientConnectionStatusListener
  @Override
  public void statusChanged(ClientConnectionStatusEvent event) {
    JPPFClientConnection c = (JPPFClientConnection) event.getClientConnectionStatusHandler();
    JPPFClientConnectionStatus currentStatus = c.getStatus();
    JPPFClientConnectionStatus prevStatus = event.getOldStatus();
    // if status went from working to not working ==> disconnection detected
    if (prevStatus.isWorkingStatus() && !currentStatus.isWorkingStatus()) {
      System.out.printf("status changed from [%s] to [%s] for %s%n", event.getOldStatus(), currentStatus, c);
      JPPFClient client = c.getConnectionPool().getClient();
      List<JPPFConnectionPool> workingPools = client.findConnectionPools(JPPFClientConnectionStatus.workingStatuses());
      for (JPPFConnectionPool pool: workingPools) {
        int size = pool.getSize();
        if (size < 2) {
          System.out.printf("setting pool size to 2 for %s%n", pool);
          pool.setSize(2);
          break;
        }
      }
    }
  }
}

JPPFClient jppfClient = new JPPFClient(new MyConnectionPoolListener());

Using this code as-is or as a starting point, this should help resolve your issue.

Sincerely,
-Laurent
Logged
Pages: [1]   Go Up
 
JPPF Powered by SMF 2.0 RC5 | SMF © 2006–2011, Simple Machines LLC Get JPPF at SourceForge.net. Fast, secure and Free Open Source software downloads