1.

What is polyglot persistence? Can this idea be used in monolithic applications as well?

Answer»

Polyglot persistence is all about using different databases for different business NEEDS within a single distributed system. We ALREADY have different database products in the market each for a specific business need, for example: 

  • RDBMS

Relational databases are used for transactional needs (storing financial data, reporting requirements, etc.) 

  • MongoDB

Documented oriented databases are used for documents oriented needs (for e.g. Product Catalog). Documents are schema-free so changes in the schema can be accommodated into the application without much headache.

  • Cassandra/Amazon DynamoDB

Key-value pair BASED database (User activity tracking, Analytics, etc.). DynamoDB can store documents as well as key-value pairs.

  • Redis

In memory distributed database (user session tracking), its mostly used as a distributed cache among MULTIPLE microservices.

  • Neo4j 

Graph DB (social connections, recommendations, etc) 

Benefits of Polyglot Persistence are manifold and can be harvested in both monolithic as well as microservices architecture. Any decent-sized product will have a variety of needs which may not be fulfilled by a single kind of database alone. For example, if there are no transactional needs for a particular microservice, then it's way better to use a key-value pair or document-oriented NoSql rather than using a transactional RDBMS database. 

References: HTTPS://martinfowler.com/bliki/PolyglotPersistence.html



Discussion

No Comment Found