Live data from Hacker News

S3 is files, but not a filesystem

calpaterson.com

141–150 of 456 posts

Re: S3 is files, but not a filesystem

#141
post #115

> And listing files is slow. While the joy of Amazon S3 is that you can read and write at extremely, extremely, high bandwidths, listing out what is there is much much slower. Slower than a slow local filesystem This misses something critical. Yes, s3 has fast reading and writing, but that’s not really what makes it useful . What makes it useful is listing. In an unversioned bucket (or one with no delete markers), li…

Since 30 years ago (starting with XFS in 1993, which was inspired by HPFS) all the good UNIX file systems implement the directories as some kind of B trees. Therefore they do not get slower proportional to the number of entries and listing based on file prefixes is extremely fast.

> listing based on file prefixes is extremely fast

This functionality does not exist to my knowledge.

ext4 and XFS return directory entries in pseudo-random order (due to hashing), not lexicographically.

For an example, see e.g. https://righteousit.wordpress.com/2022/01/13/xfs-part-6-btre...

If you know a way to return lexicographical order directly from the file system, without the need to sort, please link it.

Re: S3 is files, but not a filesystem

#142
post #56

The limitations of S3 (and all the cloud "file systems") are quite astonishing when you consider you're paying for it as a premium service. Try to imagine your astonishment if a traditional storage vendor showed up and told you that their very expensive premium file system they had just sold you: - can't store log files because it can't append anything to an existing files - can't copy files more than 5GB - can't ren…

They're not filesystems though, they're object storage or key/value storage if you will. It's intended to store the log files for long term once they're full. You can rename / move a file, but it involves copying and deleting the original; I don't understand why they don't have a shortcut for that, but it probably makes sense that the user of the service is aware of the process instead of hiding it. I'm not sure abou…

Current limit is 5TB. The 5GB is for a single upload, you can hover do multipart upload to get up to the maximum size of 5TB.

https://aws.amazon.com/s3/faqs/

Re: S3 is files, but not a filesystem

#143
post #124

Earlier quoted context omitted.

S3 doesn’t have directories, it could be thought of a flat + sorted list of keys. UNIX (and all operating systems) differentiate between a file and a directory. To list the contents of a directory, you need to make an explicit call. That call might return files or directories. So to list all files recursively, you need to list, sort, check if an entry is a directory, recurse”. This isn’t great.

Code written against s3 is not portable either. It doesn’t support azure or gcp, much less some random proprietary cloud.

I've seen several S3-compatible APIs and there are open-source clients. If anything it's the de-facto standard.

Re: S3 is files, but not a filesystem

#144
post #83

Earlier quoted context omitted.

ClickHouse can work with S3 as a main storage. This is possible because a table is a set of immutable data parts. Data parts can be written once and deleted, possibly as a result of a background merge operation. S3 API is almost enough, except for cases of concurrent database updates. In this case, it is not possible to rely on S3 only because it does not support an atomic "write if not exists" operation. That's why…

Is a "write if not exists" atomic operation enouhg as a concurrency primitive for database locks?

Yes, its not necessarily the most efficient mechanism (could be a lot of retries) but its sufficient. See the Delta Lake paper for example [0]

[0] https://people.eecs.berkeley.edu/~matei/papers/2020/vldb_del...

Re: S3 is files, but not a filesystem

#145
post #9

Earlier quoted context omitted.

Yes. It is, in practice, incredibly different. Imagine you have a file named /some/dir/file.jpg. In a filesystem, there’s an inode for /some. It contains an entry for /some/dir, which is also an inode, and then in the very deepest level, there is an inode for /some/dir/file.jpg. You can rename /some to /something_else if you want. Think of it kind of like a table: +-------+--------+----------+-------+ | inode | paren…

Thank you, now I understand what the special 0-byte object refers to. It represents an empty folder. Fair enough, basing folders on object names split by / is pretty inefficient. I wonder why they didn't go with a solution like git's trees.

"folders" do not exist in S3 -- why do you keep insisting that they do?

They appear to exist because the key is split on the slash character for navigation in the web front-end. This gives the familiar appearance of a filesystem, but the implementation is at a much higher level.

Re: S3 is files, but not a filesystem

#146
post #134

Earlier quoted context omitted.

From the article we're commenting on, which is comparing the interface of S3 to the POSIX interface. Not any given filesystem + platform specific interface.

The article does not mention POSIX, or anything about listing files, at all.

The article starts out by making a comparison between the posix api filesystem calls and S3's api. The context is very much a comparison between those two api surface areas.

Re: S3 is files, but not a filesystem

#147
post #124

Earlier quoted context omitted.

S3 doesn’t have directories, it could be thought of a flat + sorted list of keys. UNIX (and all operating systems) differentiate between a file and a directory. To list the contents of a directory, you need to make an explicit call. That call might return files or directories. So to list all files recursively, you need to list, sort, check if an entry is a directory, recurse”. This isn’t great.

Code written against s3 is not portable either. It doesn’t support azure or gcp, much less some random proprietary cloud.

GCP storage buckets implement the S3 api. You can treat them like they were an s3 bucket. Something I do all the time.

Re: S3 is files, but not a filesystem

#148
post #115

> And listing files is slow. While the joy of Amazon S3 is that you can read and write at extremely, extremely, high bandwidths, listing out what is there is much much slower. Slower than a slow local filesystem This misses something critical. Yes, s3 has fast reading and writing, but that’s not really what makes it useful . What makes it useful is listing. In an unversioned bucket (or one with no delete markers), li…

You can set up cloud watch events to trigger a lambda function to store meta data about the s3 file in a regular database. That way you can index it how you expect to list.

Very effective for our use case.

Re: S3 is files, but not a filesystem

#149

Earlier quoted context omitted.

Yeah, the UI and CLI show you “folders”. It’s a client-side thing that doesn’t exist in the actual service. Behind the scenes, the clients are making specific types of queries on the object keys. You can’t examine when a folder was created (it doesn’t exist in the first place), you can’t rename a folder (it doesn’t exist), you can’t delete a folder (again, it doesn’t exist).

That's just an implementation detail of well known filesystems.

I don’t think that’s a defensible standpoint.

Folders are an important part of the way most people use filesystems.

Re: S3 is files, but not a filesystem

#150
post #49

Earlier quoted context omitted.

Similarly the UI in linux is making up the notion of folders and files in them. But we don't say it doesn't exist.

No, they're not made up. A folder (or directory) is a specific type of inode, just a file is. S3 doesn't have folders. The UI fakes them by creating a 0-byte object (or file, if you will). It's a kludge.

The UI will fake them without even creating the 0-byte object.
Post reply on HN