Advertisement

分布式锁Redis和Recession分析

阅读量:

redis的常用命令

  • ./redis-cli -p 6380 shutdown 指定端口关闭
  • ./redis-cli -p 6379 -h 127.0.0.1 指定端口号和ip启动

redisson

loadBalancer负载均衡模式

RandomLoadBalancer - 随机调度算法

复制代码
    public ClientConnectionsEntry getEntry(List<ClientConnectionsEntry> clientsCopy) {
    //java.util.concurrent.ThreadLocalRandom;    
    int ind = ThreadLocalRandom.current().nextInt(clientsCopy.size());
    return clientsCopy.get(ind);
     }

RoundRobinLoadBalancer -轮询调度算法

复制代码
    private final AtomicInteger index = new AtomicInteger(-1);//cas,保证变量在多线程下的准确性
    public ClientConnectionsEntry getEn

全部评论 (0)

还没有任何评论哟~