Code Monkey home page Code Monkey logo

xcache's Introduction

XCACHE

Introduction

xcache is based on ccache. It can store the outputs of compile into remote servers.

It consists of several components:

  • xcache

A new in-memory database which has high efficiency. All the outputs of compile will be stored in it.

  • xcache_client

It's just the ccache with the capability to communicate with the xcache.

  • xcache_monitor

The monitor of the xcache.

How to build

cd server && make -j

cd client && ./autogen.sh && ./configure && make -j

xcache and xcache_monitor under the directory of server

xcache_client under the the directory of server

How to use:

Single Mode

  • Setup the xcache on remote server which is 127.0.0.1. We will run:

xcache -d -c -p 20190 -m 1

The parameter -d means to run as a daemon.

The parameter -c means to generate a core file when xcache crashed.

The parameter -m 1 means to set the original memory of the database to 1G.You can change the value by yourself.

The parameter -p 20190 means to set the port to 20190. You can change the value you like.

You can run xcache -h to see another parameters available.

  • Setup the xcache_client, Please run any one of the following commands.

export CCACHE_REMOTE_CONF="--SERVER=127.0.0.1:20190 10"

The value 10 is the xcache_core, please see the distribute cluster mode below.

  • Run the ccache to compile

xcache_client gcc test.c -c -o test.o

Distributed Cluster Mode

  • Setup the xcache on remote server which is 127.0.0.1. We will run two databases.

xcache -d -c -p 20190 -m 1

xcache -d -c -p 20191 -m 1

The parameter -d means to run as a daemon.

The parameter -c means to generate a core file when xcache crashed.

The parameter -m 1 means to set the original memory of the database to 1G.You can change the value by yourself.

The parameter -p 20190 means to set the port to 20190. You can change the value you like.

You can run xcache -h to see another parameters available.

  • Setup the proxy on remote server which is 127.0.0.1. Please run:

xcache -d -c -p 6666 -P

The parameter -P means to change the xcache to a proxy which has a high priority.

  • Tell the proxy about the information of the xcache. Please run :

xcache_monitor -S 127.0.0.1:6666["--SERVER=127.0.0.1:20190 10 --SERVER=127.0.0.1:20191 10"]

The format of command is like:

xcache_monitor -S proxy_ip:proxy_port["--SERVER=xcache_ip:xcache_port xcache_core"]

The xcache_core means the power of the database. The one which has bigger xcache_core would store more data than others.

  • Setup the xcache_client.

If you don’t use the proxy, please run:

export CCACHE_REMOTE_CONF="--SERVER=127.0.0.1:20190 10 --SERVER=127.0.0.1:20191 10"

If you use the proxy, please run one of the following commands:

export CCACHE_REMOTE_CONF="--PROXY=127.0.0.1:6666"

export CCACHE_REMOTE_CONF=`xcache_monitor -G 127.0.0.1:6666 | tail -1 | grep "SERVER="`

  • Run the ccache to compile

xcache_client gcc test.c -c -o test.o

xcache's People

Contributors

vaneyli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

xcache's Issues

Why can't we convert abspath to relative path for symlink?

Hi,

It is unclear to me why we can't change absolute path to relative path for symlink, we don't need to call realpath(3). This caused cache miss if the input .c/cpp file is a symlink.

thanks,
Justin

        if (is_symlink(argv[i])) {
            // Don't rewrite source file path if it's a symlink since
            // make_relative_path resolves symlinks using realpath(3) and this leads
            // to potentially choosing incorrect relative header files. See the
            // "symlink to source file" test.
            input_file = x_strdup(argv[i]);
        } else {
            // Rewrite to relative to increase hit rate.
            input_file = make_relative_path(x_strdup(argv[i]));
        }

Why I get Assertion error while runing xcache server?

Hi All.
I started xcache and get an error

_xcache/server# ./xcache -p 20190 -m 1
Complied at Dec 18 2022 10:37:34
[0xf7506700  ]slab.c     :slab_init           :248   create new slab id = 0
[0xf7506700  ]slab.c     :slab_init           :248   create new slab id = 1
...
[0xf7506700  ]slab.c     :slab_init           :248   create new slab id = 61
[0xf7506700  ]slab.c     :slab_init           :248   create new slab id = 62
[0xf7506700  ]slab.c     :slab_init           :248   create new slab id = 63
**xcache: slab.c:259: slab_init: Assertion `0 == size % g_config.block_size_align' failed.**
Aborted (core dumped)_

I use i386 Debian GNU/Linux 8.2 (jessie) system
What wrong with me?

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.