A distributed proxy for redis in Erlang. It's based on distributed_proxy.
$ make generate
$ ./rel/redis_proxy/bin/redis_proxy start
$ redis-cli -p 6380
127.0.0.1:6380> SET 1 123
OK
127.0.0.1:6380> GET 1
"123"
set 1 1
get 1
mget 1 2 3
DBSIZE
$ ./rel/redis_proxy/bin/redis_proxy_admin.sh join any_live_node_in_the_cluster@hostname
$ ./rel/redis_proxy/bin/redis_proxy_admin.sh map
$ ./rel/redis_proxy/bin/redis_proxy_admin.sh status
$ ./rel/redis_proxy/bin/redis_proxy_admin.sh replicas %% all replicas status
$ ./rel/redis_proxy/bin/redis_proxy_admin.sh replica replica_id %% a specific replica status
$ ./rel/redis_proxy/bin/redis_proxy_admin.sh locate key %% replica status about a specific key
-
Update config (sys.config).
- Export stat data through exomter_core
%% exometer core config {exometer_core, [ {report, [ {reporters, [ {exometer_report_influxdb, [{protocol, udp}, {host, <<"localhost">>}, {port, 8089}, {db, <<"udp">>}]} ]} ]} ]}
- Enable stat
{redis_proxy, [ ... {enable_stat, true} ]}
-
Restart the application. The stat data will appear in InfluxDB:
measurement name data type frontend_request count of the frontend request frontend_response count of the frontend response backend_request count of the backend request latency time(milliseconds) of request
- Erlang R16B02
$ redis-benchmark -t set,get -q -n 10000 -r 10000 -p 6380 -h test.host -c 200
SET: 5293.81 requests per second
GET: 5437.74 requests per second
$ redis-benchmark -t set,get -q -n 100000 -r 100000 -p 6380 -h test.host -c 200
SET: 16742.01 requests per second
GET: 17543.86 requests per second
$ redis-benchmark -t set,get -q -n 100000 -r 100000 -p 6380 -h test.host -c 200
SET: 17006.80 requests per second
GET: 17537.71 requests per second
$ redis-benchmark -t set,get -q -n 100000 -r 100000 -p 6380 -h test.host -c 200
SET: 18653.24 requests per second
GET: 19409.94 requests per second
$ redis-benchmark -t set,get -q -n 100000 -r 100000 -p 6380 -h test.host -c 200
SET: 18145.53 requests per second
GET: 18667.16 requests per second
$ redis-benchmark -t set,get -q -n 100000 -r 100000 -p 6380 -h test.host -c 200
SET: 17247.33 requests per second
GET: 19346.10 requests per second
$ redis-benchmark -t set,get -q -n 100000 -r 100000 -p 6380 -h test.host -c 200
SET: 17479.46 requests per second
GET: 18497.96 requests per second
- eredis_parser:parse
- distributed_proxy_util:pmap
- redis_proxy_util:locate_key