sql server - Event Sourcing/CQRS Clustered Index and Partitioning -
i work @ tax processing company using sql server 2016. process millions of tax information returns, , setup concurrent, multi threading, parallel processing system.
for parallel processing write event store, should clustered index on? on uniqueidentifier guid , or (clustered index on identity(1,1) ncx on uniqueidentifier guid)?, or no clustered index (utilize heap)?
do recommend partitioning write event store table?
when update our read-model querying, should still utilize parallel processing update read model? or should conduct single stream update?
also, again should clustered index on read-event model, uniqueidentifierguid or (clustered index on identity(1,1) ncx on uniqueidentifier guid)?
should partition read-model table or other methods?
there general rule indexes on uniqueidentifierguids bad clustered index, cause massive page fragmentation, slower io writes, , large disk space. https://blogs.msdn.microsoft.com/sqlserverfaq/2010/05/27/guid-vs-int-debate/
however, indexes on identity(1,1) integer columns cause latch contention, last page insert “hot spots” in parallel processing. http://www.sqlpassion.at/archive/2014/04/15/an-ever-increasing-clustered-key-value-doesnt-scale/
your individual needs depend on architecture of unique system. generally, you'll need able test, measure , profile determine bottlenecks (or be).
for example, number of nodes have writing in parallel @ 1 time , throughput need @ instant.
here 2 tips started:
you want guid id (indexed) , second column clustered index. use identity (sequential number) column clusered index because it's generated in database. generally, won't physically writing disk in parallel (even if try in parallel) make fast , simple (and profile it!).
for each "read model" generate you'll need process events in serial. can have multiple "read models" , if data isolated can build them in parallel.
i'm not sure how familiar eventsourcing can't recommend these 2 resources enough.
http://docs.geteventstore.com/introduction/4.0.2/event-sourcing-basics/ https://leanpub.com/esversioning
Comments
Post a Comment