Thoughts on nginx 2-event handling

Source: Internet
Author: User

Nginx event processing function ngx_process_events_and_timers. in Linux, ngx_epoll_process_events will be called.

Then epoll_wait gets the corresponding event and then processes it accordingly, that is, listening and processing are handled in the same thread, which has several problems:

1. If there are multiple events, you must wait until the processing of the previous event is completed before processing the next event.

2. The same connection can only be performed in the order of "receive-send-receive-Send", but cannot implement real duplex.

In addition, the ngx_epoll_add_event/ngx_epoll_add_connection function has limited a process to receive only one processing thread, but only multi-process.

The above is a major bottleneck for processing streaming media protocols.

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.