Oracle, DistributedTransactions

Oracle Transaction Manager for Microservices: Advanced Management of Distributed Transactions

What is Oracle Tx Manager for Microservices?

In today’s enterprise software development landscape, microservices architectures have become a fundamental strategy for building scalable and flexible distributed systems.

Oracle Transaction Manager for Microservices (MicroTx) is an innovative solution that addresses one of the biggest challenges in these architectures: consistent management of distributed transactions.

Traditional microservices systems face the complex challenge of maintaining transactional integrity across multiple services. Classic approaches like SAGAs have significant limitations in terms of consistency, traceability, and fault recovery. Oracle Tx Manager breaks these paradigms by offering a revolutionary approach.

Key features of Oracle Tx Manager for Microservices include:

1. Automatic Rollback Management: The ability to automatically roll back partial transactions in case of failure, ensuring system consistency.

2. Native Support for Transaction Patterns: Native implementation of patterns such as Try-Confirm/Cancel (TCC) and Saga, simplifying the development of distributed transactions.

3. Multiplatform Integration: Support for different deployment environments, including Kubernetes, Spring Boot, Oracle WebLogic, and cloud platforms such as AWS, Azure, and GCP.

4. Monitoring and Traceability: Integrated tools for detailed tracking of the status of distributed transactions.

This solution not only simplifies the development of complex microservices but also significantly reduces the operational complexity associated with managing distributed transactions.

Case Study: Implementation in the ARENA Tech Innovation Lab

From our innovation lab, we developed a pilot project to test how the features and capabilities of Oracle Transaction Manager for Microservices can address the challenges of a typical financial sector scenario.

To emulate a real-world environment, we defined the following architectural components:

  • Database Layer: 3 Oracle databases representing different business domains.
  • Kubernetes Microservices Layer: Implementation of business services with native orchestration.
  • Spring Boot Microservices Layer: Layer of service libraries deployed on Oracle WebLogic.

Development Framework Used:

  • Language: Java
  • Frameworks:

Spring Boot for the service layer
Kubernetes Operators for orchestration
Oracle MicroTx Library for transaction management

Distributed Transaction Resolution between Kubernetes and Oracle WebLogic

The technical challenge we wanted to evaluate on our enterprise microservices architecture was the integration between different deployment environments, such as Kubernetes and WebLogic, which presented a critical transactional challenge.

Traditional problems included:

  • Transactional inconsistency across different platforms
  • Difficulty maintaining the atomicity of distributed transactions
  • Complexity in managing compensation for partial failures

Solution with Oracle Transaction Manager for Microservices

Oracle Tx Manager introduces a distributed transactional mechanism that abstracts the complexities of different environments, providing a transparent coordination layer:

1. Transparent Transactional Coordination

  • Implements a platform-independent global coordination protocol
  • Enables atomic transactions between microservices in Kubernetes and services in WebLogic
  • Uses a distributed transaction model based on the Try-Confirm/Cancel (TCC) pattern

2. Coordination Mechanism

  • Deploys a centralized coordination service that manages the global state of the transaction
  • Maintains a distributed record of all operations involved in the transaction
  • Implements a two-phase commit (2PC) protocol adapted to microservices environments

3. Automatic Compensation

  • If a transaction fails in either environment (Kubernetes or WebLogic), compensation mechanisms are automatically triggered
  • Each microservice implements its own predefined compensation logic
  • Ensures system consistency through rollbacks coordinated

Technical Implementation of Distributed Transactions

To evaluate Transaction Management, we used the native Oracle Tx Manager framework, as it allows for the definition and management of complex transactions that span multiple services and databases. The implementation was based on the following methodology:

1. Transaction Definition: Use of the Try-Confirm/Cancel (TCC) model to ensure atomicity.

2. Compensation Configuration: Implementation of automatic rollback mechanisms in case of partial failure.

From a practical standpoint, the changes made to the original code to implement the Oracle MicroTx TCC model were as follows:

1. Try-Confirm/Cancel (TCC) Model:

  • Try Phase: Validate and reserve resources without modifying them
  • Confirm Phase: Execute the transaction definitively
  • Cancel Phase: Roll back/compensate reservations if it fails

2. MicroTx Client Implementation:

  • beginTransaction(): Initiate distributed transaction
  • commitTransaction(): Confirm transaction
  • rollbackTransaction(): Perform rollback

3. Transactional Services:

  • Implement the TccTransactionalService interface
  • Separate methods for Try, Confirm, and Cancel
  • Specific business logic in each phase

4. Transaction Coordinator:

  • Orchestrates the transaction phases
  • Success/failure handling in each phase
  • Automatic rollback in case of error

5. Improvements in Error Handling:

  • Use of CompletableFuture for operations Asynchronous operations
  • Handling unexpected exceptions
  • Detailed logging of each phase

Some of the additional benefits observed in the lab are:

• Platform Abstraction: Eliminates the complexity of integrating Kubernetes and WebLogic

• Guaranteed Consistency: Fully atomic transactions

• Flexibility: Adaptable to different microservices patterns

Another objective of the study was to evaluate the potential impact on system performance. In this regard, the metrics obtained confirm the minimal impact of Oracle Transaction Manager:

• Coordination Latency: <30ms per distributed transaction

• CPU Overhead: Increase of less than 4%

• Clearing Success Rate: >99.95%

Monitoring and Traceability

Monitoring tools were implemented that allow for:

  • Detailed tracking of the status of each transaction
  • Recording of events and clearing points
  • Performance and latency metrics

Efficiency and Scalability in Distributed Transaction Management

The implementation demonstrated that Oracle Transaction Manager for Microservices not only solves complex transactional consistency challenges, but does so with minimal impact on system performance.

In this regard, we highlight several key benefits:

  • Guaranteed transactional consistency
  • Reduced code complexity
  • Minimal performance overhead
  • Improved scalability

ARENA: Innovation at the Service of Digital Transformation

As an innovation partner in the financial sector, we continue to explore technological solutions that revolutionize how companies address their digital transformation challenges. If you are interested in learning more about this lab or our catalog of technological offerings, please contact us.