英文:
is redis single threaded for n databases in single instance
问题
Redis在执行命令时是单线程的。每个Redis实例都有DB0到DB16,可用于不同的应用程序。
我的问题是,Redis的单线程性质是针对单个DB还是所有DB都是单线程的?
例如,Redis同时收到了针对DB1的查询命令1和针对DB2的查询命令2,Redis会同时处理这两个查询命令吗?还是即使它们是针对不同的DB,仍然需要逐个处理?
谢谢。
我期望在单个Redis实例中的不同DB将使用不同的线程执行命令。
我在DB0中尝试了'CLIENT PAUSE 30000 ALL',在暂停期间,发送到DB1的命令直到暂停结束才返回结果。
英文:
I heared that redis is single threaded when executing the command.
And redis instance has DB0~DB16, which can be used for different applications.
My question is that, is the redis single threaded just for single DB, or for all DBs?
e.g.
redis received query command1 for **DB1 ** and query command2 for **DB2 ** at same time,
will redis handle the query command1 and query command2 at same time? or need to handle one by one even they are for different DBs?
Thanks.
I execpected that different DBs in single redis instance will use different threads to executing command.
I tried 'CLIENT PAUSE 30000 ALL' in DB0, and during pause period, the command sent to DB1 didn't return result until pause period ended.
答案1
得分: 0
这些是纯粹的逻辑数据库,因此redis-server
的单个实例是为它们所有的线程单线程的。如果可能的话,请尽量避免使用逻辑数据库和SELECT
命令,这在现今通常被视为反模式。
英文:
These are purely logical databases, so a single instance of redis-server
is single threaded for all of them. Try and avoid using logical databases and the SELECT
command if possible, it's generally considered an antipattern these days.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论