-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Parse server > 3.0.0 is VERY slow for count operations #5218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Could you do a git bisect to find the commit? |
@acinader That’s a cool trick |
@acinader & @dplewis not that simple to do... I have to patch parse-server each time and release a fork without the .nvmrc file which causes npm issues with other node version. |
and it's not visible on our dev server, as we don't have enough rows in our classes :( |
@SebC99 do you care about the count for 15 million rows? Maybe we can disable count per class. I don’t see any commits that would affect count operations. I’m interested in the issue you have with .nvmrc file |
I fully agree as I really don't care about the counts, but it could be the symptom of something else. |
As for nvmrc it fails the automatic npm install of AWS elb with other node versions |
Did you update the node version of your elb to 8.11? |
No we use 8.8.1 in one environment and 10.13.0 in another. |
I have the same problems. I found out that the problem appeared after #5025. The count method in the node-mongodb-native library has been deprecated, but the countDocuments replacement method works completely differently. |
@Stream1988 nice catch! Then using |
@SebC99 Maybe yes. Unfortunately, my knowledge was enough just to find a problem. How better to fix it - I do not know. For my server, I simply returned the old count method back and do not pay attention to the deprecated warnings. |
Long story short, do not rely on mongo counts, they are ineffective. If you want to have a compatibility method, where we’d use the old estimated count instead, you could well open a PR |
@flovilmart you're right and we don't. But the dashboard is... And is now unusable. |
Just to weigh in as well, since we also experienced the same issue when testing with Parse 3. The dashboard actually brought down the DB for a couple of minutes, since we had missed to configure So I agree with @SebC99 (with my basic MongoDB knowledge) that a solution would be to simply use estimatedDocumentCount, when the query is empty, since it ... wraps the count command. We don't have an upgrade to Parse 3 on our roadmap atm, otherwise I would have opened a PR. |
We had the same issues for our production's Parse Server, since whenever we used Parse Dashboard it caused performance issues for our API's. As a temporary solution I first disabled the fetching of counts in a fork of parse-dashboard, so that we could at least use the dashboard without slowing down our API's. However, I've now created a PR for this issue at #5264. For the PR I've changed so that if no query is specified when performing a count, then the I'm not a MongoDB expert so I'm unsure if fetching the estimated count could cause any issues for Parse. However, it should at least fix the issue with Parse Dashboard fetching counts for large classes. |
This is reasonable that this was the original behavior exhibited by mongodbz |
Closing via #5264 |
Issue Description
With Parse server 3.0.0 everything is going fine, while with Parse server 3.1.1 & 3.1.2 (I haven't test with 3.1.0) count operations are very very slow.
It's immediately visible in Parse Dashboard, as the dashboard tries to display the count of each class (we have around 15 classes plus the parse ones), and it fails to do it, with most requests ending in timeout (especially the ones for the 'big' classes with more than 5M rows).
To be more precise, with Parse Server 3.0.0 those counts appear instantly.
Steps to reproduce
Open the Parse Dashboard on a server with 3.0.0 and compare it with a Parse Dashboard on a serveur with 3.1.1 (and lots of rows)
Server
Database
The text was updated successfully, but these errors were encountered: