Thanks for visiting the site !!! Visit below intrested Ads to support us if you like the site .Sharing is caring .keep distance and keep safe . Happy Learning ... 😀

Redis (Remote Dictionary Server )is an in-memory data structure store, used as a distributed, in-memory key–value database, cache and message broker, with optional durability. Redis supports different kinds of abstract data structures, such as strings, lists, maps, sets, sorted sets, HyperLogLogs, bitmaps, streams, and spatial indexes. The project is developed and maintained by a project core team and as of 2015 is sponsored by Redis Labs.

The Redis project began when Salvatore Sanfilippo, nicknamed antirez, the original developer of Redis.

Redis is one of the most powerful in-memory database to server greater End user Experience with hight through put in a real time scenario . Many Organisations has already adopted in the fast growing Digital World .

An In-Memory Open Source Database, supporting a variety of high performance operational, analytics or hybrid use case

An In-Memory Multi-Model Database built on top of open source Redis

Redis – (REmote DIctionary Server) • Open source in-memory database • Key-value store with data structures • Created by Salvatore Sanfilippo (circa 2009) – Source: https://github.com/antirez/redis – Project: redis.io

Redis Enterprise software can be deployed in multiple options .Below diagrams listed all the ways that we can implement based on the organisation infa availability

Redis can be download and installed on VM’s,Can install on Container platforms And also As-A-Service with Cloud platforms like Amazon,Azure and goole cloud . More clouds to add soon as an offering .

Redis can be managed with one of the below offerings .

– Secure Management UI
– Administrative CLI utility
– REST API

How Redis is different from other In Memory DB’s
It’s a data structure store:
• Works as a memory store and database
• Fast read/write performance
• Scales up and out
• Transactional
• Persistent
• Extensible
• Small footprint

Redis Building Blocks are the Data Structures shown on the below screen .

Why Redis –> Because it give better performance , Uses Simple Data Structures and has Extensible modules to give extra power

Redis secrecy of performance

• Written in C
• Single-threaded and lock free
• Data served entirely from memory
• Commands operate on data structures, respond in milliseconds and can be pipelined

Redis cluster performance with the no of nodes shown in the below table

Redis simplicity

• Developers can use familiar data structures • Operations execute at database level – not the application • With a key/value store, there is no need to work with relational tables and complex SQL statements • Each data type offers simple commands to operate on them • Your database code is cleaner and and more performant

Redis Extensibility: Redis Modules Extend Redis Infinitely

• Add-ons that use a Redis API to seamlessly support additional use-cases and data structures
• Modules turn Redis into a Multi-Model database
• Modules still enjoy Redis’ simplicity,
extreme performance, scalability, resiliency and high-availability
• Leverage existing data structures or introduce new ones
• Redis Enterprise Modules are tested and certified by Redis Labs.

Redis Multi-Model DataBase

Redis Graphs

Redis as a simple cache and how it excels the performance


The Problem
• Multiple database calls create impossibly slow web page response times

Why Redis Excels
Strings are key/value pairs
SET saves session variables
GET retrieves values
Redis supports Strings and caching
• Strings store text, which might be made from the results of multiple database queries and HTML
• Support expiry
• Register to listen for changes on keys
and operations
• Multiple eviction policies supported

> SET userid:1 “<HTML></HTML>” 
> GET userid:1
> EXPIRE userid:1 60

> DEL userid:1
 

