关于redis多核多实例的疑问
都说redis是单线程的,即一个redis实例监听某端口后,只会利用一个cpu核提服务,所以网上有了很多在一台多核的服务器上,配置多个redis_conf文件表示监听不同端口,然后通过redis-server /etc/redis/redis_****.conf命令(****代表你的各个redis配置文件),启动不同的redis实例,那么问题来了:
按文章思路理解:
一个4核的服务器,我启动了redis-server /etc/redis/redis_6379.conf,redis会使用了一个核,
我再启redis-server /etc/redis/redis_6380.conf,redis一定会使用另一个核吗???,
那如果一个只有一核的服务器,我配了 6379.conf ,6380.conf
都启动起来,两者会使用同一个核呢,还是后启动的那个会报错?
是不是redis作者,已经在底层里写了什么类似 if(cpu.length>1) cups=getCpus();for(var cpu in cpus){
if(cup.hasNoRedisIns)cpu.useRedis(this_conf);
}
这种代码,来保证一个核只有一个redis实例?