Why We Use Rust for our Kannika Solution

Cymo 89Back to overview

At Cymo, our mission is to make your Event-Driven Architecture (EDA) life easier. As part of that mission, we have developed Kannika, our backup & restore solution for event data. We wanted Kannika to be fast, efficient, and reliable when handling large amounts of sensitive data, so we decided to build it using Rust. In this article, we’ll explore what sets Rust apart from other languages and which tangible benefits it provides for Kannika.

What is Rust?

Rust is a relatively new programming language: v1.0 was released in 2015. Since then, it has become remarkably popular, building a global community of (mostly) experienced developers calling themselves ‘Rustaceans’. In the latest edition of Stack Overflow’s annual developer survey, Rust topped the chart as the most desired programming language for the eighth year in a row.

Rust has also seen industry-wide adoption: tech giants like Amazon, Discord, Dropbox, Facebook (Meta), Google (Alphabet), and Microsoft all use Rust to power their core products and services to some degree. In December 2022, Rust even became the first language to be supported in the development of the Linux kernel apart from C and assembly, a clear sign of its versatility.

Rust is the language of the future: it allows for high-level abstractions while retaining low-level capabilities.

Bryan De Smaele, Managing Partner

What are the main benefits of using Rust?

As a systems programming language, Rust is largely praised among developers for its emphasis on performance, reliability, and productivity.

  • Performance: Rust is remarkably fast compared to other languages and memory-efficient. Since it does not have a runtime or a garbage collector (more on that later), it is frequently used for performance-critical services, it can run on embedded devices, and it plays well with other programming languages.

  • Reliability: Rust features a rich type system and an ownership model that ensure memory and thread safety. As we’ll explain below, this lets developers detect, eliminate, or outright avoid whole classes of bugs during the compilation process.

  • Productivity: Among developers, Rust is well-known for its outstanding documentation, powered by the community. It also has a useful compiler with helpful error messages and a comprehensive toolset. Among many other tools, Rust has an integrated package manager and build tool, and offers multi-editor support with auto-completion, auto-formatting, and type inspections.

One final important benefit of Rust, which results directly from the points we’ve listed above, is that it removes cognitive load from developers.

In languages like C++ I usually write code much more defensively: I deliberately avoid techniques because they might evolve into subtle bugs later on. Examples of this include data race, iterator invalidation, and dangling references. When I program in Rust, I simply don’t have to worry about this.

Benoît Ruelle, Software Developer

Why did we choose Rust for Kannika?

Rust is clearly loved for many good reasons. To be honest, that’s why Rust was initially chosen: Bryan loves Rust, and it’s been on his radar for hobby projects since 2019. When he realised that high reliability and performance were of the utmost importance for Kannika, he quickly knew that Rust would be the perfect fit.

Besides our managing partner's Rustacean enthusiasm, choosing Rust as the programming language for Kannika also has some tangible benefits:

  • Efficiency: Rust is a low-level language, which means that you have a lot more control over how your application handles memory allocation. It also avoids overhead common with languages like Java. For example, Kannika uses up to 20 times less memory than the Java Virtual Machine alone.

  • Performance: Rust is ‘blazingly fast’, as its team puts it, and that’s definitely no overstatement. Kannika needs to be able to process terabytes of sensitive data, and in every deployment so far, it has only been bottlenecked by the data transition speeds of the underlying network.

  • Reliability: Rust is infamous for being a relatively strict language towards developers, because it forces them to think about important concepts like object lifespan without being able to rely on garbage collectors. However, this strictness is not without reason: it leads to applications that are significantly less prone to bugs and exploits and deal with memory in a completely predictable manner. Rust allows us to budget the memory usage exactly, regardless of its current load, down to as low as 5 Mb if required.

Many password managers and even some operating systems use Rust for its reliability, and we wanted to be able to offer our customers the same level of trust with Kannika.

Bryan De Smaele, Managing Partner

Which drawbacks are there to using Rust?

As fascinating and powerful as Rust is, there are some disadvantages to using it as the foundation of an application, just like any other programming language. Most of these challenges stem from the fact that Rust is a relatively new and strict language.

The Recruitment Pool

The main issue for established companies is the recruitment pool: Rust is currently in the awkward adolescent phase that every technology goes through. While it offers numerous benefits and generates plenty of enthusiasm, finding proficient Rust developers can be more challenging than finding developers for established languages like .NET or Java.

There are two possible solutions to this problem. One solution is to reskill existing developers, but as we’ll explain below, this can encompass a fairly steep learning curve depending on their background. Alternatively, organisations can draw from the international group of Rust enthusiasts through dedicated websites like https://rustjobs.dev/. In fact, this is how we found Benoît, a French systems engineer who fell in love with Rust just like we did. He is currently leveraging his experience with low-level systems programming to push Kannika’s already impressive performance even further.

The Learning Curve

As we mentioned, the second issue when it comes to using Rust is the learning curve for new developers. First off, the absence of a garbage collector can be frustrating: it’s extremely common to get errors when compiling your code because of Rust’s emphasis on memory safety. In the community, new developers often complain about having to “fight the borrow checker”.

The many errors when compiling can be disheartening, but it’s important to remember that each of them could have caused bugs and vulnerabilities if left unchecked, like in some other languages. If you use Rust, a lot of the frustrations of using C and C++ can be avoided.

Tom Verelst, Software Developer

The second aspect depends more on your background as a developer: system programmers might have an easier time learning the language. Rust’s asynchronous programming model will look familiar to JavaScript developers, however. For developers that are completely new to asynchronous programming, adapting to thinking in terms of task management and synchronisation can be challenging

These features require some getting used to, but they quickly become second nature. With Rust, you spend more time developing, but it makes your life much easier later on during refactoring and other upgrades. It’s like scaffolding during construction: having a solid foundation to work on makes all the difference.

Looking Forward

Thanks to the potential of Rust, Kannika is already a proven product, and thanks to the expertise of our developers, it’s getting better every week. We’re impressed with how much it can do with limited resources: in all our deployments, we will never be the bottleneck. While we refine Kannika, Rustaceans worldwide are busy improving Rust itself, so we’re excited to see what the future holds. If you’re looking for a powerful, efficient, and reliable programming language, and you’re not scared of delving into the details, we definitely recommend giving Rust a go!

Do you want to use innovative technologies for your next project? At Cymo, we’re always looking for new ways to help our clients innovate using Event-Driven Architecture (EDA). Contact us today to discuss the possibilities!

Contact us
CYMO HEADSHOTS 19

Written byBryan De Smaele