Answer the question
In order to leave comments, you need to log in
linux. Non-blocking server. What type is better to use?
In Linux, a server on a non-blocking connection can be created in three ways, through:
- select
- poll
- epoll
what is better to use, the advantages and disadvantages of each type.
Answer the question
In order to leave comments, you need to log in
If there are a lot of open connections (n), then poll and epoll. If there are fewer active connections (k), then epoll will be better. It will "look through" the list of descriptors in O(k), and poll in O(n).
Related:
stackoverflow.com/questions/5383959
stackoverflow.com/questions/4039832
You should probably pay attention to the course of lectures Network programming in UNIX , which
prepared by SkyDNS and Aideko specialists
Course author Alexander Patrakov explains which functions can be called instead of select() so that a program rewritten using them can efficiently handle a large number of simultaneous connections.
The practical task was to rewrite the astrological server using the epoll() family of functions and check if it can withstand 10,000 connections.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question