All Projects → coosto → Redex

coosto / Redex

Licence: apache-2.0
Cloud-native Redis server implemented in Elixir

Programming Languages

elixir
2628 projects

Projects that are alternatives of or similar to Redex

Ioredis
🚀 A robust, performance-focused, and full-featured Redis client for Node.js.
Stars: ✭ 9,754 (+5996.25%)
Mutual labels:  redis, redis-cluster, redis-sentinel
Predixy
A high performance and fully featured proxy for redis, support redis sentinel and redis cluster
Stars: ✭ 862 (+438.75%)
Mutual labels:  redis, redis-cluster, redis-sentinel
Lettuce Core
Advanced Java Redis client for thread-safe sync, async, and reactive usage. Supports Cluster, Sentinel, Pipelining, and codecs.
Stars: ✭ 4,319 (+2599.38%)
Mutual labels:  redis, redis-cluster, redis-sentinel
Fastonosql
FastoNoSQL is a crossplatform Redis, Memcached, SSDB, LevelDB, RocksDB, UnQLite, LMDB, ForestDB, Pika, Dynomite, KeyDB GUI management tool.
Stars: ✭ 1,001 (+525.63%)
Mutual labels:  redis, redis-cluster, redis-sentinel
Predis
A flexible and feature-complete Redis client for PHP.
Stars: ✭ 6,966 (+4253.75%)
Mutual labels:  redis, redis-cluster, redis-sentinel
Camellia
camellia framework by netease-im. provider: 1) redis-client; 2) redis-proxy(redis-sentinel/redis-cluster); 3) hbase-client; 4) others
Stars: ✭ 146 (-8.75%)
Mutual labels:  redis, redis-cluster, redis-sentinel
Phpredis
A PHP extension for Redis
Stars: ✭ 9,203 (+5651.88%)
Mutual labels:  redis, redis-cluster
Fastapi Plugins
FastAPI framework plugins
Stars: ✭ 104 (-35%)
Mutual labels:  redis, redis-sentinel
Php Redis Client
RedisClient is a fast, fully-functional and user-friendly client for Redis, optimized for performance. RedisClient supports the latest versions of Redis starting from 2.6 to 6.0
Stars: ✭ 112 (-30%)
Mutual labels:  redis, redis-cluster
Overlord
Overlord是哔哩哔哩基于Go语言编写的memcache和redis&cluster的代理及集群管理功能,致力于提供自动化高可用的缓存服务解决方案。
Stars: ✭ 1,884 (+1077.5%)
Mutual labels:  redis, redis-cluster
Docker Redis Cluster
Dockerfile for Redis Cluster (redis 3.0+)
Stars: ✭ 1,035 (+546.88%)
Mutual labels:  redis, redis-cluster
Redis Game Transaction
在大型游戏中经常使用分布式,分布式中因为游戏逻辑会经常游戏事务,借助redis特性我们可以实现分布式锁和分布式事务。很多redis集群不支持redis的事务特性。 这个框架用来解决分布式服务器下redis集群事务失效的情况下,基于分布式锁完成分布式事务。支持独占锁,共享锁,读写锁,并且支持事务提交失败情况下的回滚操作,让开发者可以有更多时间侧重游戏逻辑.
Stars: ✭ 124 (-22.5%)
Mutual labels:  redis, redis-cluster
Aioredis Py
asyncio (PEP 3156) Redis support
Stars: ✭ 2,003 (+1151.88%)
Mutual labels:  redis, redis-sentinel
Redis Sentinel Docker
Dockerfile for Redis Sentinel
Stars: ✭ 64 (-60%)
Mutual labels:  redis, redis-sentinel
Nginx Lua Redis Rate Measuring
A lua library to provide distributed rate measurement using nginx + redis, you can use it to do a throttling system within many nodes.
Stars: ✭ 109 (-31.87%)
Mutual labels:  redis, redis-cluster
Flycache
一致性哈希的redis分片存储 (Redis sharding by consistent-hashing)
Stars: ✭ 59 (-63.12%)
Mutual labels:  redis, redis-cluster
Csredis
.NET Core or .NET Framework 4.0+ client for Redis and Redis Sentinel (2.8) and Cluster. Includes both synchronous and asynchronous clients.
Stars: ✭ 1,714 (+971.25%)
Mutual labels:  redis, redis-cluster
Codis
Proxy based Redis cluster solution supporting pipeline and scaling dynamically
Stars: ✭ 12,285 (+7578.13%)
Mutual labels:  redis, redis-cluster
E3 Springboot
SpringBoot+Docker重构宜立方商城
Stars: ✭ 139 (-13.12%)
Mutual labels:  redis, redis-cluster
Redis exporter
Prometheus Exporter for Redis Metrics. Supports Redis 2.x, 3.x, 4.x, 5.x and 6.x
Stars: ✭ 2,092 (+1207.5%)
Mutual labels:  redis, redis-cluster

