Building Nanoservices with Rust
Microservices offer modularity and flexibility for development and deployment. However, this comes at the cost of complexity and maintenance. People also state that Rust is fast and safe, but slow to write and not flexible. However, with smart approaches, we can have the flexibility of microservices, the ease of deployment or monoliths, and the freedom of dynamic languages while using Rust. Maxwell Flitton has built fully functioning distributed systems in Rust that are in production with Caroline Morton including medical simulation software for the German government, resulting in awards. Here, they had to rewrite the deployment and testing infrastructure multiple times. This talk will show you the finished approach, where the servers can be run as microservices if needed. But with a different command, all rust servers compile into one binary. The frontend JavaScript app is also embedded into the Rust binary and served by the same single Rust server. Here we have the development experience of microservices, with the deployment and running experience of running a single rust binary. We also get the option to burst our system out and run it as a cluster of microservices if needed. Finally, this talk will cover how to utilise traits so we can swap out different databases and mock networking, data, and auth sources in unit testing without any third-party packages. Building flexible, easy to deploy, unit testable web servers in Rust is now a reality. These approaches are also bleeding into Maxwell’s work in surgical robotics at School of Biomedical Engineering & Imaging Sciences of King’s College London in the emerging field of medical IOT. This nanoservices approach recently reduced server costs from $2,100 a month to $100 a month.
by Maxwell Flitton