So I'm implementing a custom UI layer with compose (It doesn't use anything but the core compose runtime) and I want to support 1000 -10000 root level compositions (that many clients connected) on a single JVM. But it seems to me that I have no way to isolate Snapshot state between instances on a single JVM instance without reaching out to the class loader. Is there a way to circumvent the GlobalSnapshot or notify recomposers based on a nested snapshot without applying to GlobalSnapshot
s
shikasd
10/06/2024, 2:47 PM
Why did you want to have 1000s of roots on a single jvm? Can it be expressed as 1 root with many children?
g
Gat Tag
10/06/2024, 4:13 PM
The server is running different UIs for each client each with their own state and their own virtual thread. Compose runs on the server and generates UI objects that are incrementally synced with the clients, clients can send interactions back that modify the source data that will cause a recompose of the UI which will incrementally update the UI objects that need to change. The clients are very dumb and don't have any real logic on them
Gat Tag
10/06/2024, 4:14 PM
and to the second question, maybe, I really don't know. I am trying to avoid contention with the single global lock that exists
Gat Tag
10/06/2024, 4:18 PM
Think something like Phoenix Liveview but with Kotlin and Compose
s
shikasd
10/06/2024, 4:22 PM
I don't think that's possible, current version of snapshots is written with a single threaded application in mind, so we take certain optimizations that are known to make multithreaded environments, such as your server worse
g
Gat Tag
10/06/2024, 4:26 PM
Yeah I think I gathered that, was just hoping that there was someway to circumvent the single global snapshot and I would be happy for now. Looks like ClassLoader's it is for the short term