search

Home  >  Q&A  >  body text

架构设计 - Redis 如何设置存储结构?

目前想的是:

  1. 使用 Redis 来做分布式存储缓存,所有分布式进程同时给 Redis 添加数据,不做唯一性的检查
  2. Redis 存储完成后,使用对比后形成增删改列表
  3. 使用队列的方式完成增删改,每形成一条增删改数据都压入队列,队列采用异步的方式完成数据的持久化

这样做是否可行?需要注意哪些?

高洛峰高洛峰2848 days ago701

reply all(1)I'll reply

  • PHPz

    PHPz2017-04-22 09:00:59

    Invited by the system.
    I haven't tried the questioner's solution, but in a flash I immediately thought of a tool that also uses Redis for caching: logstash, so the questioner's solution should be completely feasible.
    There is no need to add additional queues. Redis naturally provides lpushlpop commands to use the list as a queue.
    Because the writing performance of Redis is very high, the subject may want to pay attention to the performance of the processing queue to prevent the memory from bursting.

    reply
    0
  • Cancelreply