What is a good option for a Non-Blocking "Database" (Using a TCP Socket Server) What is a good option for a Non-Blocking "Database" (Using a TCP Socket Server) database database

What is a good option for a Non-Blocking "Database" (Using a TCP Socket Server)


I suggest you use any DB you like (sqlite comes with Python and will probably serve you well!): just have a dedicated thread that accesses said DB, taking requests from a Queue (and using another Queue, passed in as part of the request, to return results if needed). Threads aren't so bad if you have a small number, and they never share access to any structure or system that isn't read-only, communicating only by queues (which are intrinsically thread-safe).


Blocking (in traditional database terms, it's "locking") is inevitable if you want any form of consistency in your data.

Consistency as in "it is impossible for two gamers with distinct scores to both be declared as the winner".

Reducing the locking to a minimum is precisely one of those things in database design that turn it into an art form you (perhaps alas) only get to master after having screwed up so many times.