Redis入门到高可用-4.瑞士军刀Redis

1.瑞士军刀Redis

  • 慢查询
  • pipeline
  • 发布订阅
  • Bitmap
  • HyperLogLog
  • GEO

2.慢查询

  • 生命周期

    redis生命周期.png
  • 两个配置

    redis两个配置1.png

    redis两个配置2.png

    redis配置方法.png
  • 三个命令

    redis慢查询命令.png
  • 运维经验

    redis运维经验.png

3.pipeline

  • 生命流水线

    流水线.png

    流水线的作用1.png

    流水线的作用2.png

    通信模型1.png

    通信模型2.png
  • 客户端实现

      import redis.clients.jedis.Jedis;
      import redis.clients.jedis.Pipeline;
      
      public class JedisTest {
          public static void main(String[] args) {
              Jedis jedis = new Jedis("127.0.0.1", 6379);
              long start = System.currentTimeMillis();
      //        for (int i = 0; i < 10000; i++) {
      //            jedis.hset("hashkey", "field" + i, "value" + i);
      //        }
              for (int i = 0; i < 10; i++) {
                  Pipeline pipeline = jedis.pipelined();
                  for (int j = i*1000; j < (i+1)*100; j++) {
                      pipeline.hset("hashkey", "field" + i, "value" + i);
                  }
                  pipeline.syncAndReturnAll();
              }
              long end = System.currentTimeMillis();
              System.out.println("耗费的时间为:" + (end-start) + "ms");
          }
      }
      // 原始时间耗费: 800ms
      // pipeline耗费: 44ms
    
  • 与原生操作对比

    与原生对比1.png

    与原生对比2.png
  • 使用建议

    pipeline使用建议.png

4.发布订阅

  • 角色

    • 发布者(publisher)
    • 频道(channel)
    • 订阅者(subscriber)
  • 模型

    生产消费模型1.png

    生产消费模型2.png
  • API

    • publish

      publish.png
    • subscribe

      subscribe.png
    • unsubscribe

      unsubscribe.png
    • 其他

      其他API.png
  • 消息队列与总结

    redis消息队列.png

    发布订阅总结.png

5.bitmap

  • 位图

    位图.png
  • 相关命令

    setbit1.png

    setbit2.png

    setbit3.png

    getbit.png

    bitcount.png

    bitop.png

    bitpos.png
  • 独立用户统计

    独立用户统计1.png

    独立用户统计2.png

    位图使用经验.png

6.HyperLogLog

  • 新的数据结构?

    HyperLogLog.png
  • 内存消耗

    内存消耗.png
  • 三个命令

    三个命令1.png

    三个命令2.png

    三个命令3.png
  • 使用经验

    HyperLogLog使用经验.png

7.GEO

  • GEO是什么

    GEO.png

    应用场景.png
  • 5个城市经纬度

    5个城市经纬度.png
  • 相关命令

    相关命令1.png

    相关命令2.png

    相关命令3.png

    相关命令4.png

    相关命令5.png
  • 相关说明

    GEO相关说明.png

你可能感兴趣的:(Redis入门到高可用-4.瑞士军刀Redis)