Coder Social home page Coder Social logo

v92 / libiorouter Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 0.0 566 KB

libiorouter is LD_PRELOAD library for caching data and metadata requests from backend directory to local directory transparently to application.

License: GNU General Public License v3.0

Makefile 0.28% C 56.59% Python 26.29% Shell 16.83%

libiorouter's People

Contributors

capkovic avatar v92 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

libiorouter's Issues

libiorouter in /etc/ld.so.preload

We have to be able to have library in /etc/ld.so.preload without other effect on system than handling better IO on rewrited directory.

do not generate cache mode

We need to have mode where cache is not generated but:

  • can be used if data exist in shadow directory
  • reporting data and metadata changing operations to log

Segfaults of CMake with libiorouter

Hello,

I am trying to use libiorouter inside CI process and I am facing some issues, starting with CMake.

For the reproduce purpose I am using the default libiorouter.h with env LIBIOR_IO=on.

Steps to reproduce:

mkdir -p /tmp/cmake-test/build
cd /tmp/cmake-test/build
echo 'program(foo C CXX)' > ../CMakeLists.txt
LIBIOR_IO=on LD_PRELOAD=/path/to/libiorouter.so cmake ..

Strace output:

(...)
getcwd("/tmp/cmake-test/build", 2048)   = 22
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=140, ...}) = 0
lstat("/tmp/cmake-test", {st_mode=S_IFDIR|0700, st_size=80, ...}) = 0
lstat("/tmp/cmake-test/build", {st_mode=S_IFDIR|0700, st_size=60, ...}) = 0
getcwd("/tmp/cmake-test/build", 4096)   = 22
access("cmake", R_OK)                   = -1 ENOENT (No such file or directory)
access("/home/piotr/bin/cmake", R_OK)   = -1 ENOENT (No such file or directory)
access("/usr/local/bin/cmake", R_OK)    = -1 ENOENT (No such file or directory)
access("/usr/bin/cmake", R_OK)          = 0
stat("/usr/bin/cmake", {st_mode=S_IFREG|0755, st_size=4508920, ...}) = 0
access("/usr/bin/cmake", R_OK)          = 0
access("/usr/bin/cmake", R_OK)          = 0
lstat("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/bin", {st_mode=S_IFDIR|0755, st_size=69632, ...}) = 0
lstat("/usr/bin/cmake", {st_mode=S_IFREG|0755, st_size=4508920, ...}) = 0
access("/usr/bin/cmake-gui", R_OK)      = -1 ENOENT (No such file or directory)
access("/usr/bin/ccmake", R_OK)         = 0
access("/usr/share/cmake/Modules/CMake.cmake", R_OK) = 0
getcwd("/tmp/cmake-test/build", 2048)   = 22
getcwd("/tmp/cmake-test/build", 4096)   = 22
stat("..", {st_mode=S_IFDIR|0700, st_size=80, ...}) = 0
getcwd("/tmp/cmake-test/build", 2048)   = 22
access("/tmp/cmake-test/CMakeCache.txt", R_OK) = -1 ENOENT (No such file or directory)
access("/tmp/cmake-test/CMakeLists.txt", R_OK) = 0
getcwd("/tmp/cmake-test/build", 2048)   = 22
access("/tmp/cmake-test/build/CMakeCache.txt", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/tmp/cmake-test/build/CMakeFiles/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("", 0x7ffee756d3f0)                = -1 ENOENT (No such file or directory)
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0} ---
+++ killed by SIGSEGV +++

open() does not handle zero sized cache files

Because files can be created by openat() function (with zero size), we have to handle situation where size of file in cache is 0, so we have to reread it again from backend storage.

rename() has to be implemented

We would need also rename() funcionality.

rename() would be a bit harder to implement because we have to handle varioius situations:

  • src rel, dst rel
  • src absolute,dst rel
  • src rel, dst absolute
  • src absolute,dst absolute
  • renameat() variant

create() has to be implemented

We have to implement hook on create() because there can be scenario where we app calls create() and then readdir() .

Without create() hook it would simply return directory from cache without created file.

does not handle xcache stat()

xcache passes somehow our IO hook for stat, probably because it directly calls stat syscal. We have to hook PHP's zend VCWD_STAT function which is basically the same as stat().

setup through env variables

Environment variables should be used to configure modes for libiorouter, cache directory or backend directory.

CI tests

Create series of CI (using travis-ci) tests which uses

  • cthon04 framework
  • xfstests suite
    to be sure, that we're not changing fundamental behaviour of called IO functions but only their speed.

libiorouter does not seems to cache anything.

Hi,

libiorouter does not seems to work at all here.

I've set env variable LIBIOR_IO=yes, I have also modified libiorouter.h:

#define DEFAULT_SOCK_PATH "/dev/shm/libiorouter.sock"
#define DEFAULT_CACHEDIR "/dev/shm/io_cache/"
#define DEFAULT_REWRITEDIR "/home/"

then I've been testing few random binaries like sh, cat or vim with LD_PRELOAD set on the new libiorouter.so, no cache has been created in /dev/shm/io_cache/, also I've notice multiple failures while opening /dev/shm/io_cache//libiorouter. After manually creating it some .stats and .journal has been created there.

When checking on /home/piotr/.zshrc one of .stats files does indeed contain

libiorouter has been inicialized.
1436981265.768451 CALL open /home/piotr/.zshrc

However there seems to not be any cache in /dev/shm/io_cache/ at all.

readdir is not thread safe

readdir is not thread safe because it is using statical buffer. We have to rewrote code to readdir_r which should be fine.

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.