Sunday, July 17, 2022

Redis Interview Questions

Q: What is Redis?
Ans:

Redis is 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.

Q: What is the meaning of Redis?
Ans:

Redis stands for REmote DIctionary Server.

Q: What is in-memory Database
Ans:

A database that holds the dataset in RAM is known as an in-memory database. This means that if you communicate with a database, you can only use Main memory; no DISK operations will be performed. As a result, the process will be quicker since it will access the main memory directly rather than using the disc.

Q: What is Redis Replication?
Ans:

Redis uses non-blocking asynchronous replication, with asynchronous replica-to-master acknowledges of the amount of data processed. A master can have multiple replicas. It ensures that the master will continue to handle queries when one or more replicas perform the initial synchronization or a partial resynchronization. Replication is also largely non-blocking on the replica side.

Q: What is Spring Session Data Redis?
Ans:

Spring provides session repository for Redis database session management. In Spring Boot, we can make use of HTTPSession with Spring Session Data Redis to store the session data in persistent storage (Redis).

Refer for implementation of Spring Boot Session Management using Redis

Q: Why Redis is fast?
Ans:

Redis is a data structure server. As a key-value data store, Redis is same as Memcached, but it has two major advantages over, support of additional datatypes and persistence. Since all of the data is stored in RAM, because of that system speed become extremely quick, sometimes perform even better that Memcached.

Q: Why is Redis faster than SQL?
Ans:

Since Redis stores data in primary memory, because of that Read and Write operations will be extremely fast.

In RDBMS, Read and Write operations are slow because it stores data in secondary memory.

Primary memory is in lesser in size and much expensive than secondary so, Redis cannot store large files or binary data.

Q: What are differences between Redis and RDBMS?
Ans:

Redis

RDBMS

Redis stores everything in primary memory.

RDBMS stores everything in secondary memory.

In Redis, it stores data in primary memory because of that Read and Write operations are extremely fast.

In RDBMS, it stores data in secondary memory and because of that Read and Write operations are slow.

Since primary memory is smaller and more costly than secondary memory, Redis is unable to store large files or binary data.

Since secondary memory is larger and less expensive than primary memory, RDBMS can easily handle these types of files and data.

Redis is only used to store small quantities of textual data that must be accessed, updated, and added quickly. You'll get errors if you try to write bulk data that exceeds the available memory.

RDBMS can store large amounts of data that aren't used regularly and aren't needed to be fast.

 

Q: How to install Redis?
Ans:

Follow the steps given here to install Redis Client/Server.

Q: What is the maximum size of key (String) in redis?
Ans:

According to the redis official docs, the maximum size of key in redis is 512MB.

Q: How many data types are there in Redis?
Ans:

Redis provide 5 types of data types. Strings, Hashes, Lists, Sets, Sorted Sets

Q: Can we store JSON in Redis?
Ans:

JSON can be stored in redis as a plain string in a separate key (or as a member/value of a set/list) or as a hash structure.

 


No comments:

Post a Comment