-
Notifications
You must be signed in to change notification settings - Fork 526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
disk cache #82
Comments
Ideally I want to see a generic fuse cache. Implementing all these caching each time someone writes a fuse filesystem doesn't make a lot of sense to me. I am not aware of anyone trying a caching http proxy, it may work if you make it transparent at the network level. Alternatively you can write a middleware for https://github.com/andrewgaul/s3proxy that does caching. |
Could you describe a bit about the caching use cases? |
High-read cases where you don't want or need to re-fetch from S3. In my case I use s3fs with I agree that a generic cache at the FUSE level is the correct place to solve this, but I don't know how feasible that is. |
My use case is the same. I'm currently using s3fs and am depending on cached reads being fast. One set of servers does read and write operations on the filesystem (video editing), but the most important set of servers that do strictly video rendering mount S3 read-only and only read from the filesystem. These really need to have the cache. I agree that a generalized caching solution would be neat, but if that involves backwards incompatible changes to the kernel's fuse interface, this is years down the road, if ever. Thinking of it, maybe it is doable to create a new caching fuse filesystem that wraps goofys? |
and you'd be doing reads from the same videos when you do rendering many times a day? how fast do you need this to be? How big are these files? Do you read the entire files end to end? How much do you care about cache invalidation? For writes, do you write through or write back? A caching fuse fs is definitely doable (with the caveat of extra memory copy), goofys can have some build in support to mount the additional layer. If only |
To be exact, we render videos from basically a definition file and accompanying files (image files, movie files, fonts, tracking files, etc.). In 95 % of the cases, we read the entire file. It's rare that we actually seek in the files. We need some kind of cache invalidation, currently we're fine with the configurable metadata cache in s3fs. I think it's something like 5 seconds or 30 seconds after which s3fs will recheck with S3 if the file/object has changed. I don't understand what write-through vs write-back would mean in this context. I would always be fine with the write ending up in S3 only if the file has been closed. The file should then be uploaded to s3 immediately though. |
when you said you need cache, how much speed up is it providing? ie: what's the read perf for goofys (without cache) vs s3fs (with cache)? |
I'll try to come up with some numbers the next days. |
Ok, this was interesting. I did some measurements on one of our production servers. s3fsSize of data:
s3fs uncached read:
then, cached read:
trying goofys nowfirst run
subsequent runs
aha, goofys works with the filesystem cache
not the latest Linux, by any means:
Reading from a c3.2xlarge EC2 instance in eu-west-1 from a bucket in the same region. |
Unfortunately, the filesystem cache does not do the job for us. The applications on the host use almost all the available memory for their own caches and we need reads to be fast even (and especially) if the data has not been accessed for minutes or hours. If the data is "hot" we have it in our own memory cache anyway. Funny to see that goofys works with the Linux buffer cache, while s3fs does not. |
I suspect this is just a case of metadata operations taking longer in s3fs. |
So I've implemented a generic caching filesystem in fuse: https://github.com/kahing/catfs/ . Happy to hear feedback from people who try to use it with goofys! |
@kahing Thanks for adding caching! any ideas how to pass on --uid= --gid= flags to catfs? for some reason, when --cache is used from fstab the uid and gid are not respected as i'm getting a "Permission denied." error when listing objects using 'ls -lah' (but perhaps it's my own ignorance). With 'sudo' the listing works. Also, the additional catfs flags are unclear to me in fstab-context. I have translated your example: --cache "--free:10%:$HOME/cache" As follows: (which doesn't throw an error, but mount is unsuccessful). When omitting the '--free:10%:' flag as-in: all is well. |
you probably need to plumb through -o allow_other to catfs, something like:
uid and gid shouldn't be necessary for catfs in this context. |
hi @kahing,
and here is the command that I used :
|
@kahidna could you try to enable RUST_LOG=debug and see what catfs outputs? |
@kahing if I run catfs after mount the bucket (with or without --cache) I got this error message :
and if I run catfs first, then mount the bucket, here is the output
and here is the goofys log :
mounting works fine, but folder |
if you want to mount catfs over the same goofys mountpoint, you need to use -ononempty like the error message suggested |
Further to the above, i'm getting the following catfs exit message:
Using https://github.com/kahing/catfs/releases/download/v0.4.0/catfs Any ideas? |
Like what I suggested above, could you set RUST_LOG=debug to see what catfs is exiting? |
if you are launching catfs with goofys, you don't need to explicitly set -ononempty. Also, there's an extra space in "-oallow_other:-ononempty:--free:10%: /tmp/mount/point" |
@kahing my bad...the extra space was a typo (not there in my script). I tried enabling RUST_LOG=debug as follows:
And yes, i'm launching catfs with goofys. Any ideas why catfs exited? |
sudo is probably masking RUST_LOG, could you add |
@valentijnvenus @kahidna should be fixed, thanks for reporting! |
…82) Both in s3 and azure, it is possible that when we call listPrefix with limit=N, we might get a result whose size is smaller than N, but still has a continuation token. This behaviour does not hurt when we are listing the fuse files under a directory. But when doing dir checks i.e. 1) testing if the given path is a directory 2) if a given directory is empty, this can make goofys wrongly think a directory is empty or a given prefix is not a directory. Add a wrapper in list.go, that does this: If the backend returns less items than requested and has a continuation token, it will use the continuation token to fetch more items.
You write that goofys does not have a disk cache. Is that because of a design decision or has it just not been implemented yet. Would you possibly accept a patch that implements it?
I'm asking because we are currently using s3fs but we have run into stability problem and would perhaps use an alternative. Some kind of cache is an absolute requirement, though.
Have you thought about goofys => caching http proxy => s3 yet as an alternative to a disk cache? Has this been tried by anybody, yet?
The text was updated successfully, but these errors were encountered: