search

Home  >  Q&A  >  body text

单线程的redis为何会有如此好的性能

通过阅读文档发现redis居然是单线程的,它是怎么做到能够支撑这么高的并发的?用到了什么特殊的算法结构或者非阻塞模型吗?

PHP中文网PHP中文网2798 days ago660

reply all(2)I'll reply

  • 大家讲道理

    大家讲道理2017-04-21 11:19:04

    Because Redis operations are very fast - all its data is in memory, and there is no need to access the disk at all. As for concurrency, Redis uses multi-channel I/O multiplexing technology, and its own concurrency efficiency is not a problem.

    Of course, a single Redis process cannot use multiple cores (it can only run on one CPU core at any time), but it is not a very computationally intensive service. If the single-core performance is not enough, you can open several more processes.

    reply
    0
  • 迷茫

    迷茫2017-04-21 11:19:04

    Search for: Redis single thread-multiplexed io model

    reply
    0
  • Cancelreply