Redis single-threaded architecture __ Cache

Source: Internet
Author: User
Tags epoll
Redis Single-Thread architecture
1 Single Thread model

Each invocation of the Redis client to the server goes through the sending command, executing the command, and returning the result in three processes. Where the command phase is executed, because Redis is single-threaded to handle the command, all commands that arrive at the service end are not executed immediately, all commands are entered into a queue and executed individually. and the order in which the commands sent by multiple clients are executed is indeterminate. But it is certain that no two commands will be executed at the same time, and that there will be no concurrency problem, which is Redis's single-threaded basic model. 2 Single-threaded model The reason for the million-level processing capacity per second

(1) Pure memory access. The data is stored in memory and the response time of memory is approximately 100 nanoseconds, which is an important basis for redis-trillion-level access per second.

(2) non-blocking I/o,redis using Epoll as I/O multiplexing technology, coupled with Redis's own event processing model will be epoll in the connection, read and write, shutdown are converted to time, not I/O waste too much time.

(3) single-threaded avoids the consumption of thread switching and race state generation.

(4) Redis using a single-threaded model, each command execution if takes a lot of time, can cause other threads to block, for Redis this high-performance service is fatal, so Redis is a high-speed execution-oriented database.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.