I'm working on network devices monitoring solution at work. Prototype is written on Python using PySNMP which is awfully slow and stresses CPU a lot with small amount of devices being monitored. So I thought of making some small high-performance SNMP polling server to get rid of PySnmp and split the program in two (data provider and data analyser/decision maker).
Net-SNMP is not a good choice for SNMPv3 (not thread-safe, not fully async due to synchronous engineID discovery, which is slow if device is not responding) and I don't like SNMP++, so I decided to try writing this server on other languages. Java is not an option (no JVM), so in the end it's Erlang or Haskell (I don't know both of them..). Erlang does have built-in SNMP support, but I don't need process/machine distribution.
So could you please recommend which lang and snmp protocol (manager) implementation is better suited for the task? Requirements:
- high performance (small CPU usage),
- stability,
- high concurrency (a lot of simultaneous polls),
- non-blocking requests,
- full Snmp V1, V2C and V3 support.
Erlang support for SNMP in OTP distribution as application
snmp
. It means it is stable, matured and battle tested in a corporate environment. It supports:From the point of language, Erlang is strict but dynamically typed functional language with strict evaluation and embedded concurrency (actor based) and strong reliability support. (You can think about is as DSL for writing reliable clustered services.) Erlang compile to bytecode or native (but not as efficient as Haskell) and runs in own VM BEAM. The Haskell is strict and static typed functional with lazy evaluation and no embedded support for concurrency and reliability, but there are solutions in modules. In my personal opinion, Erlang is much smaller language and simpler to learn for somebody going from an imperative language.
Erlang is often not recognized for its speed, but there are real-world applications where Erlang outperforms Java, C++ or C# solutions especially under concurrent load. There is even a study comparing real C++ application with Erlang counterpart. The result is really surprising.
I personally would choose Erlang ower Haskell. There is one major catch, for writing corporate grade solution the OTP is must. Where Erlang as language is small and easy, the OTP is much harder but concurrency and reliability are hard itself and OTP makes it actually easier.
As last remark, there is always possible rewrite time critical parts from Erlang to C or C++ as native implemented functions (NIF) and I found it surprisingly easy in comparison with my previous experience with writing similar functions for Perl or Python.