jedis.set("userid:1", “<HTML></HTML>"); 
jedis.get("userid:1"); 
jedis.expire("userid:1", 60); 
jedis.del("userid:1");

Redis supports as a Session store

The Problem
Maintain session state across multiple servers
Multiple session variables
High speed/low latency required

Why Redis Excels
Hashes are sets of field-value pairs (similar to a Python dictionary, Java Map, etc.)
HSET saves variables as fields
HMGET retrieve multiple values
HINCRBY increments integer
fields
HDEL deletes a field
Redis Hashes and Session Storage

hash key: usersession:1

userid8754
namedave
ip10:20:104:31
hits2
lastpagehome
> HSET usersession:1 userid 8754 name dave ip 10:20:104:31 hits 1 
> HMGET usersession:1 userid name ip hits
> HINCRBY usersession:1 hits 1

> HSET usersession:1 lastpage “home” 
> HGET usersession:1 lastpage
> HDEL usersession:1 lastpage

> DEL usersession:1

Note: Hashes store a mapping of keys to values – like a dictionary or associative array

Redis can be used as a Queue


The Problem
•Tasks need to be processed async to reduce block/wait times
•Assign items to worker process and remove from queue at the same time
•Similar to buffering high speed data-ingestion
• High speed/low latency required

Why Redis Excels
Lists are value queues
LPUSH, RPUSH add values to
beginning or end of queue
RPOPLPUSH pops an item from
one queue and pushes it to another
  • > LPUSH queue1 orange
  • > LPUSH queue1 green
  • > LPUSH queue1 blue
  • > RPUSH queue1 red

RPOPLPUSH pops a value from one list and pushes it to another list

Redis as a Recommendation Engine

The Problem
-People who read this article also read these other articles
-Want real-time, not data mining

Also used for:
-Recommending similar purchases
-Identifying fraud

Why Redis Excels
SETS are collections of unique strings – great for tagging!
SADD adds tags to each article • SISMEMBER checks if an article
has a given tag
SMEMBERS gets all article tags
SINTER finds similar articles with
the same tags

Set: tag:1 –>

article 1article 3….

Set: tag:2

article 3article 4.rticle 22

Set: tag:3

article 2article 3article 9

Add values (articles) to Sets (tags) > SADD tag:1 article:3 article:1 > SADD tag:2 article:22 article:14 article:3 > SADD tag:3 article:9 article:3 article:2 Confirm the values have been added > SMEMBERS tag:3 (also tag:1 & tag:2) 1) “article:3” 2) “article:2” 3) “article:9″ Find values that exist in all three Sets > SINTER tag:1 tag:2 tag:3 1)”article:3”

Redis as a Leaderboard Store


The Problem
• MANY users playing a game or collecting points
• Display real-time leaderboard
• Who is your nearest
competition?
• Disk-based DB is too slow

Why Redis Excels
Sorted Sets associated set elements with a score
ZADD adds/updates a score • ZRANGE, ZREVRANGE gets
users in score ranges
ZRANK gets a users rank
instantantly
Redis as a Geo Locator

The Problem
• Give me all the pharmacies within a 2 km radius
• How far am I from the hospital?

Why Redis Excels
GeoSet stores location as a Geohash
GEOADD adds a location
GEODIST gets distance
GEORADIUS gets locations
within a given radius
Redis Geospatial Indexes for Geolocation
--------------------------------------------------------
> GEOADD pharmacies -0.310392 51.456454 "Charles Harry Pharmacy"
> GEOADD pharmacies -0.296402 51.462069 "Richmond Pharmacy"
> GEOADD pharmacies -0.318604 51.455338 "St Margaret's Pharmacy"

> GEORADIUS pharmacies -0.30566239999996014 51.452921 600 m WITHDIST WITHCOORD ASC
1) 1) "Charles Harry Pharmacy"
      2) "511.6979"
      3) 1) "-0.31039327383041382"
         2) "51.45645288459863309"
Redis as a Pub/Sub Message Bus

The Problem
• IoT device sending sensor information to multiple services
• App sending out messages about activities to multiple users

Why Redis Excels
Pub/Sub broadcasts messages to subscribed listeners
PUBLISH sends messages • SUBSCRIBE gets messages
Redis as a Time Series Repository

The Problem
• IoT device sending sensor information on several metrics
• Need to show the metrics in graphs for visualization

Why Redis Excels
Streams collects messages in an efficient queue structure
XADD store messages
XRANGE retrieve messages

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *