This article explains why duplicate requests occur, defines idempotency, and presents common backend strategies—such as unique indexes, optimistic locks, anti‑repeat tokens, anti‑repeat tables, and distributed locks—illustrated with an order‑processing workflow.
This article examines the technical challenges of handling massive concurrent traffic during flash‑sale events, explains why backend APIs become bottlenecks, and presents practical strategies—including request design, overload protection, anti‑abuse measures, and data‑safety techniques such as pessimistic, FIFO, and optimistic locking—to keep web systems stable and performant.
This article explains the mathematical and programming concept of idempotency, provides real‑world examples such as duplicate form submissions and payment requests, and details practical techniques—including query/select operations, unique indexes, token mechanisms, pessimistic and optimistic locks, distributed locks, and API design—to ensure idempotent behavior in backend systems.
This article explains how to use pessimistic (FOR UPDATE) and optimistic (version field) database locks in a Java SSM red‑packet application to prevent over‑issuance, details implementation steps, code changes, performance testing, and the trade‑offs between lock types.
The article explains the concepts of pessimistic and optimistic locking, details how CAS (Compare‑And‑Swap) implements optimistic locks in Java, discusses their advantages, drawbacks such as the ABA problem and high spin costs, and compares CAS usage with synchronized blocks in concurrent programming.
This article explains MySQL's lock mechanisms, covering table‑level, row‑level, and page locks, the differences between pessimistic and optimistic locking, shared locks, and provides guidance on when to choose table locks versus row locks in various application scenarios.
This article uses a humorous story of two threads battling over inventory updates to illustrate the principles, advantages, and drawbacks of pessimistic and optimistic locking in distributed systems, helping readers understand when to apply each concurrency control method.
The article explains the mathematical definition of idempotency, its importance in preventing duplicate operations such as repeated payments or order creation, and presents practical strategies—including unique business IDs, optimistic locking, deduplication tables, distributed locks, token mechanisms, and payment buffering—to achieve reliable idempotent behavior in backend services.
This article walks through building a Java‑based flash‑sale (秒杀) service, diagnosing overselling issues, and progressively enhancing it with optimistic locking, distributed rate limiting, Redis caching, and asynchronous Kafka processing to achieve higher throughput and data consistency under heavy concurrency.
This article explains how to replace traditional in‑process locks with a Redis‑backed distributed lock service, detailing the overall architecture, server and client designs, management features, lock lifecycle, grading strategies, and fallback options such as database and Zookeeper solutions.
This article dissects the technical challenges of building a high‑concurrency flash‑sale (seckill) system—covering business analysis, traffic isolation, static page caching, CDN bandwidth, dynamic order URLs, request throttling, database sharding, optimistic locking, and anti‑cheat mechanisms—while presenting concrete architectural principles and code examples.
The article explains how a schemaless JSON document model stored in a relational database can replace traditional relational tables for trading system orders, reducing schema change costs, improving flexibility, and ensuring consistency through version‑based optimistic locking and real‑time Elasticsearch indexing.
The article examines the upgrade to a balance‑based financial accounting system, defines hotspot accounts, explains why they pose concurrency challenges, and evaluates several technical solutions—including optimistic locking, asynchronous processing, and account splitting—to guide appropriate strategy selection for different business scenarios.
The article explains how high‑concurrency systems can be built by decomposing workloads through optimistic locking, read‑write database splitting, resource separation with CDN acceleration, dynamic‑to‑static conversion, caching, and load‑balancing strategies, providing practical code examples for each technique.
This article recounts a series of real‑world production incidents—including massive concurrency overloads, DDoS attacks, SQL injection breaches, and critical bugs—encountered by an internet finance platform, and shares the concrete technical fixes and lessons learned to improve system resilience.
This article analyzes the flash‑sale (seckill) business model, outlines its unique technical challenges such as impact on existing services, database load, bandwidth spikes, URL security, button activation, and order handling, and then presents a comprehensive backend architecture, design principles, code examples, database sharding, caching, and consistency strategies to reliably support massive concurrent purchases.
This guide explains Oracle's lock mechanisms—including shared, exclusive, row‑level, pessimistic, and optimistic locks—through step‑by‑step SQL sessions that illustrate update‑lost problems, lock contention, and deadlock detection, helping developers choose the right strategy for concurrency control.
This article explains why locks are needed in multi‑user environments, describes common conflict types such as lost updates and dirty reads, compares pessimistic and optimistic locking mechanisms, shows practical implementations with version numbers and SQL Server locks, and presents a classic financial‑system case study.
This article analyzes the characteristics and technical challenges of flash‑sale (seckill) systems, proposes isolation and static‑page strategies, outlines architecture principles, detailed front‑end and service‑layer designs, discusses database sharding, caching, concurrency control, overload protection, and anti‑cheat measures to ensure reliable high‑throughput order processing.
This article analyzes the complete flash‑sale workflow, identifies its unique characteristics and high‑concurrency technical challenges, and presents a layered architecture—including frontend static pages, request interception, queue design, database sharding, caching, optimistic locking, and anti‑cheating measures—to ensure reliability, scalability and data safety.
The article explains why overselling occurs in flash‑sale systems under high concurrency, analyzes the drawbacks of pessimistic locking and FIFO queues, and presents optimistic locking with version control as a more efficient solution for ensuring thread‑safe inventory updates.
This article explains two key relational database design techniques: using auto‑increment or UUID physical primary keys for foreign key relationships, and employing optimistic locking with a version column to safely handle concurrent updates, while also covering when locks can be omitted.
This article explores the challenges of handling tens of thousands of requests per second in flash‑sale systems, covering interface design, QPS calculations, overload protection, anti‑cheat measures, and data‑safety techniques such as pessimistic, optimistic, and queue‑based locking.
This article explains why using a physical primary key for foreign‑key relationships, how to implement optimistic locking with a version column for concurrent updates, and when it’s safe to update records without any locking, providing practical SQL examples for reliable database design.