Sync Gateway Compound Sequences

Hi,

We are investigating a spike in the number of requests made to our API that seem to coincide with us receiving a compound sequence id from the changes feed. We think that when we encounter a compound sequence we are refreshing documents that haven’t changed.

I have attached a log from our SG showing how a compound sequence appears to start with a small gap between lowSeq and Seq, but continues to grow.

Can an explanation be provided of why we get these compound sequences which take the form lowSeq::Seq ?

We want to be able to test the solution we are implementing to stop unnecessary document refreshes, but to test if effectively, we want to be able to create the scenario that generates the type of compound sequence that we see
query_data.csv.zip (14.7 KB)
.

Thanks.

Compound sequences are used when the next non-compound sequence value hasn’t been received the Sync Gateway node within a given time window - SG will send compound sequences to avoid the delayed mutation blocking all replication. The compound sequences should stop being send once the lowSeq value is seen by SG.

This may occur under spikes in load, but should normally return to non-compound sequence after the load returns to normal levels.

A new changes request made with a since value that’s a compound sequence will send all mutations since the low sequence value. If you’re making repeated changes requests with a compound sequence, you will be sent the same change each time for sequences that SG has processed between lowSeq and Seq.

Thanks for the response.