CQRS (Command Query Responsibility Segregation)
An architectural pattern that separates read and write operations into different models, allowing each to be independently optimized, scaled, and evolved for its specific access patterns.
CQRS splits an application's data layer into two sides. The command side handles writes (creating, updating, deleting data) with models optimized for validation and business logic. The query side handles reads with models optimized for fast retrieval and the specific data shapes that views require. The two sides are synchronized through events or eventual consistency mechanisms.
This separation enables powerful optimizations. The write model can use a normalized relational schema optimized for consistency. The read model can use denormalized views, materialized aggregations, or even a different database technology optimized for query patterns. Each side scales independently based on actual load.
For AI products with asymmetric read/write patterns, CQRS is particularly valuable. A recommendation system might write user events to an event store (command side) while maintaining a precomputed recommendation cache (query side) that serves millions of reads per second. The read model can include pre-computed ML features, aggregated user profiles, and cached model predictions, all optimized for sub-millisecond query latency.
Related Terms
A/B Testing
A controlled experiment comparing two or more variants to determine which performs better on a defined metric, using statistical methods to ensure reliable results.
Feature Flag
A software mechanism that enables or disables features at runtime without deploying new code, used for gradual rollouts, A/B testing, and targeting specific user segments.
MLOps
The set of practices combining machine learning, DevOps, and data engineering to reliably deploy, monitor, and maintain ML models in production.
Model Serving
The infrastructure and systems that host trained ML models and handle inference requests in production, optimizing for latency, throughput, and cost.
Semantic Search
Search that understands the meaning and intent behind a query rather than just matching keywords, typically powered by embedding-based similarity comparison.
CI/CD (Continuous Integration / Continuous Deployment)
An automated software practice where code changes are continuously integrated into a shared repository, tested, and deployed to production, reducing manual intervention and accelerating delivery cycles.