From a Config Update API to Locking Strategies: Optimistic vs Pessimistic Locks Explained
After encountering potential data overwrite when updating configuration via an API, the author implements an optimistic lock using version numbers and revisits the fundamentals, comparing pessimistic and optimistic locking mechanisms, their implementations in SQL and Java, performance traits, pitfalls, and guidelines for choosing the appropriate strategy.
