I would like to ask you for a best practice hint regarding a problem. I'm currently porting an old Java app to Rust. This app has a central "state holder" class, with getters and setters. Synchronization and shared access has been managed in the Java app. So a bunch of sources (REST API, native JNI callbacks) are going to contribute to this "state holder", while some business logic accesses these values read-only e.g. for reporting and inner flow control.
Now, the "state holder" struct is really huge: It consists of a lot of scalar variables, strings, arrays etc. My first intention was to create a static struct in Rust and organize for thread safe setters and getters using Mutex or RwLock.
Meanwhile after having read a lot about this topic I'm not that sure anymore. I think, a channel, fed by multiple clones of the sender (the data sources as before) and one receiver, which merges all the pieces together into a static struct would work too.
What I cannot oversee is the performance penalty. From the feeling I would think a shared memory construct would be more performant, i.e. faster. On the other hand I like the nice send/recv pattern Rust provides.
Given the huge size of the shared state object - what would you suggest?