Are there well-known recommendations for synchronizing tasks in a server farm? For example, if I have a forum-based site running on a server farm, and there are two moderators who try to perform some actions that require writing to several tables in the database, and the requests of these moderators are processed by different servers on the farm server, as possible implement some locking functions to ensure that they cannot take this action in the same element at the same time?
So far I have been thinking about using a table in a database for synchronization, for example. check the id of the element in the table if it does not exsit insert it and continue, otherwise return. Probably a common cache could be used for this, but I'm not using it at the moment.
Any other way?
By the way, I use MySQL as the database of my database.
source share