CLOUD CONCEPT

Polyglot Persistence

Polyglot persistence is the use of different database technologies within an application or system to match distinct data models, access patterns, and operational requirements.

Cloud Concepts Hub →

What is Polyglot Persistence

Instead of forcing every workload into one database engine, polyglot persistence assigns each workload to a suitable persistence technology. It can improve performance, scalability, and development efficiency, but introduces additional operational responsibilities and cross-database consistency challenges.

Polyglot persistence means choosing storage technologies according to the needs of individual workloads rather than standardizing every application function on one database engine. A system might combine a relational database for financial transactions, a key-value database for shopping carts, a document database for variable product attributes, and a graph database for relationship traversal. The objective is not to maximize the number of databases, but to use specialized capabilities where they provide a measurable advantage.

Database selection starts with access patterns and correctness requirements. Engineers should identify which queries must run, expected request rates, latency targets, data volumes, growth rates, and transaction boundaries. Relational databases are often appropriate for joins, constraints, and transactions across related records. Key-value databases suit predictable lookups by identifier, while document databases support nested records with varying structures. Graph databases support traversals such as finding connections between accounts, devices, and transactions. Search engines provide text relevance and filtering capabilities that differ from ordinary record retrieval.

In the cloud, managed database services make this approach more practical by reducing the work required to provision infrastructure, configure replication, and maintain database software. Each store can be sized and scaled independently. However, managed services do not eliminate application-level responsibilities such as partition-key design, indexing, authorization, data retention, backup validation, and query optimization.

An online retailer might retain orders and payment records in a relational database, keep carts in a key-value database, and publish catalog changes into a search index. The catalog database remains authoritative, while the index is a derived representation optimized for discovery. Search results can temporarily lag behind catalog updates, so checkout should validate current prices and availability against authoritative systems rather than trusting the search index.

Consistency across stores requires explicit design. A transaction committed in one database does not automatically commit an update in another. Naive dual writes can leave inconsistent records when one operation succeeds and the other fails. Transactional outbox patterns, change data capture, and asynchronous events can propagate changes more reliably, but consumers still need idempotent processing, retry handling, monitoring, and reconciliation. Where a business operation spans multiple independently committed stores, compensating actions may be necessary. If a strict atomic invariant spans several records, keeping those records within one suitable transaction boundary may be simpler.

Modernization should target demonstrated limitations rather than replace a relational database merely because a specialized alternative exists. For example, repeatedly joining large relationship tables to evaluate multi-hop fraud connections can indicate an opportunity for a graph database. A predictable, high-volume lookup workload may justify a key-value store. Assess application changes, query compatibility, data conversion, migration downtime, and operating costs before deciding. An incremental migration can backfill the new store, capture ongoing changes, validate correctness and performance, and then cut over selected functionality with a rollback plan.

Common misconceptions include treating polyglot persistence as synonymous with microservices, assuming every service needs a different database engine, or equating multiple database replicas with multiple persistence models. None is required. One database can remain the best choice when workloads share transaction boundaries and its capabilities meet requirements. Additional engines introduce more security policies, recovery procedures, monitoring systems, specialist skills, and potential failure modes. Adopt them when their benefits outweigh that complexity, and define which store owns each piece of data.

Key aspects of Polyglot Persistence

Polyglot persistence combines workload-specific database selection with clear ownership, explicit consistency boundaries, independent operations, and controlled modernization.

Access-pattern-driven selection

Choose databases using concrete queries, latency targets, throughput, data relationships, and consistency requirements. Validate the choice with representative workloads rather than selecting solely by database category.

Purpose-built data models

Use relational, key-value, document, graph, or search capabilities where they fit the problem. A specialized engine should address a specific limitation or requirement, not simply add architectural variety.

Explicit data ownership

Identify the authoritative store for each business entity and distinguish it from caches, indexes, and other derived representations. Define how derived data is refreshed, rebuilt, and deleted.

Deliberate consistency boundaries

Do not assume that transactions extend across independent databases. Design propagation, retries, idempotency, reconciliation, and compensating actions around the business's tolerance for stale or partially completed updates.

Independent scaling and operations

Scale and tune each store for its own workload while accounting for separate monitoring, access controls, backups, and recovery procedures. Managed services reduce infrastructure work but do not remove these responsibilities.

Incremental modernization

Introduce a purpose-built database for a bounded use case, then migrate and validate that use case before expanding adoption. Include change synchronization, performance testing, cutover criteria, and rollback planning.

Cloud services for Polyglot Persistence

These services illustrate complementary roles rather than a required reference architecture. Aurora can own transactional records, DynamoDB can handle predictable key-based access, DocumentDB can store flexible documents, and Neptune can support relationship traversal. OpenSearch Service can maintain a derived search representation, while ElastiCache can reduce repeated reads. Select only the components justified by workload requirements. Connect stores through carefully designed change propagation, define authoritative ownership, and test stale-data behavior, recovery, and reconciliation. Combining managed services does not create a shared transaction boundary or automatically synchronize their contents.

Amazon DynamoDB image Amazon DynamoDB

Provides key-value and document capabilities for workloads designed around known access patterns, such as carts or high-volume identifier lookups. Partition-key and index design are essential, and moving relational workloads requires reconsidering joins and data organization.

Open Amazon DynamoDB →
Amazon Aurora image Amazon Aurora

Provides a relational foundation compatible with MySQL or PostgreSQL for workloads requiring SQL, joins, constraints, and transactions. It can remain the authoritative store for transactional records while specialized databases serve other access patterns.

Open Amazon Aurora →
Amazon Neptune image Amazon Neptune

Provides graph database capabilities for relationship-intensive workloads such as fraud investigation and identity connections. It is a candidate when multi-hop traversals are central to the application and awkward or expensive in the existing data model.

Open Amazon Neptune →
Amazon DocumentDB image Amazon DocumentDB (with MongoDB compatibility)

Provides document database capabilities for applications working with nested, flexible records. Assess supported MongoDB APIs and behavior rather than assuming complete compatibility when modernizing an existing application.

Open Amazon DocumentDB (with MongoDB compatibility) →
Amazon OpenSearch Service image Amazon OpenSearch Service

Provides search and analytics capabilities that can complement an authoritative transactional database. When used as a derived search index, it requires a reliable update pipeline and an explicit policy for indexing lag and rebuilding data.

Open Amazon OpenSearch Service →
Amazon ElastiCache image Amazon ElastiCache

Provides managed in-memory caching that can complement persistent databases for frequently accessed data. Define expiration, invalidation, and cache-miss behavior, and do not assume a cache has the same durability or correctness role as the authoritative database.

Open Amazon ElastiCache →