In my project, I'm going to create lots of mini games. Those mini games can last 30 seconds to 1 week (the duration of the game is decided when it is created and is fixed).The number of concurrent games can be large (more than 1 game per user and we hope to have many users of course :-)).Nothing really happens during the game. They are composed of just a winning condition and end time. Once a game reaches its end, I need the server to check the winning condition (using a remote service) and finalize the game (decide who won and give points). During the time the game takes place, the server does not need to manage it.You can think of the games as bets. Someone places a bet that something will happen in 30 seconds and after 30 seconds I need to check if that something really happened and update the system.Latency of the game finalization should be very fast, especially for short games. Not more than a second or two. I.e, for a game of 30 seconds, I should be able to update if it won or lost a second or two after it ended.I thought about persisting each game to a row in a sql table and schedule a task to run when it ends and finalize it.For example, a user starts a game of 1 minute. The server will create the game in the db and schedule a task to run in 1 minute (and pass it the game's id). When the task triggers, it will finalize the game and update its status in the db.Are there other ways to solve this problem? Maybe something that does not require having a task per game? I thought also about having 1 task that will check for all finished games but for short games (e.g. 30 secs) the polling time must be very short and I'm not sure how well it can scale.
Architecture for monitoring lots of mini-games
scheduling;real time;large scale project