Redis Introduction
Stands for remote Dictionary Server.
• It is a in-memory key-value pair data store.
• It is used as a database, cache, message broker and queue.
How Redis works?
- Redis store data in-memory and not on HDDs/SSDs.
- Thus seek time delays are eliminated in redis.
- Redis has variety of data structures.
• Redis supports Replication and persistence hence very fast read operations.
Redis use cases
- Caching
- Database queries, persistent session, web page, images, metadata etc all can be cached.
- Data access latency is reduced.
- Throughput is increased.
- And database will have less load.
- Chat, messaging, and queues
- Supports publisher/subscriber model with pattern matching and number of data structures.
- Session store
- Rich media streaming
- Machine Learning
Redis Language support
- Python
- Java
- PHP
- Perl
- Go
- Ruby
- C/C#/C++
- JavaScript
- js
Redis Data structure
- String
- Set
- Lists
- Sorted Lists
- Hashes
Redis architechture

Memory optimization and architecture
- Using 32 bit instance
- As here the pointers are small hence less memory will be utilized but also only 2^32=4GB of memory will be referenced only.
- Bit and byte level operations
- Use hashes when possible
- Hashes require little space hence should be used. Suppose if object has different fields inside then instead use hashes.
Advantages of Redis
- Redis stores data as key value and allow 512MB size for key as well as values.
- Redis follows master slave architecture and allow data replication.
- Redis can allow uninterrupted service and overcome failures.
- Radis has support for various different languages.
- Radis supports publisher subscriber messaging model.
- Radis support transaction hence multiple commands will be queued instead of running one at a time.
- Redis is having very low latency for read operations.
- Redis operations are atomic i.e. latest value is used.
- Redis has different type of data structures.
Disadvantages of Redis
- We have to limit our data because everything is on main memory.
- Since Data is sharded based on the hash-slots assigned to each Master. If Master holding some slots is down, data to be written to that slot will be lost.
- Clients connecting to the Redis cluster are aware of the cluster topology, causing overhead configuration on Clients.
Redis and other databases(vs mongodb)

Redis vs Memcached

Connect with nodejs