Redex

Cloud-native strong consistent masterless high available Redis implemented in Elixir.

Docker Image Build Status Coverage Status License

What is Redex?

Redex is an attempt to implement a Redis alternative with cloud-native apps in mind.

What problem does Redex solve?

When running your applications in the cloud, you can easily scale up your app by running multiple instances of it. Now let's assume your application uses Redis to cache some frequently accessed resources or uses its pub/sub features to send events around. What happens when you scale up your application? If you use Redis as a sidecar container to your app, by scaling up your app, you will have standalone instances of Redis running, which is very difficult to manage. Whenever you invalidate a cache entry, you probably want to invalidate it in all instances. Whenever you publish an event, you most likely want that event being published in all instances. You might also want your writes to be immediately available in all instances. What if you use atomic increments/decrements? How can you perform atomic operations across the cluster?

The easiest solution is to run a single instance of Redis so that all instances of your app communicate with that single Redis instance, but then you will lose the fast-access and low-latency benefits of running Redis as a sidecar container, and also this single instance of Redis will become a bottleneck and a single point of failure, preventing scalability and high-availability of your service.

You might also think of setting up a Redis Cluster, but it has its drawbacks. It is difficult to setup, and it needs at least 3 master nodes to work as expected, and 3 slaves for high-availability. Furthermore, it is mainly designed for partitioning/sharding data sets that don't fit in a single instance or for write-intensive use cases where a single instance can not handle all the writes, but in most cases, we don't need partitioning, what we need is replication.

The official solution to have a replicated cluster of Redis nodes is Redis Sentinel, but it also has its downsides. You need at least 3 Sentinel instances for a robust deployment, you need Sentinel support in your clients, you need to do lots of tweaks and scripting to get it to work in dynamic cluster environments like Kubernetes, and there is no guarantee that acknowledged writes are retained during failures, since Redis uses asynchronous replication.

Redex came out of the need for a simple Redis solution that can be used just like a single local Redis instance, while being able to form a replicated cluster once scaled up to multiple instances. You can use Redex as a sidecar container for your apps/microservices, and easily scale up/down your app without worrying about data inconsistencies between nodes. Redex is masterless, clients don't need to know anything about cluster topology, they can interact with the local Redex instance just like a single Redis instance, and unlike Redis, write operations are strong consistent across the cluster.

Is Redex a replacement for Redis?

Of course not. Redex is a solution for use cases where you need a replicated Redis cluster in a dynamic cluster environment like Kubernetes, without all the hassles of official Redis solutions. It is well suited for read-intensive use cases within a small cluster where strong consistency is a requirement, but strong consistency makes write operations gradually slower by adding nodes, hence Redex is not suitable for write-intensive use cases, nor clusters with a large number of nodes.

Redex does not support all the features and commands that Redis provides, it is only suitable for data sets that fit into RAM, and it does not support partitioning data over multiple nodes, nor persisting data to disk.

