Design Question: Values for DB Session Pool in Container Environment


#1

First, I am a camunda newbie and still try to understanding how different configurations work…

We are at the beginning of building a Camunda Environment. At the moment, it looks like we are going to start multiple (Minimum 2) Containers with spring boot for each process. So it could be, that we are going to have let’s say 100 containers at the end.
The first tests show, that each container opens 10 connection to the database and here are some questions:

  • Where could I find the values for the db session pool configuration of the container (min, max,…)?
  • How to size the number of sessions in such an environment?
  • How is this linked to the configuration of the job executor?

… or are we totally wrong with the decision to run containers for single processes?

Thank you very much in advance
Kai


#2

Where could I find the values for the db session pool configuration of the container (min, max,…)?
OK, I found the values on https://github.com/brettwooldridge/HikariCP

Only two questions left…


#3

@ksch i hope all your containers/camunda instances would be connecting to same database.

In order to start the camunda server application you need to configure the datasource which can be used by camunda process engine, job executors, etc. Further number of db connections, session pool configurations, validation queries, connection thread borrowing, etc. these things can be configured part of datasource itself.

For datasource, you can use Apache DBCP2 or HikariCP based on your use case.

@Bean(name = "transactionManager")
  public PlatformTransactionManager transactionManager() {
    DataSourceTransactionManager transactionManager = new DataSourceTransactionManager();
    transactionManager.setDataSource(dataSource());
    return transactionManager;
  }

For Datasource configuration:

@Primary
  @Bean(name = "dataSource")
  public DataSource dataSource() {
    BasicDataSource dataSource = new BasicDataSource();
    dataSource.setInitialSize(10);
    dataSource.setMaxActive(30);
    dataSource.setMinIdle(10);
    dataSource.setMaxIdle(10);
    dataSource.setMaxWait(30000);
    dataSource.setPoolPreparedStatements(true);
    dataSource.setMaxOpenPreparedStatements(30);
    dataSource.setValidationQuery("select 1");
    dataSource.setValidationQueryTimeout(3);
    dataSource.setTestOnBorrow(true);
    dataSource.setTestWhileIdle(true);
    dataSource.setRemoveAbandoned(true);
    dataSource.setRemoveAbandonedTimeout(300);
    dataSource.setMinEvictableIdleTimeMillis(3600000);
    dataSource.setTimeBetweenEvictionRunsMillis(600000);
    dataSource.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
    return dataSource;
  }