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

Datastore sync reading all over from start on each amplify sync #3841

Open
amruth-movano opened this issue Aug 29, 2024 · 3 comments
Open

Datastore sync reading all over from start on each amplify sync #3841

amruth-movano opened this issue Aug 29, 2024 · 3 comments
Labels
question General question

Comments

@amruth-movano
Copy link

Describe the bug

Doing appsync in every minute to ensure each min data sync to the datastore and cloud. But it is increasing the read operation count to dynamodb.

Currently, our app has a 2-week caching mechanism, so on login it will fetch 2 weeks of data. But the read count in dynamodb is huge which is not as per the no of rows present in that table. Its almost 10 times per day

Steps To Reproduce

Try Amplify.DataStore.start() after each 1 min and check hits in db

Expected behavior

Amplify should not reread data that is already present in DB, it should only read the delta wrt the current date

Amplify Framework Version

2.35.4

Amplify Categories

DataStore

Dependency manager

Swift PM

Swift version

5.9.2

CLI version

12.11.1

Xcode version

15.0

Relevant log output

-

Is this a regression?

Yes

Regression additional context

No response

Platforms

iOS

OS Version

iOS 17.5.1

Device

iPhone 15 Plus

Specific to simulators

No response

Additional context

No response

@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending response from an Amplify team member labels Aug 29, 2024
@tylerjroach
Copy link
Member

You can adjust the syncInterval in DataStore configuration as shown here: https://docs.amplify.aws/gen1/swift/build-a-backend/more-features/datastore/conflict-resolution/#custom-configuration-fields

You will also need to check how long your Delta table ttl is set on the service side as well. See Delta sync table time to live (TTL in minutes) in your table Data sources in the AppSync console . Both values may need to be raised to your desired amount.

@tylerjroach tylerjroach added the question General question label Aug 29, 2024
@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Aug 29, 2024
@tylerjroach tylerjroach removed the pending-triage Issue is pending triage label Aug 29, 2024
@amruth-movano
Copy link
Author

@tylerjroach
Will it only affect datastore reading or for both writing & reading?
We need to push as soon as we save to the datastore.

@github-actions github-actions bot added the pending-maintainer-response Issue is pending response from an Amplify team member label Sep 2, 2024
@tylerjroach
Copy link
Member

syncInterval - the maximum interval (in seconds) for which the system will continue to perform delta queries. After this interval expires, the system performs a base query to retrieve all data.

This will not slow syncing on model saves. This value is specifically used for when to attempt a delta query vs a full base query.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question General question
Projects
None yet
Development

No branches or pull requests

2 participants