Options

How to configure Java DatasourceConnectionpool to vertica DB

Hi All,

I have class like this.

class EmployeeTask implements Runnable {

Public void run(){

PayDAO payDAO = new payDAO(session);
String newSalary= payDAO.getSalary(empid);
String newTitle= payDAO.getTitle(empid);

EmployeeDAO employeeDAO = new EmployeeDAO(session);
List employees = employeeDAO.getEmployees();
employees.parallelStream().foreach(employee-> employeeDAO.computeAndUpdate(newSalary, newTitle,employee));

}
}

  1. When run the above code for one thread, it completes DB operation in 1 second
    and returns.
  2. When I run it using parallelStream(), it will submit 8 requests, wait for eight seconds and then return. Which means the server is executing the requests
    Sequentially instead of parallely.
    I checked the java jetty logs

Theread-1 Insert …
Theread-2 Insert …

Theread-8 Insert …

After eight seconds, that is 1 second per request

Theread-1 Insert … <= update 1
Theread-2 Insert … <= update 1

Theread-8 Insert … <= update 1

Samething continues.

  1. This clearly tells, either the Datasource from my client java has only one connection so all the eight threads are getting blocked or the server is executing the requests one after the other.

I checked MaxPooledConnections — gives 20, MaxPooledConnections
PerNode - gives 5 default values.

I think server is fine, maybe client is not having DatasourceConnection pooling,
How do I enable Java side DatasourceConnection pooling. Any Code examples ?

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file