MemoryLayer Storage
MemoryLayer Storage provides content-addressed object storage and a distributed POSIX filesystem. You can use its Go libraries, the HTTP object API, the S3-compatible gateway, the Python client, or Kubernetes CSI volumes. Each interface works on its own, so you can adopt one without the others.
It is open source under AGPL-3.0-only. You host it yourself. The source is at github.com/scitrera/memorylayer-storage. The initial release is 0.7.1, and each component has its own version.
Components
| Component | Purpose |
|---|---|
casstore | Chunking, deduplication, compression, snapshots, and garbage collection |
ctlproto | Wire contract for the storage control plane |
manifeststore | Snapshot manifests stored in PostgreSQL |
blobgw | HTTP object gateway and NATS storage control plane |
blobgw-edge | Capability authentication, tenant routing, quotas, and revocation |
blobgw-s3 | S3-compatible object access |
mlfs | FUSE filesystem with PostgreSQL metadata and a durable write-back cache |
mlfs-csi | Kubernetes CSI driver and per-domain mount management |
blobgw-client | Python HTTP client and storage-service adapter (Apache-2.0) |
The repository contains eight Go modules plus the Python client. Go imports use github.com/scitrera/memorylayer-storage/<component>.
Architecture
The stack keeps four concerns separate: physical bytes, object addressing, filesystem metadata, and external access.
Applications ──► blobgw HTTP object API ─┐Applications ──► blobgw-s3 ──────────────┤Browsers/apps ─► blobgw-edge ────────────┤ ├─► casstore chunk engine ─► S3-compatible storage or local diskKubernetes pods ─► mlfs-csi ─► mlfs FUSE ┘ ├─► PostgreSQL filesystem metadata ├─► manifeststore (PostgreSQL manifests) └─► blobgw NATS control plane ─► PostgreSQL dedup indexThe S3 and edge frontends call the gateway library or a configured gateway backend directly. They are not extra HTTP hops through blobgw. In remote mlfs mode, file bytes go straight from each node to its S3-compatible backend. The control plane handles dedup-index lookups and issues presigned pack URLs.
How deduplication and compression work
Content-defined chunking. casstore splits each object into chunks with a rolling-hash splitter (Buzhash32, 1 MiB target by default). Chunk boundaries depend on the content, not on fixed offsets. An insertion therefore changes only the chunks around it.
Dedup domains. Each chunk is identified by the SHA-256 of its uncompressed content. Identical chunks are stored once per dedup domain (tenant). Blob IDs carry the domain as a prefix, so content never deduplicates or collides across domains.
Packs. Chunks are grouped into pack blobs of about 16 MiB by default, which cuts the number of backend PUTs. A small JSON manifest lists every chunk in stream order as a (pack hash, offset, length) entry. Reads fetch only the byte ranges they need and check the hash of each chunk.
Compression policy. Compression is applied to packs after chunking and after dedup keys are computed. Enabling compression therefore never changes which chunks deduplicate. The default content-type policy works like this:
- Generic and text-like content is compressed with
zstdby default.gzipandnoneare also available. - Already-compressed media (
image/*,video/*,audio/*, zip, gzip, zstd, and similar) is stored uncompressed. - GPU-loadable tensor formats (for example
application/x-safetensors,application/x-numpy, andapplication/x-pytorch) are also stored uncompressed, so they stay range-readable and mmap/zero-copy friendly.
Each pack records its codec in a small header, so stores that mix codecs always read back correctly. With the default per-chunk framing, each chunk in a compressed pack is compressed separately, so compressed packs stay range-readable. whole-pack framing gets a better ratio, but every chunk read has to decompress the whole pack.
Garbage collection. GC is mark-and-sweep. It builds a live set from the manifests writers use, then reclaims unreferenced packs that are older than a safety window. The window protects writes that are still in flight. Compaction can optionally repack sparse or small packs. See Operations for the settings and the safety rules.
Interfaces
- HTTP object API and capability edge:
blobgw’s/v1object API for trusted services, the Python client, stage-then-finalize (presigned) uploads, andblobgw-edgefor Ed25519 capability URLs that browsers can use directly. - S3-compatible gateway:
blobgw-s3supports a subset of the S3 API with SigV4 authentication, ranged reads, and multipart upload. - POSIX filesystem and CSI:
mlfsis a FUSE mount with PostgreSQL metadata, andmlfs-csiprovidesReadWriteMany-capable Kubernetes volumes.
To try it locally, start with the Quickstart.
Relationship to MemoryLayer Enterprise
MemoryLayer Enterprise can use MemoryLayer Storage as its blob backend through the blobgw backend and the Apache-2.0 Python client. Storage is a separate, standalone project. You can run it with or without MemoryLayer.
Estimate your savings
mlstore-savings is a free Apache-2.0 tool that estimates how much deduplication and compression would shrink your files. It runs locally and read-only, and it makes no network calls.
docker run --rm -v /data:/in:ro ghcr.io/scitrera/mlstore-savings /inIt models content-defined dedup and content-type compression. It does not model the pack format, the global dedup index, or GC. Treat its output as an estimate.
License and contributing
- The storage stack is licensed under AGPL-3.0-only.
- The Python client in
clients/python/(blobgw-client) is licensed under Apache-2.0. - Dependencies keep their own licenses. See
THIRD_PARTY_NOTICES.mdandLICENSES/in the repository. - Contributions are governed by
CONTRIBUTING.mdand the MemoryLayer Storage Contributor License Agreement (CLA.md). Scitrera LLC is the Project Owner.
Scitrera has closed its doors and released its work as open source. There is no commercial licensing, paid support, or sales contact. Report issues and contribute through GitHub.