MongoDB Realm syncing size

Is it ok that initial syncing size for application is constantly increasing? For example i have sync cluster with approximate size of all collections 12mb. However in application realm sync currently downloads about 60mb of data when application installed first time. And this size is increasing. I have some functions running frequently and making changes in database. But overall cluster database size which syncing is not increasing.

So this is not clear for me, why syncing size is always increasing. I understand that old users receive updates on database changes. But why it affects new users? In that case after few months new users of my application will need to download 100mb of data just to start working with app.

1 Like

@Mikhail_Mulyar Realm Sync stores a history of operations that has occurred on the state so that we can deliver conflict free state - see writeup here - https://docs.mongodb.com/realm/sync/protocol/#changeset

We do have a Compaction feature that will prune unneeded changesets from the history. You can request this feature be enabled on Realm Sync app by opening a support ticket

I should say that It makes Realm sync to look quite unusable in long term perspective. If sync size will always grow up, then at some point new users will not be able to use application because syncing will take too much time. In perspective of new users it will look not good. Does new user need to download all changeset history which was done before? Isn’t latest version is enough for it?

@Mikhail_Mulyar Yes - this is why we released the compaction feature - to improve the performance of new users. We will also building a new flexible syncing api that will enable users to download the latest version instead

Ok, thanks! And why this feature is not available by default, is it still in development?

@Ian_Ward I have confirmation that Compaction feature have been enabled for my Realm app. However i can’t find where to activate/control it. Can you describe where it is located in UI or is it working somehow automatically?

It works automatically - no user configuration is needed right now

@Ian_Ward and is it one time action or it will execute compaction again after some time period?

it executes at regular intervals and is non-disruptive to your sync workload

2 Likes

Can you describe the compaction feature more in terms of what it’s doing under the hood?

Compaction works by pruning superfluous operations. For instance, say you update a field to A and then update that same field to B later on. The server will remove that first update command because it is not needed in the history to get to the final state.

3 Likes

Is this different from the compaction feature listed here?

Is this available for React Native?

2 Likes

Hello Christian_Wagner,

So yes, our React.Native SDK does support compaction.

You can find our API information for compaction here

Anything else I can help you with, please feel free to let me know!

Thanks, I was looking for it in the wrong place then, as I expected an equivalent section below the Encrypt a Realm - React Native SDK, in the same place as in the the iOS SDK. I guess not all sections in the SDKs are synchronised with all topics.

I suppose the Compaction feature enabled by customer support on special request for the Realm App goes beyond the compaction described in the SDK, right?