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

Overview

Rudis

A mini version of redis server that provides http interface implemented in Rust. The in-memorry kv-storage is sharded and concurrent safe. Inspired by Tokio's tutorial and Webdis

This is a still work-in-progress project and is not meant to be used in production(yet). Only basic commands like GET and SET are supported. More commands will be added in the future.

There is also the Experimental Version which adapatively uses io_uring on supported kernels. If kernel does not support io_uring, it will fall back to using epoll/kqueue. This version is not published to the crates and therefore needs to be cloned and built locally. It requires nightly rust compiler to be built.

Installation

cargo install rudis-http

Usage

To run the server, simply run

$ rudis-http

or you can optionally specify the address, num shards (more to be added later)

$ rudis-http -n <num_shards> -a <address_to_listen_on>

# to view all commands, do
$ rudis-http --help

And the server will be listening on the port you specified or 127.0.0.1:6379 by default.

Once the server is up and running, its service can be accessed via http GET request. The following are the supported requests:

GET: <your-url>/GET/<key> 
SET: <your-url>/SET/<key>/<value>

The response will be in json format. For a SET, you will be getting the status of this command like

$ curl 'localhost:6379/set/hello/world'
{"SET": "OK"}

# or if SET's arguments are not correct
$ curl 'localhost:6379/set/hello'
{"SET": "Invalid"}

You can also send a POST request with json as key value pair to support a SET command.

$ curl -X POST 'localhost:6379/set' -d '{"hello":"world"}'
{"SET": "OK"}

$ curl -X POST 'localhost:6379/set' -d '{}'
{"SET": "Invalid"}
# for multiple kv pairs
$ curl -X POST 'localhost:6379/set' -d '{"hello":"world", "foo":"bar"}'
{"SET": "OK}

and for get, you will be getting the key value pair if there's a match, or an empty json object if there's no match

$ curl 'localhost:6379/get/hello'     
{"hello":"world"}

# if key does not exist
$ curl 'localhost:6379/GET/123'
{}

# if GET's arguments are not correct
$ curl 'localhost:6379/GET'
{"GET": "Invalid"}

Any other types of commands will be responded with an empty json object

Todo

  • more cli options
  • set argument's TTL
  • general purpose client, and build http interface on top of that
  • .rdb file generation and backup
  • authentication

Finsihed Todos

  • cachepadded for mutex
  • support post request with json as arguments
You might also like...
Basic Redis Protocol specification in Rust

Basic Redis Protocol specification in Rust

Rewrite Redis in Rust for evaluation and learning.

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

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,

Lightweight async Redis client with connection pooling written in pure Rust and 100% memory safe
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

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.

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

Owner
Lorenzo Cao
UCLA CS 24' | @RiotGames ex-@cisco
Lorenzo Cao
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
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
A mini kv database demo that using simplified bitcask storage model with rust implementation

A mini kv database demo that using simplified bitcask storage model with rust implementation.

Wancheng Long 17 Nov 28, 2022
Mini client for rust.

Labrador   Labrador - Mini client for rust This create offers: A convenient mainstream third-party service client Convenient and quick use of correspo

潘安 13 Dec 9, 2022
Plugin for macro-, mini-quad (quads) to save data in simple local storage using Web Storage API in WASM and local file on a native platforms.

quad-storage This is the crate to save data in persistent local storage in miniquad/macroquad environment. In WASM the data persists even if tab or br

ilya sheprut 9 Jan 4, 2023
Für Elise (short for Elise) is a concurrent garbage collection attempt based on shifgrethor.

Für Elise (short for Elise) is a concurrent garbage collection attempt based on shifgrethor. The goal is to define an API for precise, tracing garbage collection in Rust which upholds all of Rust's safety guarantees. A user using the API defined in this library will not be at risk for any of the kinds of memory errors that Rust can prevent.

Ngo Iok Ui (Wu Yu Wei) 38 Dec 29, 2022
A concurrent GC.

Für Elise What is elise? Für Elise (short for Elise) is a concurrent garbage collection attempt based on shifgrethor. The goal is to define an API for

Ngo Iok Ui (Wu Yu Wei) 38 Dec 29, 2022
High-performance, lock-free local and concurrent object memory pool with automated allocation, cleanup, and verification.

Opool: Fast lock-free concurrent and local object pool Opool is a high-performance Rust library that offers a concurrent and local object pool impleme

Khashayar Fereidani 8 Jun 3, 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