Rewrite Redis in Rust for evaluation and learning.

Related tags

Database drill-redis
Overview

Drill-Redis

This library has been created for the purpose of evaluating Rust functionality and performance. As such, it has not been fully tested. The goal is to make it simple and usable as a learning tool.

async/await

In this project, async_std was used for asyna/await runtime.

For more information about async/await for async_std, please refer to the following site

Async programming in Rust with async-std

Tutorial: Writing a chat

https://book.async.rs/tutorial/index.html

Usage

Build Redis server in release mode.

cargo build --bin dredis --release

Build Redis client in release mode.

cargo build --bin dredis-cli --release

Make the document with private items.

cargo doc --no-deps --document-private-items --open

Start Redis server in release mode.

cargo run --bin dredis --release

Start Redis client in release mode.

cargo run --bin dredis-cli --release

How to specify a worker thread number.

export ASYNC_STD_THREAD_COUNT=1

How to execute handlers in a single thread. Modify listener.rs to the following.

task::spawn(
    to
task::spawn_local(

Implemented commands

  • APPEND
  • DEL
  • EXISTS
  • EXPIRE
  • GET
  • GETEX - EXAT, PXAT options are not Implemented.
  • PERSIST
  • PEXPIER
  • PING
  • PTTL
  • SET - EXAT, PXAT options are not Implemented.
  • TTL

For more information about Redis commands, please refer to the following.

https://redis.io/commands

Issue

Compared to the original Redis1, the throughput is the similar but the CPU usage is about three times higher. (Running in a single thread by using task::spawn_local instead of task::spawn, the throughput and CPU usage were almost the same as the original Redis.)

The following commands were run as benchmarks.2

redis-benchmark -c 50 -n 1000000 -q

Contributing

Bug reports and suggestions for improvements are welcome.

License

The source code is licensed MIT.

Footnotes

  1. Redis 2.2.0 was used for benchmarking.

  2. Modified to execute only PING, GET, and SET.

You might also like...
Redis compatible server framework for Rust
Redis compatible server framework for Rust

Redis compatible server framework for Rust Features Create a fast custom Redis compatible server in Rust Simple API. Support for pipelining and telnet

An intentionally-limited Rust implementation of the Redis server with no external dependencies.

lil-redis An intentionally-limited Rust implementation of the Redis server. lil redis is an accessible implementation of a very basic Redis server (wi

📺 Netflix in Rust/ React-TS/ NextJS, Actix-Web, Async Apollo-GraphQl, Cassandra/ ScyllaDB, Async SQLx, Kafka, Redis, Tokio, Actix, Elasticsearch, Influxdb Iox, Tensorflow, AWS
📺 Netflix in Rust/ React-TS/ NextJS, Actix-Web, Async Apollo-GraphQl, Cassandra/ ScyllaDB, Async SQLx, Kafka, Redis, Tokio, Actix, Elasticsearch, Influxdb Iox, Tensorflow, AWS

Fullstack Movie Streaming Platform 📺 Netflix in RUST/ NextJS, Actix-Web, Async Apollo-GraphQl, Cassandra/ ScyllaDB, Async SQLx, Spark, Kafka, Redis,

Sharded, concurrent mini redis that support http interface implemented in rust

Rudis A mini version of redis server that provides http interface implemented in Rust. The in-memorry kv-storage is sharded and concurrent safe. Inspi

RedisJSON - a JSON data type for Redis

RedisJSON RedisJSON is a Redis module that implements ECMA-404 The JSON Data Interchange Standard as a native data type. It allows storing, updating a

[POC] Redis Module for TiKV

RedisTikvPoc [POC] Redis Module for TiKV This is a POC repository. This Redis Module will add branch new Redis commands to operate TiKV data. After bu

A port of `java.util.*SummaryStatistics` as a Redis Module

RedisNumbersStats RedisNumbersStats is a Redis module that implements a Redis version of the Java Util *SummaryStatistics classes, such as DoubleSumma

A simplified version of a Redis server supporting SET/GET commands

This is a starting point for Rust solutions to the "Build Your Own Redis" Challenge. In this challenge, you'll build a toy Redis clone that's capable

A cross-platform redis gui client

Redis-Manager A cross-platform redis gui client started developing with Tauri, React and Typescript in Vite. Get Started Prerequisites Install Node.js

Owner
Akira Kawahara
Akira Kawahara
Incomplete Redis client and server implementation using Tokio - for learning purposes only

mini-redis mini-redis is an incomplete, idiomatic implementation of a Redis client and server built with Tokio. The intent of this project is to provi

Tokio 2.3k Jan 4, 2023
Learning Rust by implementing parts of redis.

Redis This is a simple CLI Redis inspired project that supports the GET, SET, and INCR commands. Run it Have rust installed (if you don't, visit rustu

Shahzeb K. 3 Mar 28, 2024
Lightweight async Redis client with connection pooling written in pure Rust and 100% memory safe

redi-rs (or redirs) redi-rs is a Lightweight Redis client with connection pooling written in Rust and 100% memory safe redi-rs is a Redis client writt

Oğuz Türkay 4 May 20, 2023
Simple and flexible queue implementation for Rust with support for multiple backends (Redis, RabbitMQ, SQS, etc.)

Omniqueue Omniqueue is an abstraction layer over queue backends for Rust. It includes support for RabbitMQ, Redis streams, and SQS out of the box. The

Svix 8 May 26, 2023
RedisLess is a fast, lightweight, embedded and scalable in-memory Key/Value store library compatible with the Redis API.

RedisLess is a fast, lightweight, embedded and scalable in-memory Key/Value store library compatible with the Redis API.

Qovery 145 Nov 23, 2022
Macros for redis-rs to serialize and deserialize structs automatically

redis-macros Simple macros and wrappers to redis-rs to automatically serialize and deserialize structs with serde. Installation To install it, simply

Daniel Grant 4 Feb 18, 2023
Redis re-implemented in Rust.

rsedis Redis re-implemented in Rust. Why? To learn Rust. Use Cases rsedis does not rely on UNIX-specific features. Windows users can run it as a repla

Sebastian Waisbrot 1.6k Jan 6, 2023
Redis library for rust

redis-rs Redis-rs is a high level redis library for Rust. It provides convenient access to all Redis functionality through a very flexible but low-lev

Armin Ronacher 2.8k Jan 8, 2023
A rust Key-Value store based on Redis.

Key-Value Store A Key-Value store that uses Redis to store data. Built using an async web framework in Rust with a full Command-Line interface and log

Miguel David Salcedo 0 Jan 14, 2022
Basic Redis Protocol specification in Rust

Basic Redis Protocol specification in Rust

Bruno 1 Jan 20, 2022