Command-Query Responsibility Segregation (CQRS) pattern

This pattern actually splits the read operations from the write operations by segregating commands from queries. Commands are objects that encapsulate the data in the write model, whereas queries are just a read operation on the read model. Practically, this can be achieved by replicating the database in two, for example, DatabaseA and DatabaseB, which are synchronized through replication techniques. All updates or command operations are done on DatabaseA and read operations on DatabaseB. Thus, reading data from DatabaseB will not affect the performance of write operations, as it points to DatabaseA.

With the Read model (database), we can also apply non-cluster indexes, which are good when searching data. Unnecessary indexing reduces the performance of write operations, as the index tables need to get updated on each write operation. But, with this pattern, performance will not be affected, as they are two separate models.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.142.166