RedisLess - Blazingly fast Serverless Redis
Tags: redis, serverless, cloudnative
Published: 2021-04-27 10:34:59


**THIS PROJECT IS NOT PRODUCTION READY YET!!**

Imagine a world where your database is nothing more than a lib in your app 🥰. 

Imagine a world where using Redis is as simple as `npm install redisless`, and that's it!

If you dream of this world (as I do), then you will love RedisLess - and hopefully, be part of this journey 🥳.

# What is RedisLess

**[RedisLess](https://github.com/Qovery/RedisLess) is a fast, lightweight, embedded, and scalable in-memory Key/Value store library compatible with the Redis API.**

> The project is still early, so don't take any of those words for granted at the moment. 

RedisLess is written in Rust and export functions through FFI (Foreign Function Interface), making it usable from any language. I've started to write clients for NodeJS and Python. 

# How to use RedisLess

To use RedisLess, you only need to:

1. Install the RedisLess library for your favorite language.
2. Connect your favorite Redis client to `redis://localhost:16379`.
3. You don't need to change your code - RedisLess is Redis API compatible.

Under the hood, the RedisLess library starts a local Redis API compatible instance on port `16739` (you can change the port).

## Python usage example

Here a simple example in Python

```python
from redisless import RedisLess
import redis

redisless = RedisLess()

# start RedisLess embedded instance
redisless.start()

# Connect to RedisLess on localhost:16379
redis = redis.Redis(host='localhost', port=16379, db=0)

redis.set('foo', 'bar')
redis.get('foo')  # return bar 

# stop RedisLess embedded instance
redisless.stop()
```

As you can see, we are using the official Python Redis client to connect to RedisLess. Nothing else. Meaning, if you are already using Redis in your code, you can use RedisLess without changing a single line of code. Is it magic? No, it is not. Let me explain how it works.

# Supported languages

- [wip] Python
- [wip] NodeJS
- [-] Golang
- [-] Java / Kotlin

Supporting a new language can be done in 5 minutes. Look at [Python](https://github.com/Qovery/RedisLess/tree/main/clients/python) and [NodeJS](https://github.com/Qovery/RedisLess/tree/main/clients/nodejs) clients implementation for inspiration.

# How RedisLess works

![RedisLess vs Redis Server](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cty9r38cylsw6rqhc2iq.jpg)

The main characteristic is that RedisLess runs inside your app, where Redis Server runs inside a dedicated service and instance. It is a considerable difference because RedisLess does not need any external dependency to work. The more you have apps running, the more your app is resilient to failure.

Here is a specs comparison table

| Spec | RedisLess | Redis Server |
|---------|-----------|--------------|
| Redis API compatibility  | partial | full | 
| Serverless  | yes | no | 
| Consistency | strong | strong |
| Read performance | constant | constant |
| Write performance | constant | constant |
| Cluster consistency | eventually | eventually |
| Cluster read performance | constant | constant |
| Cluster write performance | slower | constant |
| Consensus protocol | Raft | RedisRaft |
| Disk persistence | no | yes |
| Support cloud-native environment | yes | no |


## Features highlight

### Redis API
RedisLess is not 100% Redis API compatible. Meaning, some commands like `CLIENT TRACKING`, `AUTH`, and `ACL LOAD` are irrelevant. However, transactions are not available right now but will be in the future. It just takes time to implement features.

### Built for the Cloud
Redis Server was built before the Cloud was a thing. If you want to use Redis Server properly, you have to set up an instance with local storage and do some fine-tuning to make it works properly for high and intensive usage. RedisLess does not need anything like this. No need to spend time managing servers. It works in memory within your app. It is much easier when your app runs in a Cloud-native environment (E.g. within a container / Kubernetes / function as a service) and needs to scale dynamically based on the workload. 

### Slower Cluster write performance
If you are familiar with distributed system, you probably know that it is impossible to have strong consistency, high availability, and high performance all at the same time. You have to choose. Redis Server Cluster lets you decide how you want to configure your cluster and then gives you a choice between performance and availability. With RedisLess, we make the choice of availability for writes and performance for reads with eventual consistency. It is not a definitive choice.

# Contribution

> RedisLess is in its early days, but I am serious about building a solid library to help thousands of developers.

It is never too soon to contribute and be part of a great project. If you are interested in contributing, join us on [Discord](https://discord.qovery.com). 

# Genesa of this project

**One year ago, I started a [company](https://www.qovery.com) with [Pierre Mavro](https://twitter.com/deimosfr)**. We wanted to make app deployment easy for any developer. Today, 2666 developers from more than 110 countries deploy their apps on AWS and Digital Ocean using our product. I saw firsthand how developers struggle during days (sometimes weeks 😨) to deploy their apps. But why is it so complicated? Deploying an app itself is not complex. But setting up all external dependencies to make it works is. What about configuring servers, databases, networks? Even with the Cloud, it is not so simple. That's why [my team](https://www.qovery.com/team) and I wanted to go further than app deployment and **[build the future of database management](https://www.qovery.com/blog/the-easiest-way-to-deploy-your-database-the-future-of-qovery-week-7)**. 

# How to join the project

If you are interested in contributing (even if you don't know yet how). Comment on this post and indicate:

- What languages do you use?
- What is your experience: beginner, experienced, expert?
- Do you have experience in contributing Open-Source projects?
- A few words about you and why you are interested in RedisLess.

------

👉 Please support us with a [Github star](https://github.com/Qovery/RedisLess) ⭐️.

------

Thanks to @pjeziorowski for his contribution to this post. ❤️