Home > Articles > Data

  • Print
  • + Share This
This chapter is from the book

13.2. Polyglot Data Store Usage

Let’s take our e-commerce example and use the polyglot persistence approach to see how some of these data stores can be applied (Figure 13.2). A key-value data store could be used to store the shopping cart data before the order is confirmed by the customer and also store the session data so that the RDBMS is not used for this transient data. Key-value stores make sense here since the shopping cart is usually accessed by user ID and, once confirmed and paid by the customer, can be saved in the RDBMS. Similarly, session data is keyed by the session ID.

Figure 13-2

Figure 13.2. Use of key-value stores to offload session and shopping cart data storage

If we need to recommend products to customers when they place products into their shopping carts—for example, “your friends also bought these products” or “your friends bought these accessories for this product”—then introducing a graph data store in the mix becomes relevant (Figure 13.3).

Figure 13-3

Figure 13.3. Example implementation of polyglot persistence

It is not necessary for the application to use a single data store for all of its needs, since different databases are built for different purposes and not all problems can be elegantly solved by a singe database.

Even using specialized relational databases for different purposes, such as data warehousing appliances or analytics appliances within the same application, can be viewed as polyglot persistence.

  • + Share This
  • 🔖 Save To Your Account