I’m investigating how well I could run Stalwart for my personal use, with a small cheap VM for high-availability, and a NAS with cold backups for long-term data storage. I only have space for all of the data on the NAS, but I don’t want to be unable to receive/view emails if it temporarily goes offline.
Thinking through this situation, it seems to me a useful HA pattern for Stalwart could be to allow a small secondary blob store to temporarily accept new blobs when the primary blob store is unavailable.
The use case is a distributed Stalwart deployment where metadata and services are replicated across several nodes, but the full historical blob corpus lives on one large storage node. The other nodes may have enough storage to cover hours or days of new mail, but not enough to hold a complete replica of the corpus (i.e. my situation from earlier).
Currently, if the blob store is unavailable, an inbound SMTP transaction eventually receives a temporary failure and the sending MTA has to retry. It would be useful to instead support something like:
normal:
PUT → primary
GET → primary
primary unavailable:
PUT → overflow
GET pending blobs → overflow
GET existing blobs → primary (and fail if unavailable)
primary recovers:
copy overflow blobs → primary
verify
remove overflow copies
The overflow store would therefore normally be empty. Its contents would be exactly the blobs accepted while the primary was unavailable and not yet drained back.
This gives a useful degraded mode: new mail can still be accepted and accessed while historical message bodies may be temporarily unavailable, without requiring every Stalwart node to store the entire historical corpus.
I see there are a couple of related proposals already, namely:
-
Support for Multiple S3 Storage Buckets for Blob Management, which includes more general multi-bucket/failover use cases.
-
Hierarchical Storage Management / Storage Tiering, which considers transparent movement of older blobs between storage tiers.
-
The existing discussion of S3 blob-store downtime, which describes the current SMTP retry behaviour.
To me, this feature seems distinct from both replication and HSM: the secondary store isn’t a permanent replica or storage tier, only temporary durable overflow for writes that have not reached the primary.