Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
CQRS - Innovative solution for problemsof modern enterprise architectures. Andrey Lomakin (lomakin.andrey@gmail.com) Artem...
Table of content1. Why CQRS ?   a) Milestones of enterprise architecture history   b) Pitfalls of CRUD   c) CQRS as soluti...
Why CQRS ?I. Why CQRS ?             3   www.ExigenServices.com
Back to the beginningLets talk about evolution of enterprise             architecture                ?                    ...
Evolution of presentation of documentsEpoch of paper documents                            5   www.ExigenServices.com
Evolution of presentation of documentsEpoch of electronic storages                            6   www.ExigenServices.com
Epoch of electronic storages                           7   www.ExigenServices.com
Epoch of electronic storages                           8   www.ExigenServices.com
Evolution of data processingEpoch of business processes                               9   www.ExigenServices.com
However…CRUD approach is oriented on data manipulation, but not on business         logic modeling .                      ...
Pitfalls of CRUD   II. Pitfalls of CRUD                          11   www.ExigenServices.com
Problem #1. Usage of JavaBeans ….JavaBean – “Reusable software componentsthat can be manipulated visually in a buildertool...
… results in …1. Broken encapsulation of business   objects.2. Worse code readability.3. Harder maintainability.4. All bus...
Problem #2. Performanceoptimization and consequences.Usage of ORM tools with denormalization dilutes                      ...
Problem #3. ScalabilityDuring business data processing we always chose                C in CAP theorem                    ...
Problem #4:In real life concurrent data         modification conflicts do not exist. Real life business processes do not ...
CQRS as solutionIII. CQRS as solution                     17   www.ExigenServices.com
CQRSCQRS - Command QueryResponsibility Segregation                    18   www.ExigenServices.com
Problem # 1: Usage of JavaBeansJavaBeans are still used on query side only     but JavaBean != Domain Entity.             ...
Problem #2. Performance optimization and  consequences.Data denormailzation is used     on query side only                ...
Data on query sideEach table – reflection of presentation of data on user                         screen.     Database are...
Problem #3. Scalability Data consistency is needed on business  logic side only. On query side eventual consistency is  ...
Problem #4:In real life concurrent data           modification conflicts do not exist.Two approaches to present object sta...
Two approaches to present object state                2. In form of event queue+11.2 M $   + 5.3 M $                      ...
Two approaches to present object state Each aggregate (DDD) – event container. There is no need to use relational  datab...
Two approaches to present object stateAdvantages:   System monitoring support.   Ability rollback system state till any ...
Conflict resolution Correctcustomer address                          Conflict     Customer                          resolv...
Architecture of CQRS applicationsIV. Architecture of CQRS applications                                   28   www.ExigenSe...
CQRS – is approach only       CQRS is approach only,how it will be implemented, depends                on you.            ...
Queries  Multilayer architecture              CQRS         DB query                     DB queryConversion to domain model...
CommandsCommand – presentation of business action, action  which is meaningful for end user.Advantages of usage of command...
….advantages…..1. Good preconditions for DDD usage.2. Usage of complex event processing   possibilities.3. Simplicity of d...
CQRS frameworksV. CQRS frameworks                    37   www.ExigenServices.com
Axon frameworkAxon framework - most popular and           feature rich.                          38   www.ExigenServices.com
Example of CQRS applicationAddress Book – address list management                                      39   www.ExigenServ...
Command creation and submission                          41   www.ExigenServices.com
Command processing                     43   www.ExigenServices.com
Business action                  44   www.ExigenServices.com
Event processing on query side                            45   www.ExigenServices.com
Query side             47   www.ExigenServices.com
Simplicity of configuration                              48   www.ExigenServices.com
Axon – repository и event store.Repository                                 JPAEvent Store               File System       ...
Event Stores – pros and cons    JPA Event Store                            Mongo DB, File systemTransactional but slow    ...
Questions            51   www.ExigenServices.com
Authors Artem Orobets. twitter: @Dr_EniSh ,   enisher@gmail.com, skype: dr_enish Andrey Lomakin. twitter: @Andrey_Lomaki...
Sources1. First CQRS introduction http://www.infoq.com/presentations/greg-   young-unshackle-qcon082. CQRS architecture ov...
CQRS innovations (English version)
CQRS innovations (English version)
CQRS innovations (English version)
CQRS innovations (English version)
CQRS innovations (English version)
CQRS innovations (English version)
CQRS innovations (English version)
You’ve finished this document.
Download and read it offline.
Upcoming SlideShare
Apache Cassandra, part 2 – data model example, machinery
Next
Upcoming SlideShare
Apache Cassandra, part 2 – data model example, machinery
Next
Download to read offline and view in fullscreen.

