News for hackers. Stuff that matters.
Re:S3 is files, but not a filesystem by orf on Sunday March 10, 2024 @09:07AM (#39658730)
Sure. It's kind of an index - limited to prefix-only searching, but useful.

Say you store uploads associated with a company and a user. You'd maybe naively store them as `[company-uuid]/[user-id].[timestamp]`.

If you need to list a given users (123) uploads after a given date, you'd list keys after `[company-uuid]/123.[date]`. If you need to list all users uploads, you'd list `[company-uuid]/123.`. If you need to get a set of all users who have photos, you'd list `[company-uuid]/` with a Delimiter set to `.`

The point is that it's flexible and with a bit of thought it allows you to "remove all a users uploads between two dates", "remove all a companies uploads" or "remove all a users uploads" with a single call. Or whatever specific stuff is important to your use-case, that might otherwise need a separate DB.

It's not perfect - you can't reverse the listing (i.e you can't get the latest photo for a given user by sorting descending for example), and needs some thought about your key structure.

Re:S3 is files, but not a filesystem by tjoff on Sunday March 10, 2024 @09:18AM (#39658817)
But surely you need to track that elsewhere anyway?

That some niche edge-case runs efficiently doesn't sound like a defining feature of S3. On the contrary many common operations map terrible to S3, so you kind of need the logic to be elsewhere.

Re:S3 is files, but not a filesystem by kbolino on Sunday March 10, 2024 @11:13AM (#39659790)
> But surely you need to track that elsewhere anyway?

Why? If the S3 structure and listing is sufficient, I don't need to store anything else anywhere else.

Many use cases may involve other requirements that S3 can't meet, such as being able to find the same object via different keys, or being able to search through the metadata fields. However, if the requirements match up with S3's structure, then additional services are unnecessary and keeping them in sync with S3 is more hassle than it's worth.

Re:S3 is files, but not a filesystem by tjoff on Sunday March 10, 2024 @11:36AM (#39660008)
I agree, but something as simple (in functionality) as that ought to be an edge-case. Not a defining feature of S3.
Re:S3 is files, but not a filesystem by orf on Sunday March 10, 2024 @12:01PM (#39660197)
It’s fundamental to how S3 works and its ability to scale, so it is a defining feature of S3.

If you think wider, a bucket itself is just a prefix.

Re:S3 is files, but not a filesystem by tjoff on Sunday March 10, 2024 @05:00PM (#39662486)
From amazons perspective, sure!

But that's not what we are discussing.

Re:S3 is files, but not a filesystem by dekhn on Sunday March 10, 2024 @11:56AM (#39660152)
it's a property of the system that I, as an architect, would seriously consider as part of my system's design. I've worked with many systems where iterating over items in order starting from a prefix is extremely cheap (sstables).
Re:S3 is files, but not a filesystem by orf on Sunday March 10, 2024 @10:10AM (#39659226)
My overall point can be summarised as this:

- Listing things is a very common operation to do.

- The POSIX api and the directory/file hierarchy it provides is a restrictive one.

- S3 does not suffer from this, you can recursively list and group keys into directories at “list time”.

- If you find yourself needing to list gigantic numbers of keys in one go, you can do better by only listing a subset. S3 isn’t a filesystem, you shouldn’t need to list 1k+ keys sequentially apart from during maintenance tasks.

- This is actually quite fast, compared to alternatives.

Whether or not you see a use case for this is sort of irrelevant: they exist. it’s what allows you to easily put data into s3 and flexibly group/scan it by specific attributes.

Re:S3 is files, but not a filesystem by tjoff on Sunday March 10, 2024 @10:29AM (#39659395)
Listing things is very common, so why would you outsource that to S3 when all your bookkeeping is elsewhere? It's not like you would ever rely on the POSIX API for that anyway, even for when your files actually are on a POSIX filesystem.

For sure, for maintenance tasks etc. it sounds quite useful. And good hygiene with prefixes sounds like a sane idea. But listing being a critical part of what "makes S3 useful"? That seems like an huge stretch that your points don't seem to address.

Re:S3 is files, but not a filesystem by orf on Sunday March 10, 2024 @02:10PM (#39661189)
> It's not like you would ever rely on the POSIX API for that anyway, even for when your files actually are on a POSIX filesystem.

Because there is no POSIX api for this. Depending on your requirements and query patterns, you may not need a completely separate database that you need to keep in sync.

Re:S3 is files, but not a filesystem by IanCal on Monday March 11, 2024 @10:12PM (#39675483)
You may not need other bookkeeping. The prefix listing properties can be enough, removing the need to have two distinct systems kept in sync.