Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does Redis store the data

I am using redis for pub/sub as well as for server side cache. I mean my app server has redis server running as one process (functioning as a cache as well) . I have several thin clients (running redis client) connected to this app server in pub/sub mode. I would like to know where redis stores the cache data ? in server alone or there will be a copy in the clients as well. Also is it a good idea to use Redis in this fashion if there are close to 100 redis clients connected to server through pub/sub channel.

Thanks

like image 674
user3364247 Avatar asked Apr 17 '15 06:04

user3364247


People also ask

Where do Redis store data?

All Redis data resides in memory, which enables low latency and high throughput data access. Unlike traditional databases, In-memory data stores don't require a trip to disk, reducing engine latency to microseconds.

Does Redis store data to disk?

Within Redis, there are two different ways of persisting data to disk. One is a method called snapshotting that takes the data as it exists at one moment in time and writes it to disk. The other method is called AOF, or append—only file, and it works by copying incoming write commands to disk as they happen.

How does Redis store data in-memory?

Redis is an In-Memory Database(IMDB) as it relies on main memory of computer for data storage while others use Disk Storage database mechanism. That is why Redis is faster than disk-optimized databases because disk access is slower than memory access.

Does Redis use disk or cache?

Yes, we do, but when it comes to cache, or database interactions, we use disks by default. Imagine accessing a database to read 10,000 records. If the data is stored on disk it will take an average of 30 seconds, while it takes around 0.0002 seconds to read from RAM.


2 Answers

Redis is a (sort of) in-memory noSQL database; but I found that my copy (running on linux) dumps to /var/lib/redis/dump.rdb

like image 186
Alexx Roche Avatar answered Sep 20 '22 02:09

Alexx Roche


Redis can manage really big numbers of connections, by default its in-memory store (thanks to storing stuff in RAM it can be so fast).

But in the same time it can be configured as a persistent store, so dumping cached data (every x time or every x updated keys) to disk.

So it can be configured depending on your needs, have a look here.

like image 37
Tom St Avatar answered Sep 21 '22 02:09

Tom St