Connections to postgresql database

Hi DAML team, we are using the DAML sandbox with a postgresql database. Currently we see that there are 81 connections (most of them idle) to the database. How is the connection pool configured on the DAML sandbox? Thanks for your support.

2 Likes

Hi @DavidBelinchon,

At the moment, the connection pools used by DAML Sandbox cannot be configured. The DAML Sandbox consist of different components internally that access the database, with generously configured default values for connection pool sizes.

4 Likes

Hi @gerolf
Thanks for the answer. Can you tell me which are the default values.

1 Like

Currently, we establish:

  • 16 connections for the ledger API server component
  • 16 connections for the indexer component
  • an unbounded number of connections for the ledger itself

There may be a couple more, but this is probably most of them.

These numbers haven’t been tuned much beyond “this works”. Are you experiencing any problems due to the number of connections?

2 Likes

Hi @SamirTalwar,
thanks for your answer. I am working together with @DavidBelinchon and we are connecting the DAML sandbox to a AWS RDS PostgreSQL instance. The sandbox opens between 70 and 80 connections to the database leaving few connections for other services. Do you suggest to have a dedicated database server instance for the DAML sandbox?
Regards, Lars.

1 Like

Sandbox assumes it’s the only process using the PostgreSQL server. That said, the number of connections does sound aggressive and we may want to find a way to cap that at some point.

If you’re planning on running DAML in production on AWS, you might find DAML on PostgreSQL interesting. I believe the website is coming soon. @bernhard might be able to help you out with that.

1 Like

Indeed, for production use, I would not use Sandbox, which is a developer tool and has no data continuity guarantees, but DAML for Postgres. A free and open source version is published on GitHub Releases.

2 Likes

Thanks @bernhard, will have a look at it.

1 Like

As a side-note, as of today you should see a similar behavior on DAML for PostgreSQL, but limited to fixed-size connection pools that should amount to 48 connections. Depending on your situation you may want to evaluate having a dedicated database for DAML, considering that multi-tenancy also has performance implications, especially if you are running concurrently with other applications that may keep the database busy.

1 Like