Introduction to Redis and its features.pptx

knoldus 47 views 28 slides May 03, 2024
Slide 1
Slide 1 of 28
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28

About This Presentation

Join us for an interactive session where we'll cover the fundamentals of Redis, practical use cases, and best practices for incorporating Redis into your projects. Whether you're a developer, architect, or system administrator, this session will equip you with the knowledge to harness the fu...


Slide Content

Introduction to Redis & It’s Features Presented By : Gaurav Srivastav (Senior Software Consultant)

Lack of etiquette and manners is a huge turn off.   KnolX Etiquettes Punctuality Join the session 5 minutes prior to the session start time. We start on time and conclude on time! Feedback Make sure to submit a constructive feedback for all sessions as it is very helpful for the presenter. Silent Mode Keep your mobile devices in silent mode, feel free to move out of session in case you need to attend an urgent call. Avoid Disturbance Avoid unwanted chit chat during the session.

What is Redis ? Use Cases & Benefits of Redis Why Redis is suitable for Micro-services APP How Redis supports multiple data formats What is Caching ? Types of Caching Strategies Demo

What is Redis ?

Redis, stands for Remote Dictionary Server, is an open-source, in-memory data structure store. It is used as a database, cache, and message broker. Redis is known for its speed, flexibility, and rich set of data structures, making it a popular choice for real-time applications. What is Redis?

Use Cases & Benefits of Redis Architecture Overview of a Complex Social Media Application

Use Cases & Benefits of Redis

Challenges of Managing Multiple Data Servers Deployment and Maintenance: All data services require deployment and ongoing maintenance, increasing operational overhead. Knowledge Requirement: Team members must possess the expertise to set up and configure each data service effectively. Performance Scaling: Achieving high performance necessitates scaling the services, but since different services have varying scalability requirements, managing scalability becomes complex.

Managed Data Services: A Simplified Alternative The easier alternative to running and managing services yourself is utilizing managed data services from cloud providers.

Managed Data Services: A Simplified Alternative Cost Consideration: However, this option could be expensive due to separate costs for each managed data service. Complexity Concerns: Despite the advantages, using managed services can lead to increased complexity in code. This arises from the necessity of connecting with multiple data services, each requiring a separate connector and unique logic. Latency Issues: Another concern is higher latency (slower performance) due to increased network hopping when accessing multiple data services.

Solving Challenges with Redis: A Multi-Model Database Solution Single Database Management: With Redis, you only need to run and maintain one database, simplifying operational tasks. Reduced Latency: By communicating with just one database, latency is reduced, resulting in faster performance. Versatile Data Structures: Redis allows you to store different data structures within a single database, providing flexibility for various use cases. Built-in Caching: Redis also acts as a cache, eliminating the need for an additional caching layer, thus optimizing resource utilization.

How Redis Supports Multiple Data Formats Redis is capable of supporting multiple data formats through its flexible architecture.

How Redis Supports Multiple Data Formats Key-Value Store: At its core, Redis operates as a key-value store, accommodating various types of data. Extension with Modules: Redis extends its core functionality through modules, enabling support for different data types based on application requirements. Example Modules: Redis provides modules like Redis Search for search functionality, Redis Graph for graph data storage, and more. Modular Architecture: A notable feature of Redis is its modular architecture. Unlike many other multi-model databases, Redis maintains modularity, ensuring that different database functionalities are not tightly integrated into a single database. Flexibility and Scalability: This modular approach offers flexibility and scalability, allowing developers to add or remove functionalities as needed without impacting the core database operations.

How Redis Supports Multiple Data Formats Community Contributions: Redis's open-source nature encourages community contributions, leading to a wide range of modules catering to diverse data storage and processing needs. In-Memory Database: Redis being an in-memory database significantly boosts application performance by reducing latency and speeding up data retrieval. Schema-less Nature: Unlike traditional databases, Redis does not require a fixed schema, offering flexibility in data storage and retrieval without the need for complex schema management.

How Redis Supports Multiple Data Formats You have the flexibility to choose the functionalities you need for your application from Redis's wide range of services

Data Persistence & Durability with Redis? What if the server which redis is deployed is failed and data is loss then how we can recover that data.

Data Persistence & Durability with Redis? Replicating Redis : So we always create a replica of redis like suppose one redis is down then replica will hold the data.

Data Persistence & Durability with Redis? Redis has multiple mechanisms for persisting the data. Snapshotting (RDB): Prouces single-file point-in-time snapshots of your dataset,(Great for backups & disaster recovery). Append only File ( AOF): Logs every write operation contiuosly. (much more durable) Slower then the RDB.

Data Persistence & Durability with Redis? Best option for Data persistence & Durability is use both option Snapshotting (RDB) + Append only File ( AOF) Regular snapshots for DB backups. Persisting all operations one after the other. :

What is Caching ? Caching is like keeping a handy copy of something you use often, so you don't have to fetch it every time you need it. Think of it this way: Imagine you have a favorite book that you read frequently. Instead of going to the library every time you want to read it, you decide to keep a copy of the book on your bedside table. That way, it's right there whenever you want to read it, without needing to go fetch it from the library each time. Similarly, in computing, caching is the process of storing copies of data or information in a location that's quicker to access than the original source. This can be in your computer's memory (RAM) or a specialized storage area. When you need that data again, instead of going through a longer process to fetch it from its original location (like a database or a website), your computer can quickly retrieve it from the cache, saving time and resources. Caching helps speed up processes and improve overall performance in various applications and systems.

Types Of Caching ? There are different types of caching present at different layer of the system Client-side caching (Browser caching): Storing data locally on a user's device, like web browser, for quicker access to frequently visited websites or resources. Content Delivery Network (CDN): Storing static content on servers distributed across various geographic locations to reduce latency and speed up content delivery. Load Balancer: Distributing incoming traffic across multiple servers to optimize performance and prevent overload on any single server. Server-side Application Caching (e.g., Redis): Storing frequently accessed data or computations in memory on the server to improve response time and reduce database load.

Caching Strategy There are four types of Cache strategies. Cache Aside Read through Cache Write Around Cache Write Back (or Behind) Cache

1. Cache Aside The application first checks the cache. If the data is found in cache, we have cache hit. The data is read and returned to the client. If the data is not found in cache, we’ve cache miss. The application has to do some extra work. It queries the database to read the data, returns it to the client and stores the data in cache so the subsequent reads for the same data results in a cache hit. Pros Good approach for heavy read application. Even if cache is down , request will not fail as it will fetch data from DB data model in cache can be different than the data model in database CONS: For new data read , there will always be CACHE-MISS first. Without approprialte caching is not used during write operation . there is chance of inconsistency between cache and DB.

2. Read-Through Cache The application first checks the cache. If the data is found in cache, we have cache hit. The data is read and returned to the client. If the data is not found in cache, we’ve cache miss. Cache Library itself fetch the data from DB,store it back to Cache and data is returned to the application. Pros Good approach for heavy read application. Logic of fetching the data from DB and updating cache is separated from the application. CONS: For new data read , there will always be CACHE-MISS first. Without approprialte caching is not used during write operation . there is chance of inconsistency between cache and DB. Cache document structure should be same as DB table

3.Write-Through Cache The application writes the data directly to the cache. The cache updates the data in the main database. When the write is complete, both the cache and the database have the same value and the cache always remains consistent. . Pros Cache and DB always remain Consistent.. Cache Hit Chance increases a lot. CONS: Alone it’s not useful , it will increase the work (that’s why it’s always used with read through or cache aside cache) 2 Phase commit, need to be supported with this, to maintain the transactional property.

4.Write-Back or Write Behind The application writes data to the cache which stores the data and acknowledges to the application immediately. Then later, the cache writes the data back to the database. This is very similar to to Write-Through but there’s one crucial difference: In Write-Through, the data written to the cache is synchronously updated in the main database. In Write-Back, the data written to the cache is asynchronously updated in the main database. From the application perspective, writes to Write-Back caches are faster because only the cache needed to be updated before returning a response. Pros Good for Write heavy application. Improves the Write operation latency. As writing into DB happens asynchronously Chache Hit chance increases a lot. Gives much better performance when used with read through cache . CONS: Alone it’s not useful , it will increase the work (that’s why it’s always used with read through or cache aside cache) 2 Phase commit, need to be supported with this, to maintain the transactional property.

Demo 07
Tags