💾 Archived View for mediocregopher.com › posts › generations.gmi captured on 2024-05-26 at 15:01:48. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2024-05-12)

➡️ Next capture (2024-08-18)

🚧 View Differences

-=-=-=-=-=-=-

This post has been translated from it's original markdown format, if it seems busted it might appear better over HTTP:

https://mediocregopher.com/posts/generations

👻 Generations

A simple file distribution strategy for very large scale, high-availability file-services.

The problem

At cryptic.io we plan on having millions of different files, any of which could be arbitrarily chosen to be served any given time. These files are uploaded by users at arbitrary times.

cryptic.io

Scaling such a system is no easy task. The solution I've seen implemented in the past involves shuffling files around on a nearly constant basis, making sure that files which are more "popular" are on fast drives, while at the same time making sure that no drives are at capicty and at the same time that all files, even newly uploaded ones, are stored redundantly.

The problem with this solution is one of coordination. At any given moment the app needs to be able to "find" a file so it can give the client a link to download the file from one of the servers that it's on. Full-filling this simple requirement means that all datastores/caches where information about where a file lives need to be up-to-date at all times, and even then there are race-conditions and network failures to contend with, while at all times the requirements of the app evolve and change.

A simpler solution

Let's say you want all files which get uploaded to be replicated in triplicate in some capacity. You buy three identical hard-disks, and put each on a separate server. As files get uploaded by clients, each file gets put on each drive immediately. When the drives are filled (which should be at around the same time), you stop uploading to them.

That was generation 0.

You buy three more drives, and start putting all files on them instead. This is going to be generation 1. Repeat until you run out of money.

That's it.

That's it?

It seems simple and obvious, and maybe it's the standard thing which is done, but as far as I can tell no-one has written about it (though I'm probably not searching for the right thing, let me know if this is the case!).

Advantages

marlin

Caveats

The big caveat here is that this is just an idea. It has NOT been tested in production. But we have enough faith in it that we're going to give it a shot at cryptic.io. I'll keep this page updated.

cryptic.io

The second caveat is that this scheme does not inherently support caching. If a file suddenly becomes super popular the world over your hard-disks might not be able to keep up, and it's probably not feasible to have an FIO drive in *every* generation. I think that groupcache may be the answer to this problem, assuming your files are reasonably small, but again I haven't tested it yet.

groupcache

========================================

Published 2013-10-08 by mediocregopher

Browse all posts

RSS feed

========================================

Home

Source

License for all content, if you must have one