Comment by munk-a

4 days ago

I have built and maintain a system that uses a very similar system - we register artifacts with UUIDs into S3 in a specifically write-once, never edit, never remove approach and then store those UUIDs in a postgres system. We simply juggle around the connection of other model objects to UUIDs as needed allowing us to achieve safe guarantees without burdening the centralized system with the massive volume (these artifacts are often 50MB+ PDFs). I will mention that I am quite fond of this approach but it's good to be aware that introducing levels of abstraction like this do necessarily widen some fail points on the storage side - if your service uses multiple persistence stores each additional store exposes yet another point where inconsistency could be introduced and/or a message could be lost. Still, fragmenting your data over multiple stores that are particularly well suited for their specialized usages can be huge for performance and cost.

If you use hashes of the content itself for your UUIDs, you'll (a) get deduplication and data consistency checking for free and (b) have basically implemented (a subset of) git that uses S3 backing instead of a local filesystem directory :)

  • for smallish databases, where uuid is surogate id, i would trust dbos/postgres replication. replication is just too hard to role your own.

    tangentially, for dbs with large blobs, lot's of easy tricks when uuids are immutable digests.

    syncing, say, two blob stores, A and B, boils down to jaccard metric, as a first order approximation

       |(A ∩ B)| / |(A ∪ B)|
    

    diffing the two digest sets at point in time is second order approximation.

    and don't forget logical replication ...