Tagged articles
database locking
10 articles · Page 1 of 1

liandkOct 12, 2026 · Backend Development
A production post-mortem reveals how AI-generated SQL caused long-running queries that locked SQL Server, exhausted Tomcat's 300-connection pool, and repeatedly hung the service until restart; the article details root-cause analysis, missing SQL execution timeout, and fixes including connection pool abandonment recovery, query optimization, and monitoring alerts.
AI-generated SQLConnection LeakSQL Server
0 likes · 8 min read

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.
JavaOptimistic Lockconcurrency control
0 likes · 8 min read

The article explains why simple key‑based idempotency fails when a second request carries different parameters, and demonstrates how to use database row locks, request fingerprinting, state machines, and explicit error handling to guarantee safe, non‑duplicate execution in payment‑critical APIs.
API DesignIdempotencyMessage Queue
0 likes · 13 min read

This article explores the challenges of duplicate message consumption in distributed systems, explains why naive de‑duplication fails under high concurrency, and presents four progressively robust idempotency strategies—from database pessimistic locks and local message tables to a state‑machine approach with Redis or MySQL, highlighting their trade‑offs.
IdempotencyMessage Queuebackend development
0 likes · 11 min read

To prevent duplicate processing when integrating message queues for rate limiting and decoupling, this article explains idempotency concepts, common pitfalls, and five practical solutions—including query checks, pessimistic and optimistic locking, deduplication tables, and non‑transactional approaches—complete with code snippets and diagrams.
IdempotencyMessage Queuedatabase locking
0 likes · 11 min read

This article explains what SQL Server deadlocks are, why they occur, demonstrates a reproducible deadlock scenario with T‑SQL code, and provides practical strategies such as proper schema design, indexing, query optimization, shorter transactions, appropriate isolation levels, and monitoring to minimize deadlock occurrences.
SQL Serverdatabase lockingdeadlock
0 likes · 9 min read

This article explains how MySQL's SELECT ... FOR UPDATE statement applies different lock types—row, table, or none—depending on whether the WHERE clause uses primary keys, unique indexes, regular indexes, range queries, non‑indexed fields, or returns no rows, illustrated with practical transaction examples.
Row LockSELECT FOR UPDATESQL
0 likes · 9 min read

The article examines multiple techniques—including direct SQL updates, compare‑and‑swap, optimistic locking, Redis‑based distributed locks, and MySQL shared locks—to ensure correct and consistent account balance modifications and order status changes in high‑concurrency scenarios.
Distributed LockOptimistic LockSQL
0 likes · 7 min read

This article examines flash‑sale systems by outlining typical business scenarios, analyzing read‑heavy and high‑concurrency technical traits, detailing the end‑to‑end request flow, and comparing optimistic, retry‑optimistic, and pessimistic locking mechanisms with practical SQL examples and performance tables.
Optimistic Lockbackend architecturedatabase locking
0 likes · 9 min read

This article presents a complete design and implementation of a flash‑sale (SecKill) system, detailing entity models, DAO methods, service and controller layers, a high‑concurrency test, and an improved solution using row‑level locking to prevent overselling under heavy load.
ConcurrencyJPAJava
0 likes · 8 min read
