Problem: Errors related to busy or unavailable data sources

Increase the database connection pool size limit or improve the performance of long-running queries.

Errors might occur if the maximum connection pool size is too small or if queries take too long to process.

If you receive the error "Data source "DataSourceName" is temporarily unavailable. (err.persistence.unavailable)" or "Unable to allocate a resource in QueryTimeout ms due to reaching the maximum pool size of MaxPoolSize. (err.pool.resource.busy)", you can take the following steps to help prevent the error from occurring in the future:

  • Optimize long-running queries.
  • Increase the maximum database connection pool size. To do this:

    1. In NexJ Studio, open the environment file for your deployment.
    2. In the Data Source Connections tab, select Relational Database Connections, and click the Advanced subtab.
    3. In the Max Pool Size field, enter a greater value for the maximum number of available database connections.
  • Increase the maximum database connection pool size to the value given by the following calculation:

    (Average Active Connection Count / 60) * (Average Processing Time / 1000) * 1.1

    To find the Average Active Connection Count and Average Processing Time values:

    1. In NexJ System Admin Console, navigate to the Statistics page.
    2. In the list in the Statistics area, expand the tree node for your NexJ application. For example, nexj.finance.
    3. Expand the node for the server whose maximum database connection pool size you want to increase. For example, node1.
    4. Expand the DataSource node.
    5. Expand the RelationalDatabase node.
    6. Expand the node for the database whose maximum connection pool size you want to increase. For example, DefaultRelationDatabase.
    7. Select the [default] node. The statistics for the node are displayed in the right pane.
    Note: If you are running your application on a server cluster, you should perform the calculation for all nodes in the cluster, then use the average or maximum value as your connection pool size limit. The setting for the maximum database connection pool size in the environment file applies to all nodes in a cluster.