Node.js Redis Connection Pooling

末鹿安然 提交于 2019-11-27 13:52:27

问题


When using node_redis Node.js module with Redis, should I just use one connection as Redis is single thread process or shall I create a pool of connections to improve performance?


回答1:


Just use a single connection. Both Node and Redis are effectively single thread. I don't think you'll gain anything by having multiple connections. I asked a similar question before starting to develop with Redis and it seems that one client/one application is pretty effective pattern.




回答2:


There is a use case for pooling multiple connections, actually: blocking commands like BRPOP and SUBSCRIBE.



来源:https://stackoverflow.com/questions/21976270/node-js-redis-connection-pooling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!