UDP Server Study Part 3 - Erlang
So its been much longer than I originally anticipated between the 2nd and 3rd installments of my Udp Server investigation. I had already done the majority of the ‘investigating’ into the performance differences between 4 different languages when I started this whole thing. But I’m just now getting around to writing about what I found with Erlang.
I’ve been pretty busy here the last week or so with a new job, a BBQ competition in Chicago and then military this weekend. But enough belly aching, lets get down to the Erlangs.
Spoiler alert, the results ending up being pretty similar to the first two tests, NodeJs and Mono. But it wasn’t that way initially.
At first Erlang had the worst performance out of any of them. I was interested in Erlang after reading a little about it, and of course after watching the very munctional video on YouTube:
When I first started working with Erlang on this project it performed the worst of all 4 languages, clocking in at a terrible 30% success rate. I believed (correctly) that the problem was that I just didnt do it correctly for this language. So I did what any self respecting programmer would do…. I went off to (StackExchange)[https://stackoverflow.com/questions/32424747/erlang-udp-server-dropping-lots-of-packets/32449174#32449174] (of course after searching around for a bit on my own)
This is when I found the little tidbit about modifying the buffer sizes on the Linux Kernel.
After this was done the Erlang server was achieving about a 98% success rate, which was equivalent to the other applications.
The problem was really two fold. For starters I needed to modify the Linux machine to support larger buffers. But at the same time I had to also specify these larger buffers in the Erlang application, something I did NOT have to do for either NodeJs or Mono.
You can download the Mono source from here