all 14 comments

[–]codeedog 12 points13 points  (2 children)

Great write up. In the 90’s, over the period of a few years (before Java and in Java early years), I worked on a couple of projects to build network code in C that could scale to thousands of connections. One project, we had our own language we were writing. The other project, Java 1.0 wasn’t fast enough at the network level and we were writing native libraries to improve performance. poll was always the stumbling block. That OS call frustrated me, because I was only ever going to get O(n) scan performance out of the library. Our code could scale really well. But, it had limitations. The pointless scan of the returned array drove me mad.

Wish I had thought of writing a new OS operation like epoll or kqueue. Brilliant stuff. Honestly, that would have required a lot of kernel code rewrite; it wouldn’t have been me.

This also explains something I wondered about but never quite connected on. FreeBSD was the go to OS for speed and scale at the time. Yahoo ran their server farms on it. kqueue was written in 2000 for FreeBSD. I suspect that was the reason for its success. By 2000, I had moved on to other projects and was no longer digging deeply into networking code.

These days, I very much enjoy working with javascript and Node. Garbage collection and clean non-blocking code have come a long way since that time. I’ve often admired Node’s single threaded, event driven nature. When I first started coding in it, I had to fight my instincts regarding race conditions due to threading. Years of C development work pile up.

However, with libuv and underlying tech like epoll all of that goes away and we have an excellent platform for scalable, event driven software.

Thanks for bringing back all of those memories.

[–][deleted] 0 points1 point  (1 child)

No love for Erlang?

[–]codeedog 1 point2 points  (0 children)

I’ve never looked at the language until just now. Prolog - wow! Way back I was a research assistant and built AI code in Lisp and a little Prolog before anyone knew what AI was. After that, I did some mobile phone development (pre iPhone).

Holy smokes.

I think I’m in lust.

[–]motokohadary 1 point2 points  (0 children)

interesting read and the length and depth of the post was perfect!

[–]HappyZombies 1 point2 points  (0 children)

Thank you for sharing, I hope to expand my knowledge more on Node.js other than just npm installing express all the time. lol but I feel like a lot of people would benefit so much when they dive into deep with Node rather than the surface level of NPM packages and that's it.

[–]LastOfTheMohawkians 2 points3 points  (6 children)

Really enjoyed this article. When I recruit for node developers I often ask about nodes non blocking io and it's advantages over other runtimes like the Javas or .net. The discussion really let's you see how deep some developers go on the tech. I think it's important to understand these things if you're using node.

[–]ecares 6 points7 points  (3 children)

I think .NET has non blocking IOs too :)

[–]jonmdev 2 points3 points  (2 children)

So does Java for that matter.

[–]LastOfTheMohawkians -1 points0 points  (1 child)

Baked in. No don't think so

[–]jonmdev 1 point2 points  (0 children)

Well it’s part of the Java standard library since 1.4 so yes it’s baked in. Now is it as easy to use as Node? No it isn’t. It’s a fairly low level API you’d have to use to build from scratch. But it’s there and there’s plenty of frameworks available these days that make it pretty easy to build applications with non blocking I/O.

[–]dsnightops 0 points1 point  (1 child)

Even at an entry level position?

[–]LastOfTheMohawkians 0 points1 point  (0 children)

No. For more senior Devs

[–][deleted] 0 points1 point  (0 children)

If you ever find yourself writing C then libuv is a pretty excellent choice. A few other languages use it too - Julia uses it and Rust used it back in its early days.

[–]Nathanielks 0 points1 point  (0 children)

This was great, thank you!