Pause-capable simulation clock

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Pause-capable simulation clock

I have created a new branch of powertac-server (git checkout pause-mode) that contains a new simulation clock. This clock does not use the quartz scheduler, and it does not start a new thread for each tick. Instead, there is a timer thread that monitors progress of the simulation and pauses the clock when the server's work is not completed within the nominal timeslot period. I have posted a detailed diagram of its operation in the server wiki. Ultimately, the updated sim-start time will be communicated to brokers when this happens, and it will be possible for brokers to request a pause. This will be very useful for broker developers, and for anyone hoping to develop mixed-initiative brokers.

A consequence of this change is that we will not be starting a new hibernate session on each tick. On the other hand, new hibernate sessions are started for incoming JMS messages from brokers, which drive activities in the tariff and auction markets. In order to allow these sessions access to the database, we need to be careful about our use of transactions, because they serialize access to database elements. My suggestion is that the CompetitionControlService by non-transactional, but that all other services that are called directly or indirectly by the CCS are transactional. Note that a transactional service is one in which each method is executed in a transaction.

Please add your comments if you see a flaw in this reasoning or have something to add.