Ankush
Ankush

Reputation: 827

Redis Replication Question

I am planning to use Redis in my application for storage & caching. I read most of the documentation online, but still have a question regarding replication.

My usecase:

Question: - I understand that when clients are doing replication, they are blocked for operations. But, is read operation also blocked ?

Appreciate your help in advance!

Upvotes: 2

Views: 794

Answers (1)

smackshow
smackshow

Reputation: 576

That's not EXACTLY what it says in the docs, it actually says:

replication is blocking on the slave side: while the slave is performing the first synchronization it can't reply to queries.

and

If you set up a slave, upon connection it sends a SYNC command. And it doesn't matter if it's the first time it has connected or if it's a reconnection.

So, during normal operation it should not block on the slaves at all. BUT reads are blocked during initial sync.

You can see if it is currently synchronising with the info command; master_sync_in_progress:0

The replication works by first sending everything (blocks) Then it sends incremental updates (non-blocking, as it is "just" the executed commands modifying the dataset, in correct order)

You can only overcome it by connecting to a different redis instance, maybe the master as fallback ?

Upvotes: 2

Related Questions