UniversumDB is a high-performance key-value pair database designed for handling large number of concurrent client connections. It supports both purely in-memory storage as well as persistent LSM (Log-structured merge tree) based storage engine. Currently the database is expected to run on a single node where it can take advantage of multi-core CPUs, although the distribured/clustered setup is still part of the roadmap.
- In-memory KV pair storage (ttl supported)
- Persistent KV pair storage (ttl supported)
- All standard commands supported (i.e, exists, get, set, delete, append, incr/decr, etc)
- Bulk Get/Set/Delete operations supported for high performance
- Manual and auto data snapshot with auto-replay (memory engine)
- Multithreaded io engine with pooling & long running connections
- Info & Statistics API for monitoring
Command | Description |
---|---|
PING |
Check if the server is responsive. |
EXISTS |
Determine if a key exists in the database. |
GET |
Retrieve the value associated with a key. |
SET |
Set a value for a key with optional expiration time. |
DELETE |
Remove a key and its associated value from the database. |
INCR |
Increment the integer value of a key. |
DECR |
Decrement the integer value of a key. |
APPEND |
Append a value to a string key. |
MGET |
Retrieve values for multiple keys at once. |
MSET |
Set multiple key-value pairs at once. |
MDELETE |
Delete multiple keys at once. |
TTL |
Get the remaining time-to-live (TTL) of a key. |
EXPIRE |
Set a timeout on a key, after which it will be deleted. |
SNAPSHOT |
Starts snapshot of all database records into a file |
INFO |
Retrieve server and database information. |
HELP |
Prints usage and syntax details of all other commands |
Details command syntax and request/response summary can be found at command summary document.
- Go 1.22 or higher
- *Nix systems (linux/darwin/simiar)
-
Clone the repository
git clone https://github.com/cshekharsharma/universum.git cd universum
-
Running Tests
make test
-
Build the project
make build-dev [or build-prod]
-
Build and run
make all-dev [or all-prod]
Universum uses a toml configuration file for configuring the server behaviour, and that file can be put anywhere on the disk with readable path that will be provided to the server at startup. The recommended path for the config file is at /etc/universum/config.toml
.
Detailed config params and their significance are explained at config summary document.
The server listens for TCP connections on the specified port and processes client requests. Each request is handled by a worker, which reads from the connection, processes commands, and sends the response back to the client.
To test the server using nc
:
nc localhost 11191
You can then send RESP3-style commands, such as:
SET key value
GET key
To contribute:
- Fork the repository
- Submit a pull request
- Open issues for bugs or feature requests
This project is licensed under the Apache 2.0 License.
- Cluster Mode: Support of running the database in distributed manner.
- Authentication: Add client authentication for secure connections.
- RANGE Queries: Add support of range based and aggregation queries.
- More Datastructures: Add support of complex DS like lists, map, bitfields.
- Monitoring: More robust monitoring support and integration with telemetry tools.
For any support, contact shekharsharma705@gmail.com.