Me and my team are experiencing slow response times on our Realm app’s GraphQL API (900-1500ms). A few months ago we were experiencing response times of around 300ms, so it’s a significant increase.
I am aware that it is impossible for you to tell what’s causing this increase without knowing the code base. However, we have some general questions regarding what might be the issue.
The weird part for us is that the response times are about the same for every kind of request. Our heavier Custom Resolvers take the same time as the most simple default queries that are directly connected to the Atlas collections. If a certain query would have taken more time, it would have been easy for us to detect a memory leak or something similar in that query’s function, but this does not seem to be the case…
We have upgraded our Atlas Cluster to M20, and have not released the app yet, so it shouldn’t be related to the traffic load.
Our app has grown fairly large, we are using:
- 46 functions
- 1 scheduled trigger (every 10min)
- 15 custom resolvers
- API key + user/password auth
- Rules for every collection (44)
- 100+ unit- and integration tests, that are implemented similarly to your guide: https://developer.mongodb.com/how-to/unit-test-realm-serverless-functions (these tests are not included in the source code of the Realm app though, so we don’t suspect it to be the issue)
Everything is developed through github, nothing is done in the console.
We tried to disable user/password auth and saw a potential decrease in response time (perhaps 100-200ms quicker in average).
We have also tried to remove all functions, custom resolvers, rules and triggers, and we still experienced around 1100ms response times for queries that are directly connected to the Atlas collections (even small collections of like 5 documents).
As you probably can tell, we are getting a bit desperate. Do you have any ideas what might be causing these high response times? Could it be some kind of setting/config that can slow down a whole app? Is our app to large? Any help would be appreciated!