Improved query replica synchronisation in Azure Analysis Services is in preview
Published date: 18 January, 2020
A new Azure Analysis Services setting (in preview) improves performance and consistency of query-replica synchronisation in scale-out environments. Query scale-out distributes client queries across one or more query replicas, reducing response times for high concurrency workloads. Query-replica synchronisation replicates data to query-replica databases.
By default, query replicas are rehydrated in full (not incrementally), which happens in stages. They are detached and attached two at a time (assuming there are at least three replicas) to ensure that at least one replica is kept online for queries at any given time. Clients may need to reconnect to one of the online replicas while this process is taking place.
With the new ReplicaSyncMode setting, it’s now possible to specify query replica synchronisation in parallel. The optimised query-replica synchronisation also provides these benefits:
- All replicas are synchronised in parallel, significantly reducing synchronisation time.
- As all replicas are synchronised in parallel, data across replicas are more likely to be consistent during the synchronisation process.
- As databases are kept online on all replicas throughout the synchronisation process, clients don’t need to reconnect.
- The in-memory cache is updated incrementally with only the changed data, which can be much faster than fully rehydrating the model.
As an example of the benefit of optimised synchronisation, the product team conducted tests on a database roughly 84 GB in size on an S8v2 with three replicas. The sync took about two minutes for an incremental sync versus five minutes for a non-incremental sync. For the same database on an S8v2 with seven replicas, while the time for an incremental sync remained unchanged, the time for a non-incremental sync jumped to eleven minutes.
Possible values for ReplicaSyncMode are:
- 1 (default): full replica database rehydration in stages.
- 2: optimised synchronisation in parallel.
If you set ReplicaSyncMode=2, additional memory may be consumed by the query replicas, depending on how much of the cache needs to be updated. To keep the database online and available for queries, the operation can require up to double the memory on the replica, depending on how much of the data has changed. This is because both the old and new segments are kept in memory simultaneously. Replica nodes have the same memory allocation as the primary node. As there’s normally extra memory on the primary node for refresh operations, it’s unlikely that the replicas would run out of memory. Additionally, a common scenario is that the database is incrementally updated on the primary node, so there shouldn’t be a need for double the memory. If the sync operation encounters an “out of memory” error message, it will retry using the default technique (attach/detach two at a time).
Learn more about query scale-out in Azure Analysis Services.