High number of RPC/s while app is idle

I’ve finished migrating my apps to the Nakama server and it seems to work ok (with low load and few users).

I am using the C++ client for Mac, iOS and Android (in a Cocos2d-x project) and I notice a relative high number of RPC/s when the app is actually idling and not actively communicating with the server or other users (although client and rtclient are connected). With the 50ms setting for the tick function, the app generates roughly 20 RPCs per second. This worries me as I have around 8000 users that will be online simultaneously (that would be 160.000 RPC/s doing nothing). In addition: while doing nothing (so no active communication or calling of functions). One client generates around 0.16KB/s input and 67KB/s of output… again while nothing is happening).

I’ve managed to trace this back to the call to the tick function every 50ms (the number of RPC/s I see in the dashboards perfectly matches and scales with the callback time. The longer, the less RPCs are generated).

Now comes the interesting part: with the Linux C++ client I’ve created a bot that is online always. Using almost the same code and logic, this bot does not generate any RPC/s when idle (and still client and rtclient are connected, it is ticking every 50ms).

Is this something normal? Or should I be looking for a problem in my implementation? What are normal values that I should expect to see for RPC/s when not calling any custom RPCs.

Well… no that was not normal. It appeared I had an endless loop in the routine that accumulated the offline notifications. Now an Idle client actually generates no data traffic and no RPC anymore (as it should be).


@Pinky I’m glad you solved the issue in your code. Do you think we could make it clearer how the tick function works to help other developers as they get started with the C++ client?

Thanks. Actually it is clearly documented already (it makes sure message queues get fed and read every 50ms or what ever the time you set it too),but while trying to find the issue it seemed to be the only call I made to Nakama (which was not the case as there was a loop somewhere else I overlooked). This made me think that the tick function somehow was talking to the server (where it actually was sending the request for offline notifications and getting data back). I found the stupid mistake in the end by just commenting out more and more code until the last line that remained was the “accumulate notifications” function :man_shrugging:

Ok thanks for the feedback :pray: I’m glad you found the problem :+1: