Rust and Tell - Berlin - Using Rust inside Scala with robusta_jni by Bogdan Kolbik

Discover how to seamlessly integrate Rust into your Scala application using robusta_jni, achieving better performance, memory safety, and maintainability while overcoming various challenges and complexities.

Key takeaways
  • Rust and Java integration: The talk discusses using Rust inside a Scala application through JNI calls.
  • Optimizer rewriting: The company had an optimizer written in C++ and wanted to rewrite it in Rust to improve performance and memory safety.
  • Macros and code generation: Rust’s macros were used to create libraries and simplify code generation.
  • Error handling: The Rust application panics if an error occurs, and the Java application cannot handle it.
  • Protobuf definitions: Protobuf definitions were used to generate Rust and Scala code for communication between the languages.
  • Observability: The optimizer was rewritten to include observability features, allowing for monitoring of the application.
  • Boosting performance: The Rust optimizer was able to provide better performance and memory safety than the original C++ implementation.
  • Maintainability: The use of Rust and Java in the same application allowed for easier maintenance and debugging.
  • Rewriting without rewriting everything: The company was able to rewrite a single module of the optimizer in Rust without rewriting the entire application.
  • Converting data types: The Rust optimizer was able to convert data types between languages using RobustaJNI.
  • Measuring performance: The company measured performance of the Rust optimizer and was able to find the best solution.
  • Parallel optimization: The Rust optimizer was able to optimize NP-hard problems in parallel, providing better results than the original C++ implementation.
  • Availability: The Rust optimizer was available on both Mac and Linux builds, and was able to run on Kubernetes in the cloud.