-
Notifications
You must be signed in to change notification settings - Fork 576
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
Poor insertion performance 10k+ records #2728
Comments
Updated table with results when no indices are specified, why are indices in the .Net library so much less expensive than realm-js? |
Thanks for reporting this @cmcnicholas - we need to investigate this further. |
unfortunately the window I had for testing Realm JS and .Net for our use case is over and due to the large number of records we have meant we ended up going with a Xamarin based solution. |
I've been having the same issues with very poor performance on a large number of insertions (~5K). It takes around 30s-60s for the insertions to complete, even in Release mode, sometimes even more. While with Realm v3 it takes ~2s. |
is it true that Realm v3 is faster?! |
Yes, totally! I've tried v6 for a couple of releases, then v10, but ultimately switched to v3.6 as it's the only version that's consistent enough (had a few crashes on both v6 and v10 that never happen on v3). |
@noldidrita Which was the last version you tried with? We did fix and shipped a performance regression. So if you notice any other major regressions, we would love to hear about them! |
@noldidrita thank you! but I decided to get realm out of the project. waste so much time with this. |
These tests are a bit outdated, seeing as they were done with (simulator/emulator benchmarks are not ideal, but perhaps ok for comparison in this case)
|
Test | 1k inserts | 10k inserts | 100k inserts |
---|---|---|---|
realm-js iOS | 144ms | 777ms | 7.36s |
realm-js Android | 201ms | 1.65s | 18.03s |
[email protected]
:
(for comparison)
Test | 1k inserts | 10k inserts | 100k inserts |
---|---|---|---|
realm-js iOS | 240ms | 884ms | 6.04s |
realm-js Android | 148ms | 881ms | 7.52s |
We'll leave the issue open, primarily with focus on Android, which seems to be lacking a bit behind.
I tried to downgrade to 3.6 but I'm unable to install Realm with node 15. What node version you guys had to use? |
@FSPinho node@10 |
any update on this? |
I fixed it without downgrade by doing the following:
Now I'm getting good times for realm@10! |
@FSPinho Thank you for your real-world tips!! @vikas-singh-fareye If possible, it would be very interesting if you can share some code which we can profile to find the bottlenecks. |
Version of Realm and Tooling
I just updated realm from v3.6.0 to v6.1.5, nothing else has been changed and noticed this slowness issue, then upgraded it to v10.0.1 though there wasn't anything related to it in the v10 change log and issue still persists in both debug and release mode. So finally reverted it back to 3.6.0. |
➤ Finn Andersen commented: Confirmed: performance regression for string based primary keys. |
Hi @kneth, Did you make any progress on this? We were forced to find an alternative solution because of this performance issue back in 2020 and I was wondering if it has been resolved so we can try it out again. |
@jaltin Only for string based primary keys (fix released in v10.5.0). |
Thanks for quick reply. I will try to test it out. Also, do you have any idea if it will be addressed further (and if so when) for other types of keys? |
I'm also having this same issue. I have inserted around 50K documents into my local realm db, and afterwards when trying to insert more, I run into significant performance degradation. My write speeds on first insertion are averaging around 20-30 documents per second, but once I reach 50K+ (realm db size is 11.6MB), my write speeds slow down to 2-3 writes per second. Reads and queries are also significantly slowed down. When I delete a large portion of the documents out of the RealmDB, my R/W speeds return back to normal. Have you discovered a potential cause for the slowdown when RealmDB begins to have large numbers of documents? My product is still in beta, and in production my db could have millions of documents. |
Hello, i am experience the same issue, am using latest version of realm. I am writing a set of ~5k data, it takes 7-8 seconds and also freeze the UI on react native |
Goals
I am trying to understand why the performance of inserts is so poor from a react native environment vs xamarin (using the Realm .Net library).
My use case is initial syncing a mobile application with a backend of items (things like street data, assets, jobs etc.) that can range from 10-500k records for use offline over the period of a week to later be synced back on completion.
The .Net library appears to be orders of magnitude faster and has a more linear timing curve for large inserts, realm-js inserts degrade over time given my tests.
Expected Results
I am expecting similar performance on inserting many records in the realm-js library as it is in the .Net library.
Actual Results
Steps to Reproduce
Attempt to insert a large number of records into a realm.
Code Sample
The following should be copy-pasteable into a brand new react-native app with typescript as the
App.ts
file. Alternatively theonPress
function and models at the end of the code snippet should be all that's necessary.The .Net code is almost like for like.
Version of Realm and Tooling
^4.0.0-beta.0
The text was updated successfully, but these errors were encountered: