Databases 12 min read

Redis Overview, Features, Use Cases, and Installation Guide

This article introduces Redis as an open‑source, high‑performance in‑memory key‑value store, explains its rich data structures, underlying implementations, performance advantages, common use cases such as caching and messaging, and provides step‑by‑step installation and basic command examples for Ubuntu systems.

Top Architect
Top Architect
Top Architect
Redis Overview, Features, Use Cases, and Installation Guide

Redis Overview

Redis (Remote Dictionary Server) is an open‑source, high‑performance in‑memory key‑value store originally developed by Salvatore Sanfilippo. It keeps data in memory, offers persistence to disk, and serves as a NoSQL database.

Its basic data types include string , list (double‑linked list), hash (key‑value map), set (unique collection), and sorted set (ordered collection), allowing storage and processing of complex data.

Data Structure Implementation

string

list

hash

set

sorted set

Simple Dynamic String

Doubly Linked List, Ziplist

Ziplist, Hash Table

Ziplist, Integer Array

Ziplist, Skip List

Underlying time‑complexity:

skip list

doubly linked list

ziplist

hash table

integer array

O(log N)

O(N)

O(N)

O(1)

O(N)

Redis Features / Advantages

Rich Data Structures : Supports strings, hashes, lists, sets, and sorted sets with many operations.

Persistence : Offers RDB snapshots and AOF append‑only file for data durability.

High Performance : In‑memory storage and single‑threaded design fully utilize CPU and memory.

Transactions : Allows atomic execution of multiple commands.

High Availability & Distributed : Provides master‑slave replication, Sentinel, and Cluster for scaling and fault tolerance.

Publish/Subscribe : Enables decoupled real‑time messaging.

Why Redis Is Fast

Memory Storage : Reads and writes occur in RAM, far faster than disk.

Single‑Threaded Model : Eliminates lock contention and uses I/O multiplexing (epoll/kqueue).

Non‑Blocking I/O : Operations never block other requests.

Efficient Data Structures : Most operations run in constant time.

Asynchronous Operations : Async persistence and replication avoid blocking.

Optimized Network Protocol : RESP is simple and compact, reducing overhead.

Atomic Operations : Commands like INCR, DECR, SETNX are indivisible.

Application Scenarios

Cache : Store frequently accessed data in memory to accelerate response times.

Counter : Use atomic increments for likes, views, etc.

Message Queue : Leverage Pub/Sub and list structures for simple queuing.

Leaderboard : Sorted sets enable real‑time ranking.

Session Store : Share user session data across multiple web servers.

Installation and Usage

Installation on Ubuntu is straightforward using the package manager:

sudo apt update
sudo apt install redis-server

Start the Redis service:

sudo systemctl start redis-server

Connect to the server with the redis-cli command‑line tool:

redis-cli

Common Commands

SET key value – Set a string value.

GET key – Retrieve a string value.

SETEX key seconds value – Set a value with an expiration time.

DEL key – Delete a key.

LPUSH list_key value1 value2 ... – Push elements to the left of a list.

RPUSH list_key value1 value2 ... – Push elements to the right of a list.

LRANGE list_key 0 -1 – Retrieve all elements of a list.

Conclusion

Redis is a powerful in‑memory database widely adopted in high‑traffic scenarios. Its speed, rich data structures, persistence options, and high‑availability features make it ideal for caching, counters, message queues, leaderboards, and session management.

PerformanceRedisData StructuresinstallationIn-Memory DatabaseKey-Value Store
Top Architect
Written by

Top Architect

Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.