0

In this link , it is given that REDIS IS SINGLE THREADED. But in this link, it is given that

"the command performs the actual memory reclaiming in a different thread, so it is not blocking"

So what is the point? Will redis block a command until the previous command is completed or it is actually multi-threaded?

Community
  • 1
  • 1
Jsmith
  • 585
  • 6
  • 16

1 Answers1

0

Redis actually uses several threads. It is not really "multi-threaded" though because it uses a single thread to answer requests.

here is a multi-threaded port of Redis. https://github.com/grisha/thredis But it comes with some limitations e.g. it can't be used as a replication master.

Chandan Rai
  • 9,879
  • 2
  • 20
  • 28
  • You say it uses single thread to answer requests. By this you mean, only one command gets executed once. Which in turn means, redis blocks the execution of other commands until the current command is completed. But the UNLINK command seem to not block other commands. This is what I find contradicting. – Jsmith Jan 13 '17 at 08:16
  • 1
    It marks the keys as deleted in the main 'answering' thread but then another thread will do the memory clean up in the background. So the main thread is blocked for the least amount of time while another thread does the bulk of the work in a nonblocking way – Chris Tanner Jan 13 '17 at 11:36
  • @Chris Tanner Thank you – Jsmith Jan 13 '17 at 13:05