puzzle-massive icon indicating copy to clipboard operation
puzzle-massive copied to clipboard

Improve response time on puzzle piece movements

Open jkenlooper opened this issue 3 years ago • 0 comments

Players that are further from the server located in NY may have a longer latency when getting confirmation of a piece movement. There may be ways of fixing this so players across the globe could have a shorter latency. This would involve running multiple servers across the targeted regions, but I would prefer that a single instance (and database) of Puzzle Massive would still apply.

This problem is not a simple one to solve. It would require replaying of piece movements to get an eventual consistency across all databases for each region.

An alternative could be to use the preferred region of the player when a puzzle becomes active. This would mean other players in that same region would benefit from the shorter latency, but any player further from that region that joins that puzzle later while it is still active, would not get the shorter latency. This alternative solution would be less complex to implement and less likely to introduce bugs.

Another alternative could be to create a separate copy of the Puzzle Massive site for each region. The puzzle images could still be shared across the copies, but all puzzle piece data and movements would not be shared across regions.

The cost of running servers in multiple regions is not quite in the project's budget at the moment.

Other alternatives that don't require running multiple servers would mean moving the piece joining logic and such to the client-side and basically supporting offline jigsaw puzzles with the chance to re-sync up when the client is back online. This is probably a bad idea since preventing of script attacks and bad actors would be even more challenging.

Possible Solutions

  • Distributed puzzle data across regions with eventual consistency
  • First player that activates a puzzle sets the preferred region
  • Create copies of Puzzle Massive that share all the data except piece data
  • Client side magic that does eventual consistency

Blockers

  • Cost of running multiple servers with data

jkenlooper avatar Sep 27 '21 04:09 jkenlooper