SunPoint IT Solutions

Loading...

Blog

Boosting Performance With Redis

             Redis (Remote Dictionary Server): An in-memory data structure store used as a database, cache, and message broker.

                Peculiarity:
1. Internal storage for high performance.

2. A diverse set of data structures (strings, hashes, lists, sets, sorted sets).

               Strings

                Used to store simple data, a counter or a simple object serialized as a string.

                Hashes

                 Used to store objects as a series of fields (properties) and values.

                 Lists

                 Used to store lists of items,  a timeline of activities, or a queue of jobs to be processed.

                 Sets 

                  Used to store unique elements useful for tags, categories, etc.

                  Sorted Sets

                  Save options

                 Redis is an in-memory data store, but it also provides various persistence options to ensure that data is not lost in the event of a server restart or crash.

                  RDB (Redis Database File)

               This is a snapshot mechanism. At specified intervals, Redis takes a snapshot of the data set at a specific point in time and saves it to disk. This is a compact single-file representation of the entire Redis dataset.

                  AOF (only add file)

                AOF persistence records every write operation received from the server, appending it to a file. This file can be replayed when the server is restarted to restore the data to its pre-crash state.

                   Language support

                     Total information

              In a distributed system, applications or services often require access to shared data to perform their functions. Redis provides a fast, in-memory data store for this shared data that any part of the system can access and quickly modify.

                     Using Redis for shared data has several benefits

Centralization. Data that multiple services need to access can be centralized in Redis, greatly reducing the need for each service to connect to multiple data sources.
Scalability: Redis can simultaneously handle a large number of connections from different services, which is very important when scaling the system.

Synchronization. Services can use Redis mechanisms such as Pub/Sub, locks, and semaphores to coordinate tasks or signal each other about changes in shared data.
Consistency: Redis provides atomic operations to ensure that data is always updated, which is important when multiple services are reading and writing the same data at the same time.

                      How to use Redis

◉Set up the Redis server

◉Install the Redis client (StackExchange.Redis).

◉Configure the Redis connection (appsettings.json)

◉Implement the Redis service (Startup.cs/Programm.cs)

◉Use Redis cache

 

https://www.youtube.com/watch?v=lZCp7BY42XY

LATEST POSTS