Hi everybody, We are starting to use SCXML and Java implementation to set up state machines that represent a coordinated network of mobile devices. We are using a master state machine that acts as a coordinator and many identical state machines that represent the mobile devices coordinated by the master one.
The master SM changes of states according to different states of the devices state machines, with some complex coordination conditions. I¹ve two questions related to this : * as our project will integrate an increasing and important number of states, transitions and events for the device states machines, we would like to avoid at maximum to use Java for describing the states and event flow, but do that in SCXML. Reason is maintainability and readability of code. How to trigger easily events to device states machines from the master state machine or the opposite ? More precisely, how to reference in the master state machine the associated devices state machines ? Each device state machine has a different SCXMLExecutor instance and context , as they of course might be in different states at one specific moment. But how to trigger events in XML file from one state machine to other states machines like (master->device, device->master, device->device events) ? It seems that the target field is to be used for this, but how to reference other state machines from the XML file ? Of course we know how to do this in Java code, but triggering events as well as from Java code and from XML code, increase a lot the tuning of the whole system, as it¹s becoming confusing to understand who triggers what and when, when state machine becomes complex. * we may have a quite important number of device state machines running simultaneously (thousands) coordinated by several independent master state machines. Has anyone have experience of performance bottlenecks of such an architecture, as we will have to react in quite short response time to the device events ? In other words, if we load in memory thousands of state machines (typical life time of one device state machine will be between one and two hours), will we face important memory consumptions problems ? A solution based on data base persistent state machines, loaded on request when we got an event, then updated in database and released from memory wouldn¹t be better ? (real time concurrent state machines at a given time will be a much smaller number, as we¹ll get roughly ten to twenty events from the devices during the lifetime.) Thanks for your advises, as always that kind of questions in project start time are key for future scalability Cedric NICOLAS Ville Fluide