Redex key features

  • Uses battle-tested Mnesia in-memory database for storage
  • Extremely fast Redis protocol parser implemented with NimbleParsec
  • Writes are strong consistent across the cluster
  • Reads are local, fast, and comparable to Redis
  • Write performance is comparable to Redis in a single node setup, but gradually degrades by adding nodes
  • Supports distributed Publish/Subscribe using erlang's distributed process groups (pg2)
  • Supports automatic cluster formation/healing using Gossip protocol
  • Supports automatic cluster formation/healing using Kubernetes selectors
  • Ease of use (your app interacts with Redex like a local single-node Redis instance)
  • In case of scaling up/down, data is preserved as far as one node remains running
  • Automatic recovery from netsplits (quorum size can be configured to prevent data inconsistency)

Configurations

Redex can be configured using the following env variables:

  • REDEX_IP node's IP address on which other nodes can communicate with it. By default hostname -i is used to detect node's IP address.
  • REDEX_K8S_NAMESPACE and REDEX_K8S_SELECTOR are used to discover redex pods using k8s API to form/heal redex cluster.
  • REDEX_GOSSIP_SECRET secret to be used in gossip strategy.
  • REDEX_QUORUM minimum number of nodes that redex cluster has to obtain in order to become operational. Defaults to 1.
  • REDEX_PORT redex port number (defaults to 6379).

Recovering from network partitions

By setting a proper quorum size, you can enforce consistency in netsplits. In case of a network partition, the partition containing at least the quorum size number of nodes will remain fully functional, and the other side will become read-only. Once they are connected again, read-only part will update itself by copying data from the other side.

Benchmarks

For benchmarks, we can use Redis official benchmark tool redis-benchmark.

First, make sure you have docker-compose installed, then inside benchmark folder run the following command:

docker-compose up -d redex redis

This will start a single node of both Redex and Redis.

Now use these commands to run benchmarks for both Redis and Redex:

docker-compose run redis-benchmark
docker-compose run redex-benchmark

Here is the results on my machine:

# redis-benchmark
SET: 60975.61 requests per second
GET: 61349.69 requests per second

# redex-benchmark
SET: 33557.05 requests per second
GET: 41841.00 requests per second

Now lets scale redex to mutiple nodes and run benchmarks again:

REDEX_QUORUM=2 docker-compose up -d --scale redex=2 redex
docker-compose run redex-benchmark

REDEX_QUORUM=2 docker-compose up -d --scale redex=3 redex
docker-compose run redex-benchmark

REDEX_QUORUM=2 docker-compose up -d --scale redex=4 redex
docker-compose run redex-benchmark

Here is the results on my machine:

# redex-benchmark with 2 nodes
SET: 1974.72 requests per second
GET: 40650.41 requests per second

# redex-benchmark with 3 nodes
SET: 1234.72 requests per second
GET: 40816.32 requests per second

# redex-benchmark with 4 nodes
SET: 996.81 requests per second
GET: 42016.80 requests per second

Of course results would be different if you run each node on a different machine.

Supported Commands

For now only a small subset of the commands are supported:

  • GET
  • MGET
  • SET
  • SETEX
  • MSET
  • GETSET
  • INCR
  • INCRBY
  • DECR
  • DECRBY
  • DEL
  • LPUSH
  • LPOP
  • LLEN
  • LRANGE
  • LINDEX
  • RPUSH
  • RPOP
  • PUBLISH
  • SUBSCRIBE
  • EXPIRE
  • PEXPIRE
  • TTL
  • PTTL
  • PING
  • SELECT
  • KEYS
  • FLUSHALL (without ASYNC argument)
  • INFO (keyspace section only)
  • QUIT

License

Redex source code is released under Apache 2 License.

Credits

Made with ❤️ by @farhadi, supported by Coosto, @coostodev

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].