admin管理员组

文章数量:1287856

I am very new to redis and this has always made me curious.

I am using a single redis client connection in nodejs (npm's redis package) which is included in each of my files.

Say for eg : File a.js is used for reading from mysql and inserting the data into redis hash ,file b.js reads from redis hash and outputs the result.

Now in a production environment i have a large numbers of request ming to b.js files which serves the content and in between i have a few request being made to a.js files to update the contents on the fly.

I want to know if a request to a.js slows down the already running redis connection in b.js.

I am very new to redis and this has always made me curious.

I am using a single redis client connection in nodejs (npm's redis package) which is included in each of my files.

Say for eg : File a.js is used for reading from mysql and inserting the data into redis hash ,file b.js reads from redis hash and outputs the result.

Now in a production environment i have a large numbers of request ming to b.js files which serves the content and in between i have a few request being made to a.js files to update the contents on the fly.

I want to know if a request to a.js slows down the already running redis connection in b.js.

Share Improve this question asked Apr 28, 2016 at 6:57 Rohit NayalRohit Nayal 2925 silver badges15 bronze badges 1
  • Could you please select an answer and mark it as accepted? This will help other SO users that might have the same question as you. – lisa Commented May 7, 2016 at 13:07
Add a ment  | 

3 Answers 3

Reset to default 5

Redis is single threaded, so if it's busy writing data, your reads will be delayed.

You'll find more information in this SO answer: Redis is single-threaded, then how does it do concurrent I/O?

Redis is single threaded then there is no concurrent read/write. If there are 2 client connection sending mand to the redis they will be queued.

Then yes if a.js send a lot of mands to the Redis, b.js mands will be inserted between a.js mands

No, the connection will not be slow down. What will slow down is the response time from redis. But I doubt you will notice as we are talking about a few micro-seconds per request.

本文标签: javascriptDoes a single redis client connection support concurrent read and writeStack Overflow