Skip to content

Commit 49cbea8

Browse files
mattia-eleuterilexfrei
authored andcommitted
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 58d61d5 commit 49cbea8

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
@@ -70,6 +70,14 @@ seaweedfs:
7070
extraEnvironmentVars:
7171
WEED_LEVELDB2_ENABLED: "false"
7272
WEED_POSTGRES2_ENABLED: "true"
73+
# Without explicit pool settings the Go sql pool keeps zero idle
74+
# connections, so every filer metadata lookup opens a fresh PostgreSQL
75+
# connection (TCP + TLS + SCRAM, ~300ms each), adding seconds of latency
76+
# to every S3 operation. Keep max_open * filer.replicas below the
77+
# database max_connections (CNPG default: 100).
78+
WEED_POSTGRES2_CONNECTION_MAX_IDLE: "20"
79+
WEED_POSTGRES2_CONNECTION_MAX_OPEN: "40"
80+
WEED_POSTGRES2_CONNECTION_MAX_LIFETIME_SECONDS: "600"
7381
WEED_POSTGRES2_CREATETABLE: |
7482
CREATE TABLE IF NOT EXISTS "%s" (
7583
dirhash BIGINT,

0 commit comments

Comments
 (0)