This article explains Spring's transaction abstraction, detailing the roles of PlatformTransactionManager and ReactiveTransactionManager, the TransactionDefinition attributes, TransactionStatus interface, resource synchronization techniques, declarative transaction management with AOP, rollback rules, and provides XML and Java configuration examples for both JDBC and Hibernate environments.
This article explains how Spring enables transaction management through @EnableTransactionManagement, details the underlying proxy mechanism, outlines the basic and detailed execution flow, describes transaction propagation types and their classifications, and shows how to force rollback and use TransactionSynchronization for custom callbacks.
This article explains how application services act as a façade for domain models, outlines key design principles, shows practical Go/Java implementation patterns, discusses transaction propagation and security handling, and provides concrete best‑practice recommendations for building thin, framework‑agnostic backend services.
The article explains the classic three‑layer MVC pattern, its shortcomings in complex Java projects, and proposes adding a Manager layer to separate generic business processing, reduce transaction scope, and improve code organization, illustrated with Spring‑based code examples.
Yanxuan migrated its monolithic trading system from a shared DDB cluster to an independent database by using Netease Data Canal for real‑time sync, a write‑stop switch with Pandora middleware, account and permission isolation, and extensive testing across three phases to ensure data consistency and minimal business impact.
Data ConsistencyDatabase MigrationEnterprise Database
This article explains how Spring enables transaction management through @EnableTransactionManagement, details the underlying advisor and proxy mechanisms, describes the basic and detailed execution steps, explores propagation types with practical code examples, and shows how to force rollbacks and use TransactionSynchronization for lifecycle callbacks.
This article provides a comprehensive guide to Spring transaction management, explaining the inner workings of @EnableTransactionManagement, the basic and detailed execution processes, various propagation mechanisms, forced rollback techniques, and TransactionSynchronization, supplemented with practical code examples and case analyses.
This article analyzes why a Spring service encounters "connection closed" errors during long‑running transactions, explains how MyBatis and Druid manage connections, and provides a programmatic‑transaction solution that splits large operations into smaller units to prevent connection leaks and timeouts.
This article walks through the fundamentals of Spring's transaction management, presenting a practical example, detailed execution workflow, and step‑by‑step source‑code analysis—including bean creation, AOP proxy generation, transaction attribute retrieval, transaction start, commit, and rollback – to help developers master Spring transaction internals.
This article explains common pitfalls of Spring's transaction management—including AOP proxy limitations, unchecked exception handling, self‑invocation, asynchronous execution, multiple data sources, and large transaction issues—and provides practical solutions such as using class‑based proxies, configuring rollback rules, and splitting transactions into smaller units.
This article provides an in‑depth overview of microservice concepts, RPC frameworks, serialization methods, distributed transaction models, CAP and BASE theories, monitoring solutions, high‑availability strategies, load‑balancing techniques, configuration management, service registration/discovery, and Dubbo fault‑tolerance clusters, offering practical examples and code snippets for Java‑based cloud native systems.
This article explains the challenges of distributed transactions in multi‑node systems, reviews common solutions such as 2PC, TCC, Saga, and focuses on implementing eventual consistency using message queues, detailing local message tables, MQ‑based transactions, and loss‑prevention techniques across RocketMQ, Kafka, and RabbitMQ.
The article explains how Go's database/sql pool retains connections until Rows, Stmt, or Tx objects are explicitly closed or a timeout context is cancelled, demonstrates experiments showing blocked goroutines when resources aren't released, and offers practical guidelines—using QueryContext with timeouts, deferring Close/Cancel, and always committing or rolling back transactions—to prevent pool exhaustion and improve MySQL reliability.
This article demonstrates how to accelerate massive MySQL data updates in a Spring Boot application by replacing naïve loops with manual transaction control, multithreaded processing, CountDownLatch synchronization, and UNION‑based SQL batching, achieving up to a five‑fold speed increase.
This article demonstrates how to efficiently update up to 50,000 MySQL records in a Spring Boot‑MyBatis application by comparing simple loops, manual transaction control, multithreaded execution with CountDownLatch coordination, and union‑based batch updates, while analyzing performance and connection‑pool considerations.
This article explains how Spring's @Transactional annotation works by leveraging AOP and dynamic proxies, detailing the bean post‑processor, pointcut definition, proxy creation, interceptor chain, TransactionInterceptor logic, and the transaction commit/rollback process with illustrative code snippets and diagrams.
This article walks through how MyBatis parses the transaction manager factory from XML configuration, builds the Environment, and applies the transaction manager during SqlSession creation, including detailed code examples of XMLConfigBuilder, transaction factories, and the JdbcTransaction implementation.
This article traces the history of data management from manual storage and early file‑system models through the relational revolution to modern distributed databases, covering key concepts like CAP theory, distributed transactions, HTAP, and cloud‑native deployment trends.
This article explains the fundamentals of database transactions, defines distributed transactions, and provides a comprehensive comparison of classic solutions such as XA, SAGA, TCC, local message tables, transaction messages, maximum‑effort notifications, and AT mode, while also covering exception handling and the sub‑transaction barrier technique.
This guide explains how to use Spring Boot's programmatic transaction APIs—including TransactionTemplate, TransactionManager, and transactional event listeners—through detailed code examples, configuration tips, rollback handling, and best‑practice recommendations for backend Java development.
This article compiles a comprehensive set of Spring interview questions covering design patterns, core modules, IoC, DI, AOP, proxy mechanisms, bean lifecycle, circular dependency resolution, transaction isolation and propagation, as well as Spring Boot auto‑configuration principles, providing concise explanations for each topic.
This article explains the evolution from local to distributed transactions, detailing the XA protocol, the two‑phase commit process, the LCN framework, the TCC model, and the design of business compensation mechanisms for reliable microservice systems.
This article explains how Spring's @Transactional annotation works by leveraging AOP and dynamic proxies, walks through the bean post‑processor and advisor setup, and details the core TransactionInterceptor code that manages transaction boundaries during method execution.
This article explains why Spring @Transactional may become ineffective in various situations—such as wrong method visibility, final or static modifiers, internal method calls, missing bean registration, multithreading, unsupported table engines, misconfigured propagation, swallowed exceptions, and improper rollback settings—and provides practical solutions for each case.
This article explains the purpose and inner workings of Spring's @Transactional annotation, detailing how AOP and dynamic proxies create transactional proxies, the role of BeanPostProcessor, advisors, TransactionInterceptor, and the transaction lifecycle, accompanied by code examples and diagrams for deeper insight.
This article explains the purpose and inner workings of Spring's @Transactional annotation, detailing how AOP creates proxy objects, the role of BeanPostProcessor, advisors, interceptors, and the TransactionInterceptor, and walks through key source code snippets that manage transaction boundaries.
This guide explains Spring Boot's two programmatic transaction approaches—TransactionTemplate/TransactionalOperator and direct TransactionManager—provides detailed code examples for using TransactionTemplate with return values, rollbacks, property configuration, demonstrates PlatformTransactionManager usage, and shows how to listen to transaction events with @TransactionalEventListener.
This article explains why a caught javax.validation.ConstraintViolationException in a Spring @Transactional method does not stop the transaction from rolling back, and shows how to debug the flow with logs and breakpoints to understand the underlying commit process.
This article analyzes why the test4 transaction in Spring Data JPA rolls back, covering common pitfalls such as wrong storage engine, improper JPA usage, non‑public transactional methods, and the role of Bean Validation exceptions in triggering rollbacks.
This article explains the purpose and inner workings of Spring’s @Transactional annotation, detailing how AOP creates proxies, defines pointcuts, and orchestrates transaction management through BeanPostProcessors, advisors, interceptors, and the TransactionInterceptor, illustrated with source code snippets and diagrams.
This article explains the purpose of Spring's @Transactional annotation, how it leverages AOP and dynamic proxies to manage transactions, and walks through the core source‑code components—including BeanPostProcessor, advisors, TransactionInterceptor, and the transaction lifecycle—illustrated with concrete code examples.
This article explains the fundamental differences between database connection pools and ThreadLocal, how each is used in Java to improve performance and enable cross‑method transaction control, and provides practical code examples and best‑practice guidelines for managing connections in multi‑threaded applications.
This article explains the fundamental differences between database connection pools and ThreadLocal in Java, showing how pools improve performance while ThreadLocal enables sharing a single connection across a thread for seamless transaction control, and clarifies common misconceptions with code examples and practical insights.
This article explains three typical situations where Spring's @Transactional annotation fails—non‑public methods, internal method calls, and caught exceptions—detailing the proxy‑based AOP mechanism, source code examples, and how to diagnose and resolve each issue.
This article explains three typical situations in which Spring's @Transactional annotation becomes ineffective—non‑public methods, internal self‑calls, and caught exceptions—illustrates each case with runnable code examples, and dives into the underlying AOP and transaction‑management source code to show why the proxy logic is bypassed.
This comprehensive guide explains Spring MVC's MVC architecture, key components like DispatcherServlet and HandlerMapping, request processing flow, transaction management options, and essential annotations such as @Controller, @RequestMapping, @Autowired, and @Transactional, providing Java web developers with a clear, practical overview.
This article explains how Spring transaction management works, details its declarative and programmatic integration methods, examines core implementation classes and AOP proxies, and highlights frequent pitfalls such as ineffective transactions, rollback failures, and timeout issues, providing code examples and solutions for Java backend developers.
This article shares practical techniques for handling large transactions in Spring-based backend systems, covering why @Transactional can cause issues, how to use programmatic transactions, move queries outside transactions, avoid remote calls, limit data volume, execute non‑transactional operations, and leverage asynchronous processing.
This article introduces the limitations of traditional local and distributed transactions for microservices, explains the BASE theory, and details four practical patterns—reliable event notification, maximum‑effort notification, business compensation, and TCC—providing code examples, diagrams, and a comparative table to guide developers in achieving eventual consistency across microservice architectures.
This article compares Spring's programmatic and declarative transaction management, explains how each works with code examples, outlines the benefits and limitations of declarative transactions—including granularity and failure scenarios—and argues why developers should consider programmatic transactions for clearer control and fewer hidden bugs.
The article reviews microservice data consistency challenges, explains why traditional distributed transactions like 2PC/3PC are unsuitable, introduces the BASE theory, and details four implementation patterns—reliable event notification, maximum effort notification, business compensation, and TCC—to achieve eventual consistency.
Microservice architectures struggle with traditional ACID transactions, so this article reviews local and distributed transaction basics, explains why 2PC/3PC are unsuitable, introduces the BASE model, and details four practical consistency patterns—reliable event, async event, business compensation, and TCC—highlighting their mechanisms, advantages, and drawbacks.
This article explains how massive delete operations can cause row locks to be promoted to table locks in SQL Server, why this leads to blocking and errors, and provides practical techniques such as batching, indexing, and intent locks to prevent lock escalation and keep databases responsive.
This article provides a comprehensive overview of Oracle Database Management System, covering its overall architecture, instance concepts, process structures, memory components, configuration schemes, program interfaces, data dictionary organization, and transaction handling mechanisms.
This article explains what database transactions are, demonstrates how to use Spring Boot’s @Transactional annotation with unit tests, and dives into transaction isolation levels and propagation behaviors, providing code examples and guidance for effective transaction management in Java backend applications.
This article introduces the limitations of traditional local and distributed transactions for microservices, explains the BASE theory, and details four major patterns—reliable event notification, max‑effort notification, business compensation, and TCC—to achieve eventual consistency in microservice architectures.
Data Consistencydistributed transactionseventual consistency
This article explains the purpose of Spring's @Transactional annotation, details its configurable attributes, and enumerates six typical scenarios—such as non‑public methods, wrong propagation settings, self‑invocation, and unsupported database engines—that cause the annotation to become ineffective, providing code examples and solutions.
This article explains how the inventory service at a large e‑commerce platform was optimized for high‑traffic sales events by redesigning transaction handling, sharding data by SKU, and combining flexible and rigid transactions to improve throughput while preserving data consistency.
This article explains the internal structure of InnoDB rollback segments, UNDO log storage formats, and the recovery process in MySQL, detailing how transaction IDs, segment headers, page headers, and log records are organized and used to safely roll back or purge data.
This article explains why distributed databases need precise clocks, compares central, logical, and hybrid clock designs, and shows how hybrid logical clocks (HLC) together with two‑phase commit and other transaction techniques enable consistent, high‑throughput distributed transactions.
This article explains Seata’s architecture, core components, and step‑by‑step AT mode workflow—including transaction initiation, branch handling, undo‑log mechanisms, and two‑phase commit/rollback—providing a practical guide for implementing reliable distributed transactions in microservice systems.
This article explores the complexities of building a generic TCC distributed transaction framework, emphasizing the need for RM-local transaction integration, Spring TransactionManager takeover, fault‑recovery mechanisms, idempotency guarantees, and proper handling of Try/Confirm/Cancel phases to ensure global consistency.
This article explains the concepts of local and distributed transactions, introduces the CAP theorem, and demonstrates how message‑queue‑based designs with logging and idempotency can ensure data consistency and reliability in distributed banking scenarios.
CAP theoremdistributed transactionstransaction management
This article explores how applying finite state machines to a ticket order transaction system improves stability, scalability, and maintainability, detailing the system’s architecture, database design, framework selection, custom MSM implementation, and practical challenges such as transaction handling, action matching, asynchronous messaging, and concurrency control.
This article explains how Spring enables transaction management through @EnableTransactionManagement, details the internal configuration selectors, bean registrations, AOP pointcuts, and the TransactionInterceptor implementation, illustrating the flow of transaction attribute detection, method interception, and exception‑based commit or rollback.
To resolve a MySQL single‑core CPU bottleneck, examine and tune slow queries and indexes, eliminate heavy lock contention, break large transactions into smaller ones, and employ tools like perf top to pinpoint performance hotspots, as recommended by Tencent Cloud Database expert Liu Di.
This article examines the challenges of using transactions with database read/write splitting, including potential master‑slave switching errors, connection‑pool deadlocks caused by isolation levels and propagation, and presents Spring‑based dynamic data source and transaction management solutions.
This article explains the essential principles of Spring transaction management, covering transaction propagation, the impact of proxy-based AOP, multithreading safety with ThreadLocal, BeanPostProcessor roles, and common misconceptions illustrated through practical code examples.
The guide explains MySQL/InnoDB deadlocks—how circular lock waits arise, the wait‑for‑graph detection that rolls back the transaction with fewer undo logs, the various lock modes and their behavior in UPDATE/INSERT/DELETE, and practical strategies such as proper indexing, consistent access order, and configuration tweaks to detect, handle, and prevent deadlocks.
This article introduces the TCC (Try‑Confirm‑Cancel) distributed transaction model, explains its three phases with real‑world e‑commerce examples, compares it to other solutions, and shows how mature frameworks ensure eventual consistency and automatic rollback in failure scenarios.
This article explains the purpose of the Service layer in a Java SSM‑based high‑concurrency seckill project, walks through interface design, DTO/VO/PO concepts, provides full Service implementation with transaction management, custom exceptions, enumeration for status codes, Spring XML configuration, and unit testing examples.
This article explains the fundamentals of database transactions, introduces Vitess's architecture, and details how Vitess implements a two‑phase commit protocol for distributed transactions, including transaction IDs, metadata management, preparation, commit, rollback, error handling, and performance considerations, with illustrative Go code snippets.
This article introduces the TCC (Try‑Confirm‑Cancel) distributed transaction model, explains its two‑phase workflow, and outlines six essential design considerations—including two‑phase operation splitting, empty rollback handling, suspension control, idempotency, data visibility, and concurrency—while sharing Ant Financial’s decade‑long practical experience and solutions.
This article details the architecture and implementation techniques of T‑TDSQL’s dual‑temporal database system, covering full‑state data reading, history‑table creation, snapshot query syntax, transaction snapshot attributes, visibility algorithms, transaction‑state management, index design, and valid‑time creation, query, update, and delete operations.
The article explains how distributed transactions work in microservice architectures, using inventory‑order examples and a World of Warcraft raid analogy to illustrate the XA two‑phase commit protocol, its normal and failure flows, limitations, and alternative approaches such as three‑phase commit, message‑queue and TCC transactions.
This article examines the core technologies behind NewSQL databases for OLTP workloads, contrasting them with NoSQL and traditional relational systems by exploring storage engines such as B‑Tree and LSM‑Tree, sharding strategies, replication models, and distributed transaction mechanisms like two‑phase commit.
This article examines how JDK dynamic proxies cause Spring transaction methods to lose their transactional behavior, illustrates the issue with four concrete scenarios, and presents three practical solutions to ensure proper rollback and commit semantics.
This article provides a detailed English-language overview of the Spring Framework, covering its lightweight nature, IoC container, AOP support, core modules, bean lifecycle, configuration methods, annotations, transaction management, and Spring MVC architecture in a concise yet thorough manner.
This article clarifies core concepts such as transaction compensation, CAP theorem, idempotency, and BASE, compares rigid ACID‑based transactions with flexible BASE‑based approaches, and provides best‑practice guidance for choosing and implementing 2PC, TCC, and asynchronous assurance patterns in distributed systems.
This article explains the inner workings of relational databases, covering their core components, query optimization flow, indexing, merge sort, transaction handling, concurrency control, and lock management, while illustrating concepts with examples and diagrams.
The article explains how a payment routing system can be built to manage profitability, user experience, and success rates by combining guide routing and transaction routing, using real‑world analogies, strategy examples, and architectural diagrams to illustrate channel selection, risk control, and cost optimization.
This article explains Spring's declarative transaction mechanism, detailing transaction attributes such as propagation behavior, isolation levels, timeout and read‑only flags, and illustrates each propagation type with Java code examples to show how transactions are started, joined, suspended, or nested.
This article provides a comprehensive collection of 69 Spring interview questions and answers, covering core concepts such as the framework overview, benefits, modules, IoC container, bean scopes, dependency injection, AOP, annotations, JDBC template, DAO support, transaction management, and MVC architecture.
This article explains the challenges of maintaining data consistency across multiple services in distributed e‑commerce architectures and presents six practical solutions—including business integration, the eBay BASE pattern, Qunar's approach, Mogujie's design, Alipay's DTS, and Nongxin's scheme—highlighting their advantages, drawbacks, and implementation details.