Code Monkey home page Code Monkey logo

catfs's Introduction

Catfs is a caching filesystem written in Rust.

Build Status Crates.io Crates.io Downloads GitHub All Releases Twitter Follow

Overview

Catfs allows you to have cached access to another (possibly remote) filesystem. Caching semantic is read-ahead and write-through (see Current Status). Currently it only provides a data cache and all metadata operations hit the source filesystem.

Catfs is ALPHA software. Don't use this if you value your data.

Installation

  • On Linux, install via pre-built binaries. You may also need to install fuse-utils first.

  • Or build from source which requires Cargo.

:~/catfs$ cargo install catfs
$ # optimized binary now in $HOME/.cargo/bin/catfs

Usage

Catfs requires extended attributes (xattr) to be enabled on the filesystem where files are cached to. Typically this means you need to have user_xattr mount option turned on.

$ catfs <from> <to> <mountpoint>

Catfs will expose files in <from> under <mountpoint>, and cache them to <to> as they are accessed. You can use --free to control how much free space <to>'s filesystem has.

To mount catfs on startup, add this to /etc/fstab:

catfs#/src/dir#/cache/dir /mnt/point    fuse    allow_other,--uid=1001,--gid=1001,--free=1%   0       0

Benchmark

Compare using catfs to cache sshfs vs sshfs only. Topology is laptop - 802.11n - router - 1Gbps wired - desktop. Laptop has SSD whereas desktop has spinning rust.

Benchmark result

Compare running catfs with two local directories on the same filesystem with direct access. This is not a realistic use case but should give you an idea of the worst case slowdown.

Benchmark result

Write is twice as slow as expected since we are writing twice the amount.

To run the benchmark, do:

$ sudo docker run -e SSHFS_SERVER=user@host --rm --privileged --net=host -v $PWD/target:/root/catfs/target kahing/catfs-bench
 # result is written to $PWD/target

The docker container will need to be able to ssh to user@host. Typically I arrange that by mounting the ssh socket from the host

$ sudo docker run -e SSHFS_OPTS="-o ControlPath=/root/.ssh/sockets/%r@%h_%p -o ControlMaster=auto -o StrictHostKeyChecking=no -o Cipher=arcfour user@host:/tmp" -e SSHFS_SERVER=user@host --rm --privileged --net=host -v $HOME/.ssh/sockets:/root/.ssh/sockets  -v $PWD/target:/root/catfs/target kahing/catfs-bench

License

Copyright (C) 2017 Ka-Hing Cheung

Licensed under the Apache License, Version 2.0

Current Status

Catfs is ALPHA software. Don't use this if you value your data.

Entire file is cached if it's open for read, even if nothing is actually read.

Data is written-through to the source and also cached for each write. In case of non-sequential writes, catfs detects ENOTSUP emitted by filesystems like goofys and falls back to flush the entire file on close(). Note that in the latter case even changing one byte will cause the entire file to be re-written.

References

  • Catfs is designed to work with goofys
  • FS-Cache provides caching for some in kernel filesystems but doesn't support other FUSE filesystems.
  • Other similar fuse caching filesystems, no idea about their completeness:

catfs's People

Contributors

kahing avatar gaul avatar yjh0502 avatar jonringer avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.