Our website says, "Metaswitch provides innovative solutions for all service providers", which is true, but what does that mean for developers like me?
We write software for telecoms or networking. In both cases, we're implementing function that is
- complex - for example, TS 24.229 (https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1055) (the spec from which I do most of my development) is >900 pages, and that only covers a fraction of the total behavior of just one of our many products
- efficient - we need to keep the amount of hardware that the customer has to purchase and operate as low as possible, meaning that our software needs to provide high throughput given the CPU and memory used
- low-latency - the latency between receiving a request and replying or forwarding needs to be very low (for many applications <10ms) - not just in the average case, but even in the 99th percentile
- reliable - availability is measured in '9's (e.g. 5 '9's means available 99.999% of the time, 6 '9's is 99.9999%) and our customers expect at least 5 '9's - including planned maintenance such as upgrades.
We've previously written in C, C++, Java, Scala, Python, and even small bits in Erlang and Lua. While these have served us well,
- some (such as C and older C++ versions) are showing their age, and it's harder to be productive in them
- some (in particular, JVM-based ones such as Java and Scala) are garbage-collected, and this can cause unacceptable variation in latency
- some (such as Python) are quick to develop in, but it can be hard to get great performance and it's hard to be sure that code is reliable
- using a selection of languages means that developers need to learn them all, which is expensive.
So we really wanted to settle on one main language - efficient to develop in, performant and robust.
We looked at a number of options, including the latest C++, and Go, but settled on Rust (https://www.rust-lang.org/en-US/). Why?
- It's efficient.
- One of Rust's headline features is "zero-cost abstraction". This means that you can write your program using high-level concepts (making it fast to write and easy to confirm that the code is correct), but for these concepts to be stripped away by the compiler so that the code that the computer executes is simple and (importantly) fast.
- Unlike languages such as Java, Scala and Go, Rust can work out how long memory is used at compile time, and so doesn't need to do runtime garbage collection.
- It's robust.
- Unlike C and C++, Rust's memory model prevents you from reading or writing to memory after it's been freed. The promise of "no more segmentation faults " was something that particularly appealed to our Support team!
- Further, the memory model extends to concurrent operations, meaning that Rust won't allow you to write code that reads and writes to the same memory on different threads, without that being protected by a lock or other synchronization primitive.
- It's productive.
- It has all the standard features you'd expect from a modern programming language - things like closures, generics, pattern matching and type inference.
- The tooling is strong, coming with a standard UT framework, formatter, linter and, in "cargo", one of the best dependency management tools I've used.
- Rust does have a bit of a steep initial learning curve, but we've found that even interns and new graduates can pick it up pretty quickly.
We haven't moved all of our existing products (and don't intend to - it would be very expensive, and they're now very stable), but we have started doing most of our new development in Rust, and so far it's been a very positive experience!
If you're interested in trying out Rust, the best place to learn it is The Rust Programming Language book (https://doc.rust-lang.org/book/) and, if you want to try it out without installing anything, the Rust Playground (https://play.rust-lang.org/) allows you to compile and run simple programs from your browser.