Redis 案例研究

NoSQL 概念

Miriam Antona

Software engineer

Redis - 概览

  • Remote Dictionary Server
  • 流行的键值数据库
  • 高速内存数据结构存储
    • 内存数据集
    • 也可将数据持久化到磁盘
  • 用途:
    • 数据库
    • 缓存
    • 消息代理

Redis 标志

  • 开源
  • Redis Labs:400+ 名员工
NoSQL 概念

Redis - 数据结构

  • 字符串
      SET name Ann
    
  • 列表
      RPUSH my_numbers 1 2 3
    
  • 集合
      SADD my_set 1 2 3
    
  • 哈希
      HMSET user:123 name Ann surname Smith
    
NoSQL 概念

Redis - 数据结构

  • 字符串
      SET name Ann
    
  • 列表
      RPUSH my_numbers 1 2 3
    
  • 集合
      SADD my_set 1 2 3
    
  • 哈希
      HMSET user:123 name Ann surname Smith
    
1 https://redis.io/glossary/redis-data-structures/
NoSQL 概念

Redis - 特性

  • 原子操作
  • 事务
  • Lua 脚本处理复杂操作
  • 编程语言:Python、R、C#、Java、JavaScript、PHP…
  • 异步复制
NoSQL 概念

Redis - 常见用途

  • 缓存(查询结果、图像、文件等)
  • 会话存储(用户画像、凭据等)
  • 聊天、消息与队列(聊天室、实时评论、社交媒体订阅等)
  • 实时分析(社交媒体分析、广告)
  • 游戏排行榜(实时排名)
  • 等等
NoSQL 概念

Redis - 云端服务

  • Amazon Web Services 的 Redis Elasticache
  • Microsoft Azure Cache for Redis(Azure)
  • 阿里云的 ApsaraDB for Redis
NoSQL 概念

Redis - 客户

部分 Redis 客户标志

NoSQL 概念

Editoo 案例研究

Editoo 标志

  • 小型企业
  • 在线自定义杂志制作工具
    • 个人
    • 商业

问题:

  • 高延迟,因应用用户增多
  • 其 RDBMS 无法应对增长

 

解决方案:使用 Redis

  • 存储用户会话
  • 缓存数据库查询
NoSQL 概念

Editoo 案例研究

结果:

  • 降低停机时间
  • 更高性能
  • 计划将其关系型数据库逐步迁移到 Redis
NoSQL 概念

Editoo 案例研究

结果:

  • 降低停机时间
  • 更高性能
  • 计划将其关系型数据库逐步迁移到 Redis
1 https://redis.io/customers/
NoSQL 概念

让我们一起练习吧!

NoSQL 概念

Preparing Video For Download...