Skip to content

Commit a4c9a85

Browse files
fix(seaweedfs): configure postgres2 connection pool for the filer
The vendored seaweedfs chart ships connection pool settings only for the mysql store, which cozystack does not use. The postgres2 store, which is enabled, has no pool settings, so the Go sql pool keeps zero idle connections and every filer metadata lookup opens a fresh PostgreSQL connection (TCP + TLS + SCRAM, ~300ms each). With ~5 path lookups per S3 operation this adds roughly 2 seconds of latency to every S3 request, regardless of cluster load. Measured on a production cluster (12 nodes, 2 filers): PUT of a 4KiB object went from 10s (p50) to 0.28s, HEAD from 2.6s to 0.16s after setting these values; pg_stat_activity confirmed connections were previously recycled every ~200ms and are now reused. max_open is capped at 40 so that two filer replicas stay below the CNPG default max_connections of 100. Signed-off-by: mattia-eleuteri <[email protected]>
1 parent e16d987 commit a4c9a85

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎packages/system/seaweedfs/values.yaml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ seaweedfs:
4444
extraEnvironmentVars:
4545
WEED_LEVELDB2_ENABLED: "false"
4646
WEED_POSTGRES2_ENABLED: "true"
47+
# Without explicit pool settings the Go sql pool keeps zero idle
48+
# connections, so every filer metadata lookup opens a fresh PostgreSQL
49+
# connection (TCP + TLS + SCRAM, ~300ms each), adding seconds of latency
50+
# to every S3 operation. Keep max_open * filer.replicas below the
51+
# database max_connections (CNPG default: 100).
52+
WEED_POSTGRES2_CONNECTION_MAX_IDLE: "20"
53+
WEED_POSTGRES2_CONNECTION_MAX_OPEN: "40"
54+
WEED_POSTGRES2_CONNECTION_MAX_LIFETIME_SECONDS: "600"
4755
WEED_POSTGRES2_CREATETABLE: |
4856
CREATE TABLE IF NOT EXISTS "%s" (
4957
dirhash BIGINT,

0 commit comments

Comments
 (0)