Number of requests doesn’t add up

I’ve been playing with Realm, and I noticed that the number of requests you charge for don’t match the activity in the app. Or, I cannot explain how you calculate the number of requests. The documentation on this is straightforward, but, in my mind, the numbers don’t match.

I used your Swift Sync example and run the app and added 10 items. This generated 11 writes (1 group and 10 items).

The number of requests shown is 18.

In the logs, I can see 12 additive changes. 4 connection starts and 3 connection ends. 2 session starts and 2 ends. 1 login. 1 sync other. In total: 36 OK requests.

I understand 11 writes would generate 11 requests. What are the remaining 7 requests?

I didn’t run any functions or triggers. I only launched the app 1 time. In addition to your example code, I also had 2 additional model classes, so 4 model classes/objects in total.


Next day and I can see 19 requests - even though I did not launch the app a single time. Why is that? Is any of the activity related to signing in the admin app generating additional requests?

It’s probably a bit late for you @Lukasz_Ciastko but this might help other people:

I experienced a similar issue with 36 requests (and above an hour of sync runtime) overnight even though the app was not launched. In my case, Realm was running the following requests every 3 minutes (in logs):

  • start session
  • try a bunch of ‘schema --> additive change’ requests for fields in the database
  • end session

It turned out the additive changes in question were due to old bits of schema that were accidentally leftover in my client schema. I’m not sure why this was an issue while the app was not launched though - it seems that Realm was continuously trying to make those changes (but wasn’t complaining about not being able to).

After deleting these bits of schema from my client schema and restarting Sync (not sure if this step was necessary, and I understand this may not be feasible for apps in prod), the problem disappeared.

Hope this helps people with similar issues.