Sobes.tech
Senior

Should OrderService be split into read and write components considering the load imbalance (25k reads vs 5k writes)?

sobes.tech AI

Answer from AI

Splitting OrderService into read and write components (CQRS — Command Query Responsibility Segregation) is justified when there is a significant load imbalance, as in your case (25k reads versus 5k writes). This allows optimizing each part for its specific tasks: horizontal scaling, caching, and fast queries for reading; ensuring consistency and complex business logic for writing.

Advantages:

  • Improved performance and scalability
  • Separation of responsibilities and simplified code
  • Ability to use different data stores for reading and writing

However, it is important to consider:

  • Increased architecture complexity and data synchronization between components
  • Additional maintenance costs

If the system expects growth in load and high responsiveness for reads is important, separation will be beneficial. If the project is small or the load is not critical, keeping a monolith for simplicity may be preferable.

Should OrderService be split into read and write… - sobes.tech