-
Notifications
You must be signed in to change notification settings - Fork 298
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
Performance issues with multiple live queries #386
Comments
If you have the LiveQueries running while the replication is pulling in documents, they're going to re-run the query every time new documents are added. This is a lot more work than just running the query once at the end. When you say "after all data pulled, then i start 10 live query", how are you waiting for the replication to finish? It sounds like that isn't working and you're starting the live queries while there replication is still running. I would really like to see logs with the "Sync" and "Query" logging keywords enabled (see here for details on turning on logging.) Please don't paste huge logs here; use a Gist or Pastebin or something like that. Thanks. |
Hi, thanks for your respond :)
I'll check about the logging and get back asap. |
Hi, I tried run 2 times, the database busy issue seems works fine. App can get all the live queries completed even though got some database busy log. Not sure what was happened before, perhaps i just need to wait more time.. And my other question, how to know about the CBLView construction progress? because if it took time for large data, i want to show the progress. Thanks |
I'm not sure what's going on there. For example Now, the logs show that two of your queries return a huge number of rows:
That's going to be pretty slow and use a lot of RAM. You should be able to make the queries smaller, either by limiting the number of rows, or using paging to get the rows incrementally, or by using grouping or a reduce function to aggregate data. Also: Make sure you're not emitting |
Hi,
After next loading view, it's fast. thanks |
There are only o or 1 rows returned from the query, but that has nothing to do with how much work it took to update the index. It's usually the index updates that are slow. Can you add the "View" logging keyword too? That will show how much time is spent indexing. Also, please update to the latest master branch if you can, since it has some optimizations in it. In particular, if you have views that will be used at around the same time, give them a common prefix ending in a slash. Something like "prefix/view1", "prefix/view2", etc. Then they will be indexed at the same time, which is faster. |
@lichenyang2 can you take a look and add a performance test to check what the current benchmark is and if with fix what the improvement would be? |
@sleith , I couldn't reproduce the issue. Indexing 150k along with 10 views at once could take some time. Please also ensure that the live query objects get retained properly while waiting for the index and query result. I will close the issue and we can reopen if needed. @lichenyang2 , I have a initial result that I can share with you and we could create a new enhancement issue if needed. |
Hi, i got a database issue while loading the live query view.
i read about this issue in other threads, but still no luck on fixing this.
My app flow:
Even though sometimes i see some 'database busy' log, but still works good, can complete the query.
So perhaps if app pull large amount of document and after that do live queries, somehow database locked and live queries can't be completed.
Is there a way for app to detect if database busy? so i can set the app to restart it like step #4.
Thanks
The text was updated successfully, but these errors were encountered: