A long time ago I had to implement a real time service with Java. The best solution was to use whopping 16 megabytes of heap so that it would do a full GC multiple times per second but each of the GCs lasted less than a millisecond.
The plan is to parametrize all std collections on the allocator eventually, but that's not stable yet.
https://crates.io/crates/jemalloc-sys
"background_threads (disabled by default): enables background threads by default at run-time. When set to true, background threads are created on demand (the number of background threads will be no more than the number of CPUs or active arenas). Threads run periodically, and handle purging asynchronously. [...]"
> keep objects after the request ends
Yes. Can that be made in a way compatible with per request allocators?