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
3 Answers
Reset to default 5Redis 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
版权声明:本文标题:javascript - Does a single redis client connection support concurrent read and write? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741328740a2372644.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论