Tag

pessimistic lock

1 views collected around this technical thread.

Lobster Programming
Lobster Programming
May 30, 2025 · Backend Development

How to Ensure API Idempotency with Locks: 5 Proven Strategies

This article explores five practical lock-based approaches—including database primary keys, pessimistic and optimistic locks, state machines, and distributed locks—to achieve reliable API idempotency in distributed systems, highlighting implementation details, trade‑offs, and code examples.

API idempotencyDistributed Lockdatabase lock
0 likes · 7 min read
How to Ensure API Idempotency with Locks: 5 Proven Strategies
Cognitive Technology Team
Cognitive Technology Team
Apr 11, 2025 · Databases

Understanding MySQL Concurrency: Read/Write Conflicts, MVCC, and Locking Strategies

This article explains MySQL's three concurrency types—read‑read, read‑write, and write‑write—describes how InnoDB uses MVCC, shared and exclusive locks, and provides practical examples and code for handling update‑loss and write‑write conflicts with optimistic and pessimistic locking.

ConcurrencyDatabaseMVCC
0 likes · 8 min read
Understanding MySQL Concurrency: Read/Write Conflicts, MVCC, and Locking Strategies
Java Tech Enthusiast
Java Tech Enthusiast
Apr 6, 2024 · Backend Development

Inventory Deduction and Concurrency Control in Backend Systems

The article outlines the three‑step inventory deduction workflow—select, verify, update—and explains how concurrent requests can cause overselling, then compares mitigation strategies such as pessimistic SELECT FOR UPDATE locks, optimistic CAS version retries, atomic decrement SQL statements, and Redis transactions, highlighting their trade‑offs in consistency and throughput.

ConcurrencyInventoryRedis
0 likes · 5 min read
Inventory Deduction and Concurrency Control in Backend Systems
Spring Full-Stack Practical Cases
Spring Full-Stack Practical Cases
Nov 19, 2023 · Backend Development

Mastering Pessimistic and Optimistic Locks in Spring Boot 2.6.12

This article explains the concepts of pessimistic and optimistic locking, compares their use cases, demonstrates version‑based and CAS implementations, and shows a complete Spring Boot example with retry‑enabled optimistic lock handling using AOP and custom annotations.

JPAJava ConcurrencySpring Boot
0 likes · 12 min read
Mastering Pessimistic and Optimistic Locks in Spring Boot 2.6.12
政采云技术
政采云技术
Mar 23, 2023 · Backend Development

Distributed Locks: Concepts, Characteristics, and Common Implementation Strategies

This article explains the need for distributed locks in multi‑node systems, describes their core characteristics, and compares popular implementation approaches such as database‑based optimistic and pessimistic locks, Redis atomic locks, and ZooKeeper sequential node locks, highlighting their principles and trade‑offs.

ConcurrencyDistributed LockRedis
0 likes · 8 min read
Distributed Locks: Concepts, Characteristics, and Common Implementation Strategies
Selected Java Interview Questions
Selected Java Interview Questions
Feb 23, 2023 · Backend Development

Understanding Lock Strategies: Optimistic, Pessimistic, Read‑Write, Heavy/Light, Fairness and Reentrancy

This article explains various lock strategies—including optimistic and pessimistic locks, read‑write locks, heavyweight vs. lightweight locks, spin locks, fair vs. unfair locks, and reentrant locks—detailing their definitions, use‑cases, underlying mechanisms, and illustrative examples for concurrent programming in Java and other languages.

Concurrencyjavalocking
0 likes · 10 min read
Understanding Lock Strategies: Optimistic, Pessimistic, Read‑Write, Heavy/Light, Fairness and Reentrancy
IT Services Circle
IT Services Circle
Jun 25, 2022 · Databases

Understanding Optimistic and Pessimistic Locks in MySQL

Optimistic and pessimistic locks are conceptual concurrency control strategies used across databases and caching systems; the article explains their principles, MySQL implementations with SELECT ... FOR UPDATE and version checks, compares their trade‑offs, and advises preferring optimistic locking in high‑concurrency scenarios.

DatabaseMySQLconcurrency control
0 likes · 6 min read
Understanding Optimistic and Pessimistic Locks in MySQL
Top Architect
Top Architect
Feb 26, 2022 · Backend Development

Design and Analysis of a Flash‑Sale System: Architecture, Request Flow, and Lock Strategies

This article analyzes the business scenario of flash‑sale (秒杀) systems, outlines their technical characteristics, dissects the request chain, compares optimistic and pessimistic locking mechanisms with code examples, and presents a comparative table of concurrency‑control outcomes.

Databasebackend architectureconcurrency control
0 likes · 8 min read
Design and Analysis of a Flash‑Sale System: Architecture, Request Flow, and Lock Strategies
IT Architects Alliance
IT Architects Alliance
Feb 24, 2022 · Backend Development

Technical Analysis of Flash‑Sale (秒杀) Systems: Scenarios, Architecture, and Lock Strategies

This article examines flash‑sale business scenarios, outlines their high‑concurrency characteristics, dissects the request‑flow architecture from client to database, and compares optimistic, retry‑optimistic, and pessimistic locking techniques with practical examples and performance considerations.

Databasebackend architectureflash sale
0 likes · 8 min read
Technical Analysis of Flash‑Sale (秒杀) Systems: Scenarios, Architecture, and Lock Strategies
Architect
Architect
Feb 24, 2022 · Backend Development

Design and Analysis of Flash‑Sale (秒杀) Systems: Scenarios, Technical Characteristics, Request Chain, and Lock Strategies

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.

backend architecturedatabase lockingflash sale
0 likes · 9 min read
Design and Analysis of Flash‑Sale (秒杀) Systems: Scenarios, Technical Characteristics, Request Chain, and Lock Strategies
Python Programming Learning Circle
Python Programming Learning Circle
Dec 16, 2021 · Databases

Optimistic and Pessimistic Locking in PostgreSQL with Python Demo

The article explains how concurrent updates can cause data loss in high‑traffic scenarios and demonstrates using optimistic and pessimistic locking in PostgreSQL with Python, including EFCore‑style token checks and a retry mechanism via the tenacity library.

DatabasePostgreSQLPython
0 likes · 7 min read
Optimistic and Pessimistic Locking in PostgreSQL with Python Demo
Java Tech Enthusiast
Java Tech Enthusiast
Nov 18, 2021 · Fundamentals

Pessimistic and Optimistic Locks in Java: Theory and Code Examples

The article compares Java's pessimistic locking mechanisms such as synchronized blocks and ReentrantLock with optimistic approaches like version checks, CAS‑based AtomicInteger and custom spin locks, illustrating each method through counter examples and discussing their performance trade‑offs and limitations.

CASConcurrencyLocks
0 likes · 11 min read
Pessimistic and Optimistic Locks in Java: Theory and Code Examples
YunZhu Net Technology Team
YunZhu Net Technology Team
Oct 15, 2021 · Backend Development

Idempotency in Software Systems: Definitions, Real‑World Scenarios, and Implementation Strategies

The article explains the concept of idempotency, illustrates everyday examples of its importance, defines it mathematically and in software, and presents a comprehensive set of practical solutions—including database constraints, frontend controls, locking mechanisms, token‑based forms, message queues, and RPC safeguards—to achieve reliable idempotent behavior in distributed backend systems.

Backend DevelopmentDatabaseDistributed Systems
0 likes · 11 min read
Idempotency in Software Systems: Definitions, Real‑World Scenarios, and Implementation Strategies
Laravel Tech Community
Laravel Tech Community
Jul 8, 2021 · Databases

Understanding Optimistic and Pessimistic Locks in MySQL/InnoDB

This article explains the concepts, mechanisms, and practical code examples of optimistic and pessimistic locking in MySQL/InnoDB, including version‑based optimistic locks, shared (read) locks, exclusive (write) locks, and how to apply them with Laravel's query builder.

Database ConcurrencyLaravelMySQL
0 likes · 6 min read
Understanding Optimistic and Pessimistic Locks in MySQL/InnoDB
Selected Java Interview Questions
Selected Java Interview Questions
May 29, 2021 · Databases

Understanding Database Locks: Shared, Exclusive, Mutex, Pessimistic, Optimistic, Row, Table, and Page Locks, and Common Concurrency Issues

This article explains the concepts, usage scenarios, and differences of various database locks—including shared (S) lock, exclusive (X) lock, mutex, pessimistic and optimistic locks—as well as row‑level, table‑level, and page‑level locks, and it discusses common concurrency problems such as lost updates, non‑repeatable reads, dirty reads, and deadlocks.

MySQLconcurrency controldatabase locks
0 likes · 8 min read
Understanding Database Locks: Shared, Exclusive, Mutex, Pessimistic, Optimistic, Row, Table, and Page Locks, and Common Concurrency Issues
Full-Stack Internet Architecture
Full-Stack Internet Architecture
May 20, 2021 · Backend Development

Designing a High‑Concurrency Flash‑Sale (秒杀) System: From Naïve Implementation to Optimized Solutions

This article walks through the design of a flash‑sale system, starting with a simple SpringBoot‑MyBatis implementation, then addressing overselling with pessimistic and optimistic locks, applying rate‑limiting algorithms, time‑window controls, interface hiding, frequency limits, and a suite of production‑grade optimizations such as CDN, Nginx load balancing, Redis caching, message queues, and short‑URL handling.

ConcurrencyRate LimitingRedis
0 likes · 14 min read
Designing a High‑Concurrency Flash‑Sale (秒杀) System: From Naïve Implementation to Optimized Solutions
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Apr 18, 2021 · Backend Development

Idempotency: Definition, Scenarios, and Implementation Strategies

The article explains the concept of idempotency, distinguishes it from duplicate submissions, outlines typical use cases such as network retries and form resubmissions, and presents various backend solutions—including unique indexes, deduplication tables, pessimistic and optimistic locks, distributed locks, and token‑based approaches—complete with SQL examples.

Idempotencyoptimistic lockpessimistic lock
0 likes · 11 min read
Idempotency: Definition, Scenarios, and Implementation Strategies