Redis实战系列(1) 运行多个实例以充分发挥多核处理器的能力

我们知道Redis是用"单线程-多路复用io模型"来实现高性能的内存数据服务的,这种机制避免了使用锁,但是同时这种机制在进行sunion之类的比 较耗时的命令时会使redis的并发下降。因为是单一线程,所以同一时刻只有一个操作在进行,所以,耗时的命令会导致并发的下降,不只是读并发,写并发也 会下降。而单一线程也只能用到一个cpu核心,所以可以在同一个多核的服务器中,可以启动多个实例,组成master-master或者master- slave的形式,耗时的读命令可以完全在slave进行。
需要改的redis.conf项
pidfile /var/run/redis/redis_6377.pid  #pidfile要加上端口号
port 6377  #这个是必须改的
 logfile /var/log/redis/redis_6377.log #logfile的名称也加上端口号
dbfilename dump_6377.rdb  #rdbfile也加上端口号


下面是性能参数

[plain] view plain copy
  1. L1 cache reference 0.5 ns  
  2. Branch mispredict 5 ns  
  3. L2 cache reference 7 ns  
  4. Mutex lock/unlock 25 ns  
  5. Main memory reference 100 ns  
  6. Compress 1K bytes with Zippy 3,000 ns  
  7. Send 2K bytes over 1 Gbps network 20,000 ns  
  8. Read 1 MB sequentially from memory 250,000 ns  
  9. Round trip within same datacenter 500,000 ns  
  10. Disk seek 10,000,000 ns  
  11. Read 1 MB sequentially from disk 20,000,000 ns 

http://blog.csdn.net/hobbs136/article/details/7619719

猜你喜欢

转载自m635674608.iteye.com/blog/2283763
今日推荐