proposition: that ^ is not the best strategy to use, if we frequently need to update different subgraphs in the DAG, which have 0 nodes in common.
are we potentially sacrificing parallelism by holding the TRef on the entire State?
two concurrent update(...) invocations can progress in parallel in zioland, but when they come to commit, will the last one to commit go through a retry, even though it will produce the same resultant state in both the cases (because both work on entirely different subgraphs in the dag, and don't really depend on each other) ?
if instead, we hold the TRef on apt subgraphs in the state, could we achieve a throughput greater than in the other case of holding the TRef on the entire State?
stm/tref can very well act as an inmemory concurrent datastore for our app. but there might be a few gotchas.
given situation:
case class State(...)
val inMemDb:TRef[State] = TRef.make(emptyState:State)
inMemDb
in stm transactions, for managing concurrent modifications to stateto modify the state dag, as a first cut, we can call something like
proposition: that ^ is not the best strategy to use, if we frequently need to update different subgraphs in the DAG, which have 0 nodes in common.
State
?update(...)
invocations can progress in parallel in zioland, but when they come to commit, will the last one to commit go through a retry, even though it will produce the same resultant state in both the cases (because both work on entirely different subgraphs in the dag, and don't really depend on each other) ?State
?