Git Product home page Git Product logo

memc-rs's Introduction

memcrsd memcached server implementation in Rust

memcrsd is a key value store implementation in Rust. It is compatible with binary protocol of memcached server.

Supported features and compatibility

To check compatibility with memcached server implementation memcrsd project is using memcapable tool from libmemcached library

Here is a capability status for memcrsd:

./memcapable -h 127.0.0.1  -b -p 11211                 
Hostname was provided.127.0.0.1
binary noop                             [pass]
binary quit                             [pass]
binary quitq                            [pass]
binary set                              [pass]
binary setq                             [pass]
binary flush                            [pass]
binary flushq                           [pass]
binary add                              [pass]
binary addq                             [pass]
binary replace                          [pass]
binary replaceq                         [pass]
binary delete                           [pass]
binary deleteq                          [pass]
binary get                              [pass]
binary getq                             [pass]
binary getk                             [pass]
binary getkq                            [pass]
binary incr                             [pass]
binary incrq                            [pass]
binary decr                             [pass]
binary decrq                            [pass]
binary version                          [pass]
binary append                           [pass]
binary appendq                          [pass]
binary prepend                          [pass]
binary prependq                         [pass]
binary stat                             [pass]
All tests passed

Bug reports

Feel free to use the issue tracker on github.

If you are reporting a security bug please contact a maintainer privately. We follow responsible disclosure: we handle reports privately, prepare a patch, allow notifications to vendor lists. Then we push a fix release and your bug can be posted publicly with credit in our release notes and commit history.

Website

Docker image

Docker image is available at docker hub: https://hub.docker.com/r/memcrs/memc-rs

Building docker image

Docker image contains only one binary, so image is pretty small(~8MB). To be able to build docker image additional memory needs to be granted to container that builds final image. Building docker image is divided in 2 stages. In stage one rust:latest image is used to compile static binary and the second stage contains just copies built binary into to final image.

To build docker image memcrsd sources have to be cloned and docker build -m 512m . command executed:

git clone [email protected]:memc-rs/memc-rs.git memc-rs
cd memc-rs
docker build -m 512m .

Publishing docker image

git checkout memcrsd-0.0.1b
docker pull rust
docker build -m 4096m -t memcrsd .
docker images
# tag docker image
docker tag 769dba683c8b memcrs/memc-rs:0.0.1b
docker tag memcrs/memc-rs:0.0.1b memcrs/memc-rs:latest
docker push memcrs/memc-rs:latest
docker push memcrs/memc-rs:0.0.1b

Getting docker image from docker hub

To get latest version of memcrsd run following command:

docker memcrs/memc-rs:latest

If you want specific version please take a look at available tags: https://hub.docker.com/r/memcrs/memc-rs/tags

Testing

memcrsd project is tested using different types of tests:

  • unit testing,
  • fuzzy testing,
  • end-2-end tests

Fuzzy testing

At the moment decoding network packets is fuzzy tested.

Generating test coverage reporting

To generate test coverage there is a convenient shell script that compiles and executed unit tests:

cd memcrs
./coverage.sh
firefox ../target/debug/coverage/index.html

The plan in the future is to have coverage ~90%.

Integration testing

For end-to-end integration testing at the moment memcrsd project is using memcapable tool from libmemcache library. In the future memclt binary will be used to perform end-to-end tests.

Measuring performance

Measuring performance can be tricky, thats why to measure performance memcrsd project is using industry standard benchmarking tool for measuring performance of memcached server which is memtier_benchmark. This tool can be used to generate various traffic patterns. It provides a robust set of customization and reporting capabilities all wrapped into a convenient and easy-to-use command-line interface. More information about memtier benchmark tool can be found on RedisLabs blog.

Memtier benchmark installation

Memtier benchmark is available on github, it needs to be cloned and compiled:

git clone https://github.com/RedisLabs/memtier_benchmark.git
autoreconf -ivf
./configure
make
make install

Generating flamegraph

To be able to sample and resolve Kernel functions:

sudo sh -c " echo 0 > /proc/sys/kernel/kptr_restrict"
sudo sh -c " echo -1 >> /proc/sys/kernel/perf_event_paranoid"

Generating flamegraphs:

sudo apt install -y linux-tools-common linux-tools-generic
cargo install flamegraph
cd ~/projects/memix
cargo flamegraph
cargo flamegraph --bin memcrsd

Attaching perf

By default release profile is built with debug symbols, see Cargo.toml:

[profile.release]
opt-level = 3
debug=true

On Ubuntu install required packages:

sudo apt install -y linux-tools-common linux-tools-generic

We can start a server:

./target/release/memcrsd -v & perf record -F 99 -p `pgrep memcrsd`
  • First we run the memcrsd server and we send it to the background using the ampersand (&) symbol.
  • Next to it, so it executes immediately, we run perf that receives the process identifier (PID) courtesy of pgrep memcrsd.
  • The pgrep command returns the PID of a process by name.

After benchmarks are executed reports can be displayed using perf report:

perf report

memc-rs's People

Contributors

dariuszostolski avatar junnplus 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.