Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

fix(rexctl): cap SeaweedFS uploads and raise its memory floor (#3724)

Hampus15e08a5249e8
diff --git a/deploy/helm/fluxer/templates/seaweedfs.yaml b/deploy/helm/fluxer/templates/seaweedfs.yaml
index 74f7b5f1a..6184c12f6 100644
--- a/deploy/helm/fluxer/templates/seaweedfs.yaml
+++ b/deploy/helm/fluxer/templates/seaweedfs.yaml
@@ -65,6 +65,7 @@ spec:
- -master.volumeSizeLimitMB={{ include "fluxer.string" .volumeSizeLimitMB }}
- -master.garbageThreshold=0.1
- -volume.max={{ include "fluxer.string" .volumeMax }}
+ - -s3.concurrentFileUploadLimit={{ include "fluxer.string" .concurrentUploads }}
- -ip=127.0.0.1
- -ip.bind=127.0.0.1
- -s3.ip.bind=0.0.0.0
diff --git a/deploy/helm/fluxer/values.schema.json b/deploy/helm/fluxer/values.schema.json
index 041e32cf7..00934d52b 100644
--- a/deploy/helm/fluxer/values.schema.json
+++ b/deploy/helm/fluxer/values.schema.json
@@ -576,6 +576,10 @@
}
]
},
+ "concurrentUploads": {
+ "type": "integer",
+ "minimum": 1
+ },
"gomemlimit": {
"type": "string"
},
diff --git a/deploy/helm/fluxer/values.yaml b/deploy/helm/fluxer/values.yaml
index c1fa791b3..1d9ba6734 100644
--- a/deploy/helm/fluxer/values.yaml
+++ b/deploy/helm/fluxer/values.yaml
@@ -329,6 +329,7 @@ seaweedfs:
# message is sent, so this removes uploads nobody sent. off removes the rule.
uploadsTtl: 1d
gomemlimit: 1536MiB
+ concurrentUploads: 5
# Tries, 2 seconds apart, the bucket setup makes before it starts over.
initAttempts: 60
persistence:
diff --git a/fluxer_docs/src/content/docs/operator/environment.mdx b/fluxer_docs/src/content/docs/operator/environment.mdx
index 9f5cd8cf4..7fb21d360 100644
--- a/fluxer_docs/src/content/docs/operator/environment.mdx
+++ b/fluxer_docs/src/content/docs/operator/environment.mdx
@@ -1528,6 +1528,10 @@ The size in MB a volume can grow to before SeaweedFS stops writing to it, set as
The share of deleted space in a volume that makes SeaweedFS compact it, as a fraction, set as its `-master.garbageThreshold`. The default is `0.1`. With rexctl, use `rexctl config set FLUXER_SEAWEEDFS_GARBAGE_THRESHOLD`.
+### `FLUXER_SEAWEEDFS_S3_CONCURRENT_UPLOADS`
+
+How many uploads the bundled object store writes at once, set as its `-s3.concurrentFileUploadLimit`. More uploads wait for a free slot. Each upload in progress holds up to 32 MB of memory in SeaweedFS. Raise `FLUXER_SEAWEEDFS_MEMORY_LIMIT` before you raise this. The default is `5`. rexctl sizes this. With rexctl, use `rexctl config set FLUXER_SEAWEEDFS_S3_CONCURRENT_UPLOADS`.
+
### `FLUXER_SEAWEEDFS_VOLUME_MAX`
The most volumes the SeaweedFS volume store may have, set as its `-volume.max`. The default is `10000`. With rexctl, use `rexctl config set FLUXER_SEAWEEDFS_VOLUME_MAX`.
diff --git a/fluxer_rexctl/internal/instance/envvars.go b/fluxer_rexctl/internal/instance/envvars.go
index ad2ce007b..a61c6ecf1 100644
--- a/fluxer_rexctl/internal/instance/envvars.go
+++ b/fluxer_rexctl/internal/instance/envvars.go
@@ -394,6 +394,7 @@ var envVars = []envVar{
{"FLUXER_SEAWEEDFS_VOLUME_GROWTH", "tuning", "How many volumes SeaweedFS creates at once when a bucket has no writable volume left, set as its WEED_MASTER_VOLUME_GROWTH_COPY_1."},
{"FLUXER_SEAWEEDFS_VOLUME_SIZE_LIMIT_MB", "tuning", "The size in MB a volume can grow to before SeaweedFS stops writing to it, set as its `-master.volumeSizeLimitMB`."},
{"FLUXER_SEAWEEDFS_GARBAGE_THRESHOLD", "tuning", "The share of deleted space in a volume that makes SeaweedFS compact it, as a fraction, set as its `-master.garbageThreshold`."},
+ {"FLUXER_SEAWEEDFS_S3_CONCURRENT_UPLOADS", "tuning", "How many uploads the bundled object store writes at once, set as its `-s3.concurrentFileUploadLimit`. More uploads wait for a free slot. Each upload in progress holds up to 32 MB of memory in SeaweedFS. Raise FLUXER_SEAWEEDFS_MEMORY_LIMIT before you raise this."},
{"FLUXER_SEAWEEDFS_VOLUME_MAX", "tuning", "The most volumes the SeaweedFS volume store may have, set as its `-volume.max`."},
{"FLUXER_SEAWEEDFS_INIT_MEMORY_LIMIT", "tuning", "The memory limit for the seaweedfs-init container, which creates the buckets, sets up the S3 key and the expiry of the uploads bucket, and then exits."},
{"FLUXER_LIVEKIT_MEMORY_LIMIT", "tuning", "The memory limit for the livekit container."},
diff --git a/fluxer_rexctl/internal/instance/shipped.json b/fluxer_rexctl/internal/instance/shipped.json
index 736d80f8b..92b99b513 100644
--- a/fluxer_rexctl/internal/instance/shipped.json
+++ b/fluxer_rexctl/internal/instance/shipped.json
@@ -51,6 +51,7 @@
"78c81c9bc7b1715189783331824a60fcda365a26a52f3aaeb7209913735a9261",
"7a020c862ad7a0d49664afc66c90b8f77e33fa4fd0282704fc8805b955e45b65",
"7ab3cc0b7b2018ba02080d5ebea62ac60c88744b5154c1d6460a837bd708f222",
+ "7b78711510a421d8b5824af12fbf341c2408b67630ffd726bd3c1eaa356ebc4e",
"7d5820c1f0511ce9f9fa1c556c5c91403b709432167d23f2745989ecbc5f2824",
"8017d631d7d6cca17defbece31a06283461965852f00afd8ad1dc7da88eccf45",
"8ef9eb799431fb64b29f0eb8f62516ad33577ef0cf31e7d0d1f2285ab30f3712",
@@ -68,6 +69,7 @@
"b91a2a6f9f9b431a1c646a1798bb79b2d9374c0b1148047482a472b02f971a68",
"b9507ede5b95551c3036430f06cd4f571c836fc01776c98c8d58b90b05aec8c1",
"bb367376891f75673a4fc0c73fc2033c76f94c8b2b0984c577d2a66435f72c12",
+ "bbb549147ec488d4eed8b5a9e6eb4fe2e74a5bcf7e0c141357765a82e7176da3",
"bc2f52bcd3bbbf29c2abc04941cde4b621e111549bb3294d88c3fd890a51b310",
"be2fdcf316d1c3f369efba7b70ad11898c1185ed7272cfa917c9484b8072b823",
"c1c6d62cec339ea9ff24d92319fbadad062ec3b737f08ab327e31dfe32343740",
@@ -173,6 +175,7 @@
"5f4ac8120c26fde652d466e90d93969a4834e0700ab15c895c0a58a47c0d143f",
"60c8ec0d091036f8f149b534d8b6872780025e93ef580912cb5b7107c7d5957b",
"60d36054d2a687741f2a70f88f927a3b1a81288c1d6fb931164cecb74951d1fc",
+ "61ce1b4b32f10f010cb96f90fc9c83b41435dff0c75a15b205b16db6e40db431",
"673abaeb5056d9f1818619e60da5279790eeedb3a911bb4f02a82f30c10918b6",
"6d2587b99850f3346a15b34d09a7d5cb1ebf2066176e95990502f4e60539437b",
"6fbf816153040d0ec08b6174affff6d2b7d190729104507b17e94df651d75dc0",
diff --git a/fluxer_rexctl/internal/stack/files/.env.example b/fluxer_rexctl/internal/stack/files/.env.example
index dece6c948..bec7656d9 100644
--- a/fluxer_rexctl/internal/stack/files/.env.example
+++ b/fluxer_rexctl/internal/stack/files/.env.example
@@ -2218,6 +2218,14 @@ FLUXER_VAPID_PRIVATE_KEY=
# rexctl: rexctl config set FLUXER_SEAWEEDFS_GARBAGE_THRESHOLD
# FLUXER_SEAWEEDFS_GARBAGE_THRESHOLD=
+# How many uploads the bundled object store writes at once, set as its
+# -s3.concurrentFileUploadLimit. More uploads wait for a free slot. Each
+# upload in progress holds up to 32 MB of memory in SeaweedFS. Raise
+# FLUXER_SEAWEEDFS_MEMORY_LIMIT before you raise this. rexctl sizes this.
+# default: 5
+# rexctl: rexctl config set FLUXER_SEAWEEDFS_S3_CONCURRENT_UPLOADS
+# FLUXER_SEAWEEDFS_S3_CONCURRENT_UPLOADS=
+
# The most volumes the SeaweedFS volume store may have, set as its
# -volume.max.
# default: 10000
diff --git a/fluxer_rexctl/internal/stack/files/docker-compose.yml b/fluxer_rexctl/internal/stack/files/docker-compose.yml
index 722e1a8ae..4c5edd8c4 100644
--- a/fluxer_rexctl/internal/stack/files/docker-compose.yml
+++ b/fluxer_rexctl/internal/stack/files/docker-compose.yml
@@ -409,7 +409,7 @@ services:
environment:
GOMEMLIMIT: ${FLUXER_SEAWEEDFS_GOMEMLIMIT:-1536MiB}
WEED_MASTER_VOLUME_GROWTH_COPY_1: ${FLUXER_SEAWEEDFS_VOLUME_GROWTH:-1}
- command: ["server", "-s3", "-s3.iam=false", "-dir=/data", "-master.telemetry=${FLUXER_SEAWEEDFS_TELEMETRY:-false}", "-master.volumeSizeLimitMB=${FLUXER_SEAWEEDFS_VOLUME_SIZE_LIMIT_MB:-1024}", "-master.garbageThreshold=${FLUXER_SEAWEEDFS_GARBAGE_THRESHOLD:-0.1}", "-volume.max=${FLUXER_SEAWEEDFS_VOLUME_MAX:-10000}"]
+ command: ["server", "-s3", "-s3.iam=false", "-dir=/data", "-master.telemetry=${FLUXER_SEAWEEDFS_TELEMETRY:-false}", "-master.volumeSizeLimitMB=${FLUXER_SEAWEEDFS_VOLUME_SIZE_LIMIT_MB:-1024}", "-master.garbageThreshold=${FLUXER_SEAWEEDFS_GARBAGE_THRESHOLD:-0.1}", "-volume.max=${FLUXER_SEAWEEDFS_VOLUME_MAX:-10000}", "-s3.concurrentFileUploadLimit=${FLUXER_SEAWEEDFS_S3_CONCURRENT_UPLOADS:-5}"]
volumes:
- seaweedfs-data:/data
healthcheck:
diff --git a/fluxer_rexctl/internal/stack/sizing.go b/fluxer_rexctl/internal/stack/sizing.go
index 9a3b3d821..f0117f41a 100644
--- a/fluxer_rexctl/internal/stack/sizing.go
+++ b/fluxer_rexctl/internal/stack/sizing.go
@@ -108,7 +108,9 @@ func Sizing(hw Hardware, memory bool, fixed map[string]string) map[string]string
out["FLUXER_LIVEKIT_GOMEMLIMIT"] = strconv.Itoa(share("FLUXER_LIVEKIT_MEMORY_LIMIT", 6, 320, 2048)*85/100) + "MiB"
out["FLUXER_NATS_GOMEMLIMIT"] = strconv.Itoa(share("FLUXER_NATS_MEMORY_LIMIT", 3, 192, 1024)*4/5) + "MiB"
- out["FLUXER_SEAWEEDFS_GOMEMLIMIT"] = strconv.Itoa(share("FLUXER_SEAWEEDFS_MEMORY_LIMIT", 8, 448, 2048)*85/100) + "MiB"
+ seaweed := share("FLUXER_SEAWEEDFS_MEMORY_LIMIT", 8, 768, 2048)
+ out["FLUXER_SEAWEEDFS_GOMEMLIMIT"] = strconv.Itoa(seaweed*85/100) + "MiB"
+ setInt(out, "FLUXER_SEAWEEDFS_S3_CONCURRENT_UPLOADS", clamp(seaweed/384, 2, 8))
out["FLUXER_MEILISEARCH_MAX_INDEXING_MEMORY"] = strconv.Itoa(share("FLUXER_MEILISEARCH_MEMORY_LIMIT", 15, 512, 4096)/3) + "mb"
out["FLUXER_VALKEY_MEMORY_LIMIT"] = strconv.Itoa(clamp(m*45/1000+32, 224, 1568)) + "mb"