Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the Reactor model?

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces you what the Reactor model is, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Single thread Reactor

Disadvantages:

Acceptor is equivalent to a handler.

Because there are so many defects, the single-threaded Reactor model is less used.

This single-threaded model can not make full use of multi-core resources, so it is not used much in practice.

When one of the handler blocks, the handler of all other client will not be executed.

And to make matters worse, handler blocking can also prevent the entire service from receiving new client requests (because acceptor is also blocked).

Therefore, the single-threaded model is only suitable for scenarios where business processing components in handler can be completed quickly.

Another way of painting (meaning is similar):

Multithreaded Reactor

Another way of painting (meaning is similar):

Master-slave multithread Reactor mode

Because like TCP, it takes three handshakes to establish a connection.

This process of establishing a connection also takes time and resources.

Separate Reactor processing can improve performance.

MainReactor is responsible for listening for connections, and accept connections are handled by subReactor.

Why separate a Reactor to handle snooping?

So much for sharing about what the Reactor model is. I hope the above content can be helpful to everyone and learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report