Hi Sahith, > ... open a PR to update the documentation with that? ...
Sure, thanks a lot for fixing it! > Will answer the metrics question later. For metrics, could you check Apache Ozone or Apache IoTDB to see how they do it? There are a lot of details that are not easy to explain in an email. Please see if you have more specific questions. Tsz-Wo On Fri, Mar 20, 2026 at 7:08 AM Sahith Nallapareddy via user < [email protected]> wrote: > Hello, > > Thanks for the clarification! That makes sense and answers my question > about the threading. If it sounds okay, I can open a PR to update the > documentation with that? Thought it maybe nice to have it written > somewhere too > > Thanks, > > Sahith > > On Wed, Mar 11, 2026 at 10:03 PM Tsz Wo Sze <[email protected]> wrote: > > > > Hi Sahith, > > > > The StateMachine implementation should have a set of states. > > - Only the applyTransactionSerial(..) and applyTransaction(..) methods > can change the states. > > - Note that applyTransaction(..) is asynchronous, i.e. the StateMachine > may allow multiple calls running in parallel. > > - The takeSnapshot() method will wait for applyTransactionSerial(..) and > applyTransaction(..) to complete, i.e. they won't overlap > > - The reinitialize() method, which restores snapshots, does not overlap > the methods above. > > - The query(..) and queryStale(..) methods, which read the states, can > overlap all the methods above. > > > > A simple read-write lock implementation may have > > - write-lock: reinitialize(), applyTransactionSerial(..) and > applyTransaction(..) > > - read-lock: takeSnapshot(), query(..) and queryStale(..). > > > > Will answer the metrics question later. > > > > Tsz-Wo > > > > > > > > > > On Mon, Mar 9, 2026 at 1:32 PM Sahith Nallapareddy via user < > [email protected]> wrote: > >> > >> Hello, > >> > >> Thanks for helping me out! I have been a lot of progress since then > >> and have been able to spin up a multi Raft group setup we been trying > >> out! > >> > >> I had a few questions about the threading model. So I have been using > >> RocksDB in my statemachine and right now I was able to setup > >> transactions with RocksDB and snapshotting. I ran into a few issues > >> with concurrency. I saw in the Counter example the state machines use > >> AtomicInteger, and was wondering should all implemented methods of > >> state machines be designed for thread safe access, including the > >> actual state that is being used? To get myself further, I have made > >> the methods initialize and takeSnapshot marked with synchronized as I > >> had some File operations that were clashing when they were done > >> concurrently. I am wondering if I should think more carefully as well > >> about my applyTransaction method. I am also new to using RocksDB so I > >> am still learning how that will be affected by this. > >> > >> I was also eager to setup metrics, but I wasnt able to easily follow > >> how to do so. https://jojochuang.github.io/ratis-site/docs/metrics I > >> found this link that helped me see what metrics were there out of the > >> box (fantastic!). Do I have to do anything special to turn this on? > >> and how can I integrate with these as well? My goal is to set up some > >> sort of visualization and will most likely go through something like > >> Prometheus/Grafana setup in the end. > >> > >> Thanks for your help so far! > >> > >> Sahith >
