Skip to content

Storage Operations

This page covers production deployment of MemoryLayer Storage. Run any daemon with -help to see its full list of flags.

Backends

blobgw chooses its backends with flags:

FlagValuesDefaultNotes
-backendlocal, s3localChunk and manifest storage. s3 needs -s3-bucket. Other settings: -s3-region (us-east-1), -s3-endpoint (for non-AWS S3-compatible stores), -s3-prefix (blobgw), and -s3-force-path-style.
-indexmemory, postgresmemoryDedup index and object-ref index. postgres uses -database-url, which falls back to $BLOBGW_DATABASE_URL.
-stagingnone, memory, s3memoryBackend for stage-then-finalize uploads

The production profile is -backend s3 -index postgres -staging s3. S3 credentials come from the standard AWS credential chain. Per-tenant credentials come from tenant bindings (below). PostgreSQL schemas are created automatically.

Pack and compression settings are -pack-size (0 = about 16 MiB), -compression (zstd, gzip, or none; default zstd), and -pack-framing (per-chunk or whole-pack). Compression and pack size affect the cost of ranged reads. Before changing the compression policy of a filesystem that serves models, check cold reads, sequential throughput, and mmap workloads on representative files.

Multi-tenant object API

-tenant-config turns on tenant routing for the HTTP /v1 API. It works independently of -control-plane. The value is either a single JSON file or a directory of per-tenant *.json files. Each file in a directory is hot-reloaded.

{
"tenants": {
"acme": {
"endpoint": "https://s3.example.com",
"region": "us-east-1",
"bucket": "tenant-acme-7f3a",
"prefix": "packs",
"credentialRef": "acme",
"forcePathStyle": false,
"manifestDSN": ""
}
}
}
  • region, bucket, and credentialRef are required. endpoint defaults to AWS when empty.
  • manifestDSN is optional. It routes the tenant’s manifests to PostgreSQL, which is how the remote mlfs deployment works.
  • -credential-mode static (the default) resolves credentialRef from the BLOBGW_TENANT_KEY_<REF> and BLOBGW_TENANT_SECRET_<REF> environment variables, or from a -tenant-secrets-file. <REF> is the ref upper-cased, with non-alphanumeric characters replaced by _. The environment variables take precedence.
  • -credential-mode aws-sts treats credentialRef as an IAM role ARN and assumes it through an IRSA web-identity token. AWS_WEB_IDENTITY_TOKEN_FILE must be set.

Every data request must then send a single X-Blobgw-Domain header naming a configured tenant. Requests with a missing or unknown tenant fail closed. The header selects storage but does not authenticate the caller. Keep port 8080 restricted to trusted services, and route browsers through the capability edge. When you migrate objects, check both the X-Blobgw-Domain in the response and the hash of the data you read back.

Isolation depends on mapping each domain consistently across backend bindings, metadata databases, NATS accounts, credentials, and authorization.

Remote filesystem deployments

A remote mlfs deployment needs:

  • S3-compatible object storage, bound per domain through -tenant-config
  • PostgreSQL for mlfs metadata and manifests. Use one database or schema per domain.
  • A blobgw control plane (-control-plane) connected to NATS
  • NATS connectivity, with separate credentials for each domain

Set up domain and backend bindings before clients mount. The recommended unit is one dedup domain = one NATS account = one PostgreSQL database, all on shared physical infrastructure. Isolation holds at three layers:

LayerBoundaryMechanism
Data (casstore)Dedup domainBlob IDs carry the domain as a prefix. Content never deduplicates or collides across domains.
Metadata (PostgreSQL)Database or schema per domainProvides the authoritative fence and the inode namespace.
Coordination (NATS)Account per domainEach domain uses its own account and JetStream assets.

A single shared blobgw control plane serves every tenant. It connects to a service account (-nats-creds or -nats-nkey) that exports blobgw.*.>. Each tenant account imports only blobgw.<tenant>.>, so the NATS account boundary stops one tenant from reaching another’s control-plane subjects.

Terminal window
blobgw -control-plane \
-nats-url nats://nats.dc1:4222 \
-nats-creds /etc/blobgw/blobgw-svc.creds \
-tenant-config /etc/blobgw/tenants.json

For production NATS, prefer operator mode (nsc) so account JWTs and user credentials can be rotated without restarting the server. Embedded NATS in mlfs (-nats-cluster and -nats-routes with no -nats-url) supports a single domain only. The shared multi-tenant setup uses external NATS (-nats-url plus -nats-creds). -presign-max-ttl (default 15m) caps how long presigned pack URLs stay valid.

The CSI reference manifests are examples to adapt. Provisioning databases and credentials is the operator’s job. The standalone release does not include a tenant provisioning service or a Helm chart.

Garbage collection

GC reclaims packs that no live manifest references and that are older than a safety window.

ModeFlagsUse
Shared-store sweeper-gc-interval (default 10m; 0 disables), -gc-safety-window (default 1h)Single-domain gateways. It is disabled when tenant bindings are configured, because it can’t establish liveness in separate tenant backends.
Leader-elected per-tenant GC-control-plane -gc-leader, -gc-leader-interval (default 1h), -gc-leader-safety-window (default 24h), -gc-leader-ttl, -gc-leader-replicasMulti-tenant deployments. Exactly one replica sweeps at a time, using a lease in NATS JetStream KV.
On demandPOST /admin/gc?domain=<tenant>Scoped maintenance for one tenant

Optional compaction runs as the first step of each leader-elected tenant pass:

  • -gc-compact-min-fill and -gc-compact-min-pack-bytes repack sparse or small packs.
  • -gc-compact-max-bytes-per-pass caps the I/O of each pass.
  • -gc-compact-defrag lays out chunks in file order.

Safety rules:

  • GC must read the same manifest store the writers use. Remote mlfs manifests live in PostgreSQL, so give those tenants a manifestDSN in their tenant record, or use the legacy -manifest-dsn-file. If GC points at an empty S3 manifest namespace, it can’t see live data.
  • Choose safety windows longer than the longest write-back interval and the longest time a client can be offline. Keep an eye on mlfs.writeback.oldest_unflushed_age. If it exceeds the window, GC can reclaim live data.
  • Run administrative operations that need writers to be quiet in maintenance windows. Reclamation and compaction change persistent storage, so test the exact configuration on disposable data first.
  • Stale staged uploads are swept separately (-staging-ttl on blobgw, and -staging-gc-ttl and -staging-gc-interval on blobgw-edge).

Backups

Back up these together, as one set:

  • filesystem metadata
  • manifests
  • object refs
  • the backing packs they reference

A backup of the bucket alone does not preserve the filesystem namespace or the object-reference index. Practice restores with the same component versions before you upgrade an existing deployment.

Monitoring

All layers use OpenTelemetry. Metrics can be pushed over OTLP/gRPC (-otel-endpoint, -otel-insecure, -metrics-push-interval) or scraped by Prometheus (-metrics-addr). Both are off by default. blobgw also serves /metrics, /healthz, and /readyz on its API port. Traces run end to end, from blobgw.http.<op> or mlfs.fuse.<op> spans down to PostgreSQL and casstore.backing.* spans. Sampling is set with -otel-trace-sampling on blobgw and blobgw-edge, and with -otel-trace-sample-ratio on mlfs.

Instrument names follow <layer>.<subsystem>.<metric>, for example casstore.backing.op.duration, blobgw.cp.presign.duration, and mlfs.writeback.oldest_unflushed_age.

Recommended alerts:

  • *.integrity.errors (error.kind = corrupt, not_found, or range) should stay at about zero. It fires on corruption and on GC over-deletion.
  • blobgw.gc.empty_live_set: GC found an empty live set while blobs exist.
  • Backing-store errors with error.kind=auth, which usually means expired credentials.
  • mlfs.writeback.oldest_unflushed_age approaching the GC safety window.
  • Mount flaps, lease loss, and fence rejections in multi-node mlfs.

Container images and releases

Images are published to GHCR, each with its own component version and Linux amd64 and arm64 manifests:

ImageContents
ghcr.io/scitrera/blobgwObject gateway and control plane
ghcr.io/scitrera/blobgw-edgeCapability gateway
ghcr.io/scitrera/blobgw-s3S3-compatible gateway
ghcr.io/scitrera/mlfsmlfs, mlfs-admin, mlfs-bench
ghcr.io/scitrera/mlfs-csiCSI driver plus a bundled mlfs daemon

Pin an explicit tag for each component, for example ghcr.io/scitrera/blobgw:0.7.1. Each Dockerfile in docker/ builds from the repository root.

Components are versioned independently. The versions are listed in versions.yaml and all start at 0.7.1.

  • Go modules are tagged <component>/vX.Y.Z, for example blobgw/v0.7.1.
  • The Python client is tagged clients/python/vX.Y.Z and is installed from Git, not PyPI.
  • A fix to one component doesn’t require releasing the others.
  • The mlfs-csi image bundles the mlfs daemon, so any change to the bundled daemon ships as a new CSI image version.
Terminal window
go get github.com/scitrera/memorylayer-storage/casstore@v0.7.1