Most of my clients are using Android 8 devices with 4 GB of RAM. My schema includes 8 models: 5 of these models each contain approximately 100 records, while the remaining three have 30k+ records each, potentially reaching up to 80k records. I’m using SQLite as the storage adapter for DataStore. During a FullSync, there’s a delay between modelSynced and syncQueriesReady of around 8 to 10 minutes, depending on the data retrieved for each model. I'm not noticing any delay in the actual data synchronization process. However, there is a noticeable time gap between the last data synchronization and the "modelSynced" & "syncQueriesReady" event, which seems to be substantial.
Upon observing the process using Amplify.Logger.LOG_LEVEL = "DEBUG", it appears that records are being written to the SQLite database one at a time. This approach is overloading the CPU, causing the system to become unresponsive and, in some cases, to reboot.
The "ModelSynced" events should be triggered immediately upon completion of the synchronization process. Additionally, the synchronized records should be inserted into SQLite without any delay. Also, System CPU spike shouldn't happen when this process is happening.
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
GraphQL API, DataStore, Storage
Amplify Version
v5
Amplify Categories
No response
Backend
Amplify CLI
Environment information
Describe the bug
Most of my clients are using Android 8 devices with 4 GB of RAM. My schema includes 8 models: 5 of these models each contain approximately 100 records, while the remaining three have 30k+ records each, potentially reaching up to 80k records. I’m using SQLite as the storage adapter for DataStore. During a FullSync, there’s a delay between modelSynced and syncQueriesReady of around 8 to 10 minutes, depending on the data retrieved for each model. I'm not noticing any delay in the actual data synchronization process. However, there is a noticeable time gap between the last data synchronization and the "modelSynced" & "syncQueriesReady" event, which seems to be substantial.
Upon observing the process using Amplify.Logger.LOG_LEVEL = "DEBUG", it appears that records are being written to the SQLite database one at a time. This approach is overloading the CPU, causing the system to become unresponsive and, in some cases, to reboot.
"aws-amplify": "5.3.6", "aws-amplify-react-native": "7.0.2",
Expected behavior
The "ModelSynced" events should be triggered immediately upon completion of the synchronization process. Additionally, the synchronized records should be inserted into SQLite without any delay. Also, System CPU spike shouldn't happen when this process is happening.
Reproduction steps
1) Happens only on Datastore FullSync
Code Snippet
Log output
aws-exports.js
aws_appsync_authenticationType: 'API_LAMBA'
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response