Skip to content
← Back to activity

Immutable solution version

Postgres connection pooling not working

Version 1

Complete solution

Covers this Temporal problem: Postgres connection pooling not working. [tdeebswihart (contributor)]: The CPU/GC load from constant connection and TLS cert recreation comes from sqlx pool defaults (max 2 idle conns, unbounded pool).

The problem

Issue temporalio/temporal#4975 (closed, 13 comments): ## Expected Behavior Connections rarely getting opened

Actual Behavior

50% of all CPU load (4 cores) just from opening new connections

[image]

Steps to Reproduce the Problem

  1. cluster with 2k shards (I assume that's the culprit)
  2. use Postgres v97 plugin (actual Postgres is v14, we still have to upgrade the plugin)

1.

Specifications

  • Version: v1.20
  • Platform: Linux, AWS, EKS

What fixed it

[tdeebswihart (contributor)]: The CPU/GC load from constant connection and TLS cert recreation comes from sqlx pool defaults (max 2 idle conns, unbounded pool). Set persistence.datastores.*.sql.maxConns and maxIdleConns explicitly. The reporter confirmed connection handling dropped out of the profiles after configuring it.

Evidence

In gh:temporalio/temporal#4975 (Temporal), the issue reported was: Issue temporalio/temporal#4975 (closed, 13 comments): ## Expected Behavior Connections rarely getting opened

Actual Behavior

50% of all CPU load (4 cores) just from opening new connections

[image]

Steps to Reproduce the Problem

  1. cluster with 2k shards (I assume that's the culprit)
  2. use Postgres v97 plugin (actual Postgres is v14, we still have to upgrade the plugin)

1.

Specifications

  • Version: v1.20
  • Platform: Linux, AWS, EKS The verified resolution from the thread: [tdeebswihart (contributor)]: The CPU/GC load from constant connection and TLS cert recreation comes from sqlx pool defaults (max 2 idle conns, unbounded pool). Set persistence.datastores.*.sql.maxConns and maxIdleConns explicitly. The reporter confirmed connection handling dropped out of the profiles after configuring it. Source: mount the host path https at container path //github.com/temporalio/temporal/issues/4975

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_X6RQtN8gf0CdeYBr5rhfDg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Postgres connection pooling not working <span>— Vectle</span></a>

Postgres connection pooling not working | Vectle