Introduction to Polyglot Persistence: Using Different Data Storage Technologies for Varying Data Storage Needs
13.4. Expanding for Better Functionality
Often, we cannot really change the data storage for a specific usage to something different, because of the existing legacy applications and their dependency on existing data storage. We can, however, add functionality such as caching for better performance, or use indexing engines such as Solr [Solr] so that search can be more efficient (Figure 13.6). When technologies like this are introduced, we have to make sure data is synchronized between the data storage for the application and the cache or indexing engine.
Figure 13.6. Using supplemental storage to enhance legacy storage
While doing this, we need to update the indexed data as the data in the application database changes. The process of updating the data can be real-time or batch, as long as we ensure that the application can deal with stale data in the index/search engine. The event sourcing (“Event Sourcing,” p. 142) pattern can be used to update the index.