Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

Data as a microservice: Distributed data-focused integration

May 23, 2019
Hugo Guerrero
Related topics:
Microservices
Related products:
Developer Toolset

    Microservices is the architecture design favored in new software projects; however, getting the most from this type of approach requires overcoming several previous requirements. As the evolution from a monolithic to a distributed system takes place not only in the application space but also at the data store, managing your data becomes one of the hardest challenges. This article examines some of the considerations for implementing data as a service.

    When following microservices design guidelines, we find references to data handling at several points. Some of those common directions include:

    • Use private databases per service for loose coupling.
    • Embrace eventual consistency.
    • Implement saga pattern for eventual consistency transactions.
    • Use Command Query Responsibility Segregation (CQRS) and API composition.

    With these points in mind, when targeting loose coupling as an essential piece in the architecture, shared databases now become an antipattern, making transactions and querying increase in difficulty. The use of datastores per service requires encapsulated data, whereas the interaction with other domains of the architecture should happen only at the API level, encouraging us to hide data implementation details. As a result, using lightweight frameworks like Spring Boot is just one of the first steps in the microservices journey.

    The query challenge

    Because we have data store per service, we need to make it available for consumption by other services becoming the entry point for this domain. As all the data calls happen at the service level and according to their domain, when a view of composite data is required, a traditional “table join” is no longer an option like we used to have in the shared database implementation. Additionally, we can not write a service that queries the private data stores and aggregates the data because it violates the encapsulation design.

    To solve the previous challenge, we need to bring back to the microservices architecture the use of well-established Enterprise Integration Patterns (EIP) like content enrichment and aggregator. Most of the time, these patterns have been rebranded as API composition pattern and commonly implemented in components like the API gateway.

    In general, the API composition pattern involves the addition of another service, which makes the calls to the underlying data services with the required information to compose the required data view. As seen in the image below, it will first query the Customer Service for the basic information and then use that information to retrieve the history for this customer from the Payment Service.

    At first glance, this looks like a simple composition task; however, the business typically requires more and more control of how the data is consumed and more logic is added to this type of services. Restrictions on the amount of data to be retrieved, permissions of the consuming end user, etc., are common business requirements, making the implementation of this type of service a full-time maintenance task.

    On the other hand, the Command Query Responsibility Segregation (CQRS) tries to tackle the query challenge focusing on maintaining one or more materialized sets of data aggregated from multiple source events. As a result, the complexity of the system increases as an event bus is now a requirement. We will talk about this pattern in future articles.

    Distributed data integration

    As has been discussed before, the distributed nature of microservices makes service-to-service communications and service composition vital for a successful implementation. Trying to implement every service from the ground up in an ad hoc fashion, even though possible, is not always recommended, especially when specialized tools exist already and help us simplify the work.

    In fact, making data available for external consumption through services is one example where coding everything from scratch is avoidable. We can expose data resting in different stores, not only relational databases using existing frameworks that help us implement the API composition pattern but also simple data-as-a-microservice services.

    A distributed data-focused integration provides integrated access to data in any of its store implementations through a single uniform API. Data integration allows joining and unioning data even if the information resides in more than one type of sources beyond SQL or JDBC. Contrary to a database management system, it should not store any data but act as a “single point” interface to optimally access data sources.

    Markedly, this type of framework should be compatible with the distributed nature of microservices. Hence, the engine and implementation should be lightweight and be able to be deployed as a container in cloud environments. Correspondingly, you should have the flexibility to execute standalone the components in runtimes like Spring Boot or embed it in your application.

    Summary

    All things considered, going beyond building services in a microservice architecture involves the use of generally established practices like Enterprise Integration Patterns and Data Integration techniques. The ability to query different data sources and join them to expose meaningful information while providing a secure access layer in a lightweight and distributed way, can simplify your applications. And, as Christian Posta said in his article, "data, data integration, data boundaries, enterprise usage patterns, distributed systems theory, timing, etc, are all the hard parts of microservices (since microservices is really just distributed systems!).”

    Last updated: February 6, 2024

    Recent Posts

    • Protect data offloaded to GPU-accelerated environments with OpenShift sandboxed containers

    • Case study: Measuring energy efficiency on the x64 platform

    • How to prevent AI inference stack silent failures

    • Preventing GPU waste: A guide to JIT checkpointing with Kubeflow Trainer on OpenShift AI

    • How to manage TLS certificates used by OpenShift GitOps operator

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.