2024: Domino Containers - The Next Step. News from the Domino Container commu...
Rust at Ather
1. Rust at Ather
Building smart and efficient EVs with Rust.
Because every ounce of memory matters
2. Need for Speed
一 Data generated by each scooter
per day ~ 1GB
一 Close to a half million trips taken
by the riders synced on cloud in
under 15 minutes
一 Number of sensors working
unison for creating intelligence -
50+
一 Trip planner, Smart Eco,
Theft-tow detection, Range
prediction, IMU data processing
and more
3. Talking about data at scale
VEHICLES ON
ROAD
70 k+
LONGEST RIDE
139 km
HOURS SPENT
RIDING
(PER DAY)
105000+
TRIPS
(PER DAY)
450,000
DISTANCE COVERED
(PER DAY)
1,500,000+
km
200+ Million
km ON ROAD
4. 一 Latency in processing data on cloud v/s scooter
一 Limited hardware specs in existing models
一 2GB RAM
一 Quad Core 1.3GHz processor
一 Increased processing cost on cloud
一 Multiple microservices in the constrained hardware environment to control
the peripherals
一 Need for reducing the cost of hardware for overall reduction in the
Bill-of-Materials
一 Need for portability across processors and controllers for a variety of
applications
Where we hit a snag
6. Problems we are after
一 Utilizing memory and CPU
efficiently on edge devices.
一 Add more intelligence on edge.
一 Processing data real time and
sending to cloud with minimal
latency
一 A framework that offers complete
memory security with guaranteed
performance.
7. Why Rust
一 Memory safety at compile time with
very little need for runtime
additions.
一 Lowers TAT of feature roll-out.
一 Good community with a lot of crates
readily available.
一 LLVM compiler infrastructure which
provides same optimizations as that
of C++.
一 Solves for microcontrollers from
memory management at compile
time.
一 Easy cross-compilation
9. - Collects real time data generated by different peripherals.
- Crunch crunch
- de-serialise
- process(no complex operations)
- batch them in-memory
- serialise the data
- publish to cloud.
- Maintains a continuous MQTT connection to the cloud.
- We also use C code within rust for HSM related encryption.
Rust on our scooter
10. - ML packages available in Rust makes matrix & linear algebra computation
easier
- Performance with safety layer which is robust for embedded use cases
- More focus on model building than the reliability of the code
- Allows easier consumption of C-based algo (experimental)
Intelligence with Rust (In evaluation)
12. Some numbers
Language CPU Memory Execution(s)
Rust 70% 0.6mb 2.43
Go 78% 4.2mb 3.82
Python 100% 8mb 190.72
Test Setup
- RAM: 2GB
- Alg : Multiplication of two 9*9 matrices (because this closely relates to
our algs)
- Processor: Quad Core, single threaded, ARM
13. Some more numbers
Language CPU Memory
Rust 25% 0.4mb
Go 30% 2mb
Test Setup
- RAM: 2GB
- Use Case: ZMQ broker with 2000 messages/sec
- Processor: Quad Core, single threaded, ARM
14. Why does it all matter
- Our Rust application on the vehicle consumes about 3mb - 15mb of RAM.
- The application processes upto 2000 records / sec each ~1kb in size.
- executes 50% faster than Go.
- The memory consumed by Rust is at-least 40-50% lesser.
15. Future Scope
- Migrating more data processing applications on edge.
- Batch processing jobs to aid in data transformations at lower cost and infra.
- Real time processing of Big data on cloud using Rust
- Explore avenue for data conversion for data-lake - json to parquet etc.
- Evaluating scope of identifying least resource chip for cost saving while
moving applications to rust
- KataOS (for microcontrollers i.e. very less memory) to be explored for
memory efficient use-cases