4 ms·
I always appreciate when these topics are covered, but the article could be better. The performance table for one has no units. I don't know what I'm looking at
by IgorPartola 9y ago
I always appreciate when these topics are covered, but the article could be better. The performance table for one has no units. I don't know what I'm looking at whatsoever.
The description of edge vs level triggering is short and IMO not the easiest to understand.
The highlight of differences between the states that poll vs select can return doesn't actually explain the extra states that poll gives you.
The memory considerations of select vs poll vs epoll are only slightly touched upon.
If you want to understand the how, you'll probably have to read the book she mentions (I haven't read it), or other articles around the web (what I did read). IMO the rule of thumb is that if you are writing a non-performance critical piece of software, just use select. It is widely available and easy to understand. If you want performance, you will want to use epoll and kqueue with a fallback to poll. Understanding kqueue and epoll will give you a better idea of why these are different than poll/select.
The last time I touched this level of code, I did it in Python and I wrote a generic listener set of classes that wrap all four of these calls to make it work as performantly as possible on as many systems as possible. I suggest this as an exercise to budding networking programmers.
- Thaxll 9y agoUsually you use a framework and never use those syscall.
- ranit 9y agoEven if you use higher level libraries it is always beneficial to know and understand the details underneath.
- Koshkin 9y agoThis depends on the definition of 'you', I guess. Also, Unix API could be seen as a "framework", albeit not as "high level" as, say, node.js.
- IgorPartola 9y agoSometimes you don't want to drag in all of Twisted to create a small server. Sometimes you are writing code in C and don't want many external dependencies to keep the memory footprint small. Sometimes you want very tight control over what happens. Sometimes you want to process OS signals along with network file descriptors. Sometimes your desired concurrency model doesn't match that of the popular frameworks. Sometimes you have a more complex workload than just listening on sockets. Besides the article is going down to the level of reading kernel source. Most people don't do that because they want to modify it, by because they want to understand it. Just saying "use Node" is not the answer to those types of questions.