Skip to content
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

Slow Performance in Writing after updated to 10.24.2 #7734

Closed
samrithyoeun opened this issue Apr 5, 2022 · 15 comments
Closed

Slow Performance in Writing after updated to 10.24.2 #7734

samrithyoeun opened this issue Apr 5, 2022 · 15 comments
Labels
O-Community Reproduction-Required T-Bug Waiting-For-Reporter Waiting for more information from the reporter before we can proceed

Comments

@samrithyoeun
Copy link

How frequently does the bug occur?

Sometimes

Description

I am using RealmSwift 10.7.4 before,
After update to 10.24.2 I notice the difference speed (slow) in writing transaction

Stacktrace & log output

I am using RealmSwift 10.7.4 before,
After update to 10.24.2 I notice the difference speed (slow) in writing transaction

Can you reproduce the bug?

Yes, sometimes

Reproduction Steps

Start writing 200 transactions to Realm database

Version

10.24.2

What SDK flavour are you using?

Local Database only

Are you using encryption?

Yes, using encryption

Platform OS and version(s)

RealmSwift

Build environment

Xcode version: 13.3
Dependency manager and version: Cocoapods

@pavel-ship-it
Copy link
Contributor

Hi @samrithyoeun
Can you give us more information?
What is your Realm configuration?
What object schemes are involved?
Can you show me the code you're using to perform write transactions?
How do you measure the performance? What are numbers before update and after?

@sync-by-unito sync-by-unito bot added the Waiting-For-Reporter Waiting for more information from the reporter before we can proceed label Apr 5, 2022
@duncangroenewald
Copy link

FYI I just logged an issue as we updated from 10.9.0 to 10.24.2 and hit major performance issues with generating reports but this only seems to happen with the Synced realms and not when run with a local realm (same copy of the data).

@ericjordanmossman
Copy link
Contributor

@samrithyoeun
Are you able to provide what @pavel-ship-it asked for? Knowing the circumstance this happens under is important.
A sample reproduction .zip would be helpful also.

@ericjordanmossman ericjordanmossman added More-information-needed More information is needed to progress. The issue will close automatically in 2 weeks. and removed More-information-needed More information is needed to progress. The issue will close automatically in 2 weeks. labels Apr 28, 2022
@timothycosta
Copy link

I'm seeing something similar. Upgraded from 10.7 to 10.25.0 and started seeing jerky scrolling. This is with a horizontal paged scroll view and some writes occurring during paging. Downgraded to 10.16.0 (just picked a version in the middle) and the issue is gone. I'm using Carthage. Just a realm database, no sync.

@dianaafanador3
Copy link
Collaborator

Hi @timothycosta can you show us your code for the view, how many items are you loading on the view?

@timothycosta
Copy link

@dianaafanador3 Unfortunately not really without giving access to the entire project. It's not simple like a single tableview or something. Something like 25~100 items get written at a time though.

I would have liked to narrow it down to a specific version realm version also, but each Carthage build takes ~15 minutes and I don't have the time for it atm.

@dianaafanador3
Copy link
Collaborator

@timothycosta are you performing the writes on the main thread?, sometimes bulk writes may block the UI thread and provoke UI performance issues, we are gonna release shortly a feature which allows to write asynchronously to the realm without blocking the calling thread. Also, is worth mentioning that we are working on having better write performance to the realm in future releases.
On the meantime, I'll try to reproduce your issues for the current version 10.25.2

@timothycosta
Copy link

@dianaafanador3 Yes, they are on the main thread.

I've recorded this trace in Instruments for v. 10.25.0. Start from about 15s.
https://www.dropbox.com/s/xzi8npmlkgb329m/hitches.trace.zip?dl=0

I'll be away for the next week, so won't be able to provide more than this for now.

@timothycosta
Copy link

@dianaafanador3 I went through the releases here and found that 10.21.0 is the last version that I can use. From 10.22.0 on I get unacceptable hitches in our app. Hope that helps.

@dianaafanador3
Copy link
Collaborator

Hi @timothycosta thanks for the info, this surely will help to get to the source of this issue.

@AdamGerthel
Copy link

AdamGerthel commented May 23, 2022

We're seeing the same problem in realm/realm-js#4383, and we're thinking that our issues with Realm in React Native is tied to this issue. For us the problem started in realm-js-v10.12.0, and in this issue, the problem seems to have started with realm-swift-v10.21.1.

The common change in both releases that started this performance issue is this:

Upgraded realm-core from XXX to 11.8.0.

It seems to me that Realm Core 11.8.0 could be the culprit.

Update: Another thread where 10.21.1 looks like the culprit for react-swift: https://www.mongodb.com/community/forums/t/swiftui-slow-loading-views/147346/12?u=adam_gerthel

@AdamGerthel
Copy link

AdamGerthel commented May 23, 2022

Possibly related to #7743 since it seems as if they're suggesting that versions prior to realm-swift-v10.21.1 do not have the performance issue.

@duncangroenewald
Copy link

I can confirm that the issue raised in #7743 is not present in RealmSwift v10.21.0 and is present in v10.21.1.

@tgoyne
Copy link
Member

tgoyne commented May 27, 2022

v10.27.0 partially fixes this, and in the most extreme cases is ~10x faster than v10.26.0. It will still be slower than v10.21.0 as the root cause of the slowdown is a fix for potential data corruption if a device powers off at exact the wrong point in committing a write transaction, and we're trying to keep that fix. If 10.27.0's write performance is still a problem, using async commits may be a good solution.

@sync-by-unito sync-by-unito bot closed this as completed Aug 26, 2022
@sync-by-unito
Copy link

sync-by-unito bot commented Aug 26, 2022

➤ Lee Maguire commented:

As per last comment, from 10.27.0 onwards is 10x faster and async writes are now available.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
O-Community Reproduction-Required T-Bug Waiting-For-Reporter Waiting for more information from the reporter before we can proceed
Projects
None yet
Development

No branches or pull requests

8 participants