Giter Club home page Giter Club logo

rcproxy's Introduction

rcproxy

Build Status

Introduction

RCProxy, short for Redis Cluster Proxy, is a redis proxy built on redis 3.0(see redis cluster spec). It aims to be simple, robust and high performance. It caches the cluster topology and implements the MOVED and ASK redirection. Cluster topology is updated on backend server failure or MOVED redirection received. Client is totally transpanrent about the backend data migration.

Getting started

  • Make sure Redis 3.0.0 RC or above has been installed in your PATH. Run 'redis-server --version' to check it.
  • Run 'python start_cluster.py' in tests directory to start the redis cluster
  • Run 'sh bootstrap.sh' in rcproxy to build rcproxy. Note that godep is required to solved dependencies. Otherwise, you can use go get to fetch missing packages.
  • Run 'sh start_proxy.sh' to run rcproxy.
  • Allmost done! Now you can play with it with redis-cli, or run tests/loadrunner.go and tests/random_migration.py to see how it handles slots migration properly, or run tests/bench/redis-benchmark.sh to benchmark it.

Architecture

Each client connection is wrapped with a session, which spawns two goroutines to read request from and write response to the client. Each session appends it's request to dispatcher's request queue, then dispatcher route request to the right task runner according key hash and slot table. Task runner sends requests to its backend server and read responses from it. Upon cluster topology changed, backend server will response MOVED or ASK error. These error is handled by session, by sending request to destination server directly. Session will trigger dispatcher to update slot info on MOVED error. When connection error is returned by task runner, session will trigger dispather to reload topology.

Performance

Benchmark it with tests/bench/redis-benchmark.sh

Status

Product ready

Feedback

Feedbacks and bug reports are highly appreciated. Contact me by [email protected]

rcproxy's People

Contributors

collinmsn 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.