Joke Collection Website - Talk about mood - IO Reuse of Redis —— Understanding of Single Thread (Multithreading after Redis6.0)
IO Reuse of Redis —— Understanding of Single Thread (Multithreading after Redis6.0)
The following figure shows the reactor design pattern class diagram:
IO reuse based on reactor design pattern
The architecture diagram of IO multiplexing technology is as follows
note:
Multithreading may involve the consumption of locking and switching threads.
Time-consuming commands will lead to performance degradation, and the performance of CPU multi-core cannot be exerted.
Redis multithreading is only used to deal with the reading and writing of network data and protocol analysis, and the execution of commands is still single-threaded. This design change is to avoid introducing multithreading and making Redis complicated. Moreover, in the past, the use of single thread mainly considered that CPU was not the bottleneck of Redis, and there was no need for multi-thread concurrent execution, so the performance improvement brought by multi-thread mode could not offset the development and maintenance costs brought by it.
Now the introduction of multithreading model has solved the performance bottleneck of network IO operation. For the memory-based operation of Redis, it is still very fast, and sometimes the blocking of IO operation will affect the efficiency of subsequent operations. Instead, multi-thread concurrent IO operation is performed, and then the main thread performs memory operation, which can better alleviate the performance bottleneck caused by IO operation.
The architecture is as follows:
- Previous article:How to write the slogan for opening a new store?
- Next article:How hard can a person work and to what extent can he persist?
- Related articles
- How to write mother-daughter photos in a circle of friends?
- Classic sentences praising zongzi sentences describing zongzi
- It is very important to be a person-understand some things and see some people clearly.
- Chasing a girl, what should I talk to her every day?
- Tidying up the closet is actually tidying up your life!
- What are the classic sayings about dumpling hair ties?
- Wechat said sadly: I'm not waiting for him, but I can't like others yet.
- The advantages and disadvantages of drinking soy milk made by soy milk machine
- My heart is colder than the weather.
- Review of Carrying Dad to School