Share

CQRS innovations (English version)

Download to read offline

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

CQRS innovations (English version)

  1. 1. CQRS - Innovative solution for problemsof modern enterprise architectures. Andrey Lomakin (lomakin.andrey@gmail.com) Artem Orobets (enisher@gmail.com)January 1, 2013 www.ExigenServices.com
  2. 2. Table of content1. Why CQRS ? a) Milestones of enterprise architecture history b) Pitfalls of CRUD c) CQRS as solution2. CQRS internals3. Axon framework as CQRS implementation 2 www.ExigenServices.com
  3. 3. Why CQRS ?I. Why CQRS ? 3 www.ExigenServices.com
  4. 4. Back to the beginningLets talk about evolution of enterprise architecture ? 4 www.ExigenServices.com
  5. 5. Evolution of presentation of documentsEpoch of paper documents 5 www.ExigenServices.com
  6. 6. Evolution of presentation of documentsEpoch of electronic storages 6 www.ExigenServices.com
  7. 7. Epoch of electronic storages 7 www.ExigenServices.com
  8. 8. Epoch of electronic storages 8 www.ExigenServices.com
  9. 9. Evolution of data processingEpoch of business processes 9 www.ExigenServices.com
  10. 10. However…CRUD approach is oriented on data manipulation, but not on business logic modeling . 10 www.ExigenServices.com
  11. 11. Pitfalls of CRUD II. Pitfalls of CRUD 11 www.ExigenServices.com
  12. 12. Problem #1. Usage of JavaBeans ….JavaBean – “Reusable software componentsthat can be manipulated visually in a buildertool”. 12 www.ExigenServices.com
  13. 13. … results in …1. Broken encapsulation of business objects.2. Worse code readability.3. Harder maintainability.4. All business logic is placed in service methods. 13 www.ExigenServices.com
  14. 14. Problem #2. Performanceoptimization and consequences.Usage of ORM tools with denormalization dilutes 14 www.ExigenServices.com
  15. 15. Problem #3. ScalabilityDuring business data processing we always chose C in CAP theorem 15 www.ExigenServices.com
  16. 16. Problem #4:In real life concurrent data modification conflicts do not exist. Real life business processes do not have concurrent data modification conflicts. Detection of such conflict is sign of flaw in implementation of business logic. CRUD does not take this into account. 16 www.ExigenServices.com
  17. 17. CQRS as solutionIII. CQRS as solution 17 www.ExigenServices.com
  18. 18. CQRSCQRS - Command QueryResponsibility Segregation 18 www.ExigenServices.com
  19. 19. Problem # 1: Usage of JavaBeansJavaBeans are still used on query side only but JavaBean != Domain Entity. 19 www.ExigenServices.com
  20. 20. Problem #2. Performance optimization and consequences.Data denormailzation is used on query side only 20 www.ExigenServices.com
  21. 21. Data on query sideEach table – reflection of presentation of data on user screen. Database are not restricted to be SQL only. Possible alternatives - Apache Cassandra, HBase, OrientDB …. 21 www.ExigenServices.com
  22. 22. Problem #3. Scalability Data consistency is needed on business logic side only. On query side eventual consistency is totally acceptable. 22 www.ExigenServices.com
  23. 23. Problem #4:In real life concurrent data modification conflicts do not exist.Two approaches to present object state1. In the form of values of variables inside object 23 www.ExigenServices.com
  24. 24. Two approaches to present object state 2. In form of event queue+11.2 M $ + 5.3 M $ - 8.2 M $ Sum: 8.3 M $ 24 www.ExigenServices.com
  25. 25. Two approaches to present object state Each aggregate (DDD) – event container. There is no need to use relational databases. It is preferable to have DB with ACID properties. 25 www.ExigenServices.com
  26. 26. Two approaches to present object stateAdvantages:  System monitoring support.  Ability rollback system state till any moment in the past.  Framework for data replication and conflict resolution. 26 www.ExigenServices.com
  27. 27. Conflict resolution Correctcustomer address Conflict Customer resolver reallocated Customerreallocated 27 www.ExigenServices.com
  28. 28. Architecture of CQRS applicationsIV. Architecture of CQRS applications 28 www.ExigenServices.com
  29. 29. CQRS – is approach only CQRS is approach only,how it will be implemented, depends on you. 29 www.ExigenServices.com
  30. 30. Queries Multilayer architecture CQRS DB query DB queryConversion to domain model Conversion to domain model Conversion to DTO Conversion to DTO Transmutation of data Transmutation of data to client to client 31 www.ExigenServices.com
  31. 31. CommandsCommand – presentation of business action, action which is meaningful for end user.Advantages of usage of commands:1. Orientation on business problems.2. Convenient facilities for monitoring and scalability. 33 www.ExigenServices.com
  32. 32. ….advantages…..1. Good preconditions for DDD usage.2. Usage of complex event processing possibilities.3. Simplicity of distribution of responsibilities between highly specialized commands. 36 www.ExigenServices.com
  33. 33. CQRS frameworksV. CQRS frameworks 37 www.ExigenServices.com
  34. 34. Axon frameworkAxon framework - most popular and feature rich. 38 www.ExigenServices.com
  35. 35. Example of CQRS applicationAddress Book – address list management 39 www.ExigenServices.com
  36. 36. Command creation and submission 41 www.ExigenServices.com
  37. 37. Command processing 43 www.ExigenServices.com
  38. 38. Business action 44 www.ExigenServices.com
  39. 39. Event processing on query side 45 www.ExigenServices.com
  40. 40. Query side 47 www.ExigenServices.com
  41. 41. Simplicity of configuration 48 www.ExigenServices.com
  42. 42. Axon – repository и event store.Repository JPAEvent Store File System JPA Mongo DB 49 www.ExigenServices.com
  43. 43. Event Stores – pros and cons JPA Event Store Mongo DB, File systemTransactional but slow There is no ACID support better performance 50 www.ExigenServices.com
  44. 44. Questions 51 www.ExigenServices.com
  45. 45. Authors Artem Orobets. twitter: @Dr_EniSh , enisher@gmail.com, skype: dr_enish Andrey Lomakin. twitter: @Andrey_Lomakin , lomakin.andrey@gmail.com , skype: lomakin_andrey 52 www.ExigenServices.com
  46. 46. Sources1. First CQRS introduction http://www.infoq.com/presentations/greg- young-unshackle-qcon082. CQRS architecture overview - http://elegantcode.com/2009/11/11/cqrs-la-greg-young/3. Greg Young blog - http://codebetter.com/gregyoung/4. Race conditions does not exist http://www.udidahan.com/2010/08/31/race-conditions-dont-exist/5. Domain Driven Design Aggregator - http://domaindrivendesign.org/6. Axon framework home page - http://code.google.com/p/axonframework/7. Mark Nijhof blog http://cre8ivethought.com/blog 53 www.ExigenServices.com
  • VladLyga

    Aug. 11, 2016
  • AndiPangeran2

    Apr. 3, 2016
  • AmanManocha3

    Oct. 10, 2015
  • chinaares

    Sep. 23, 2015
  • jimmiethesun

    Apr. 20, 2015
  • yiqing95

    Nov. 2, 2013
  • viggo.navarsete

    Sep. 17, 2013
  • fabienfluro

    Sep. 6, 2013
  • zdp120

    Jun. 11, 2013

Views

Total views

2,092

On Slideshare

0

From embeds

0

Number of embeds

66

Actions

Downloads

40

Shares

0

Comments

0

Likes

9

×