Building real-time multi-cloud AI Microservices using TxEventQ, Sagas, True Cache in Oracle Database 23ai

May 3, 2024 | 10 minute read
Sanjay Goil
Vice President
Text Size 100%:

 

Modern applications leverage modular services to gain agility, productivity, and faster time-to-market. The prevalent architectural trend is towards microservices, or fewer macroservices, which embody bounded contexts, loose coupling, and employ messaging layers like Apache Kafka for inter-service communication. Typically, these services operate within transaction boundaries and maintain eventual consistency, emphasizing asynchronous operations for scalability. Oracle Database 23ai now integrates Kafka-like messaging and streaming capabilities, facilitating the Transactional Outbox pattern to streamline microservices development. Pluggable databases (PDBs) further simplify bounded contexts, enabling each modular service to possess an independent data store while communicating through Transactional Event Queues (TxEventQ) within the database.

Breaking apart monolithic systems into microservices has become a primary objective for enterprises transitioning from legacy infrastructures to contemporary data-driven, event-driven, and reactive architectures. This transformation involves data refactoring, such as schema splitting, and employs strategies like the strangler pattern to gradually extract modular services, ensuring business continuity and aligning with the requisite skill sets for application development and deployment across cloud, container, and Kubernetes environments.

For seamless transaction management across microservices, Oracle Database 23ai supports Sagas, ensuring transactional integrity even when ideal transactional boundaries aren't achieved. This process operates asynchronously, utilizing TxEventQ as the message broker, and employs lock-free reservations for automatic compensation, adhering to the Eclipse MicroProfile LRA standard APIs adapted for messaging, rather than synchronous REST APIs.

Most enterprise developers struggle to get started with a microservices architecture to modernize their legacy infrastructure. The following 12 patterns are useful to consider when building, testing, and deploying microservices in production. All these 12 patterns are implemented in a multi-cloud backend platform and experienced under 90 minutes with a sample application called CloudBank.

12 patterns for microservices success

One of the twelve patterns for success in microservices is Command Query Responsibility Segregation (CQRS) which separates the operational data generating microservices from the ones that are used for data analytics operations. CQRS replicates data between operational (command) and analytical queries (query) and Oracle True Cache supports this microservices pattern. Oracle True Cache improves application response time while reducing the load on the database server. Automatic management and consistency simplify application development—reducing developer effort and cost. True Cache is a read-only, in-memory, high performance SQL and key-value cache that is automatically managed and consistent.

Oracle Database 23ai builds on the innovations for microservices introduced in Oracle Database 19c. You can still put some of these ideas in production using the Oracle Backend as a Self-Service (OBaaS) platform for web/mobile applications making Spring Boot applications easier, while also providing a full-stack JavaScript platform based on Parse platform (open sourced by Meta). OBaaS  includes an external transaction coordinator called MicroTx that implements the Sagas/LRA APIs. Additionally, MicroTx provides XA and TCC as consistency protocols. Spring AI is the new project in Spring ecosystem that provides API access to OpenAI and Llama LLM models to run RAG pipelines with enterprise data.

Kubernetes is a truly multi-cloud operating environment that allows for microservices to be deployed across multiple cloud vendors with the consistency and standards-based data platform Oracle Database 23ai provides. The Kubernetes operator for Oracle Database makes DevOps seamless between application containers and database containers for CI/CD pipelines as well as production deployment.

Oracle Database 23ai raises the bar for modern event-driven real-time application building, focusing on developer productivity, support for open standards on cloud with Kubernetes and Containers, innovating with microservices architectures in Java, JavaScript, SQL, Python, and offering efficient Gen AI data pipelines for application developers. Application building has never been more exciting. I hope you download the latest Oracle Database 23ai container from the Oracle Container Registry to play with it.

Additionally, if you're an existing Oracle Database developer, you must be familiar with Advanced Queuing (AQ)  in the database. AQ is a disk-based implementation which continues to be available in Oracle Database 23ai, in addition to its high performance in-memory partitioned implementation called Transactional Event Queues (TxEventQ). Support for Kafka Java Client and a Kafka Connector makes it interoperable with Apache Kafka. Oracle Database 23ai introduces AQ to TxEventQ online migration tool to make the transition to high-performance real-time microservices driven architecture seamless and Kafka friendly.

Read here about all the developer innovations in Oracle Database 23ai.

 

Sanjay Goil

Vice President

Sanjay Goil is Vice President Product Management for Microservices and Messaging for the Oracle Database Cloud.


Previous Post

Where is the Complexity? Part 2

Todd Little | 18 min read

Next Post


Oracle Code Assist: AI companion to boost developer velocity

Aanand Krishnan | 5 min read