aws-amplify / amplify-android

The fastest and easiest way to use AWS from your Android app.
https://docs.amplify.aws/lib/q/platform/android/
Apache License 2.0
249 stars 117 forks source link

DataStore Model Sync Parallelization #2808

Closed tylerjroach closed 5 months ago

tylerjroach commented 6 months ago

This PR attempts to speed up sync times when no associations are present on any models. This is to bring Android into parity with Swift.

Future optimizations could be:

  1. To create model association groups to allow for parallelization when connected models are present.
  2. Enable a high concurrency count by default. Right now, the proposal on Android is to default to 1.
    • I have some concerns about high memory usage on Android if the customer has a large number of models, with a large number of records per model. An Android app is only allowed an allotted size of memory. In the current Android implementation, network requests are accumulated while local merger reconciliation is processing. By increasing the parallelization limit, if the local merger reconciliation limit is the bottleneck, a large number of records could be allowed to accumulate in memory before the merger can discard network responses. Many customers have a large number of models, but small number of records per model. For these customers, the time savings by enabling concurrency will be significant. Swift apps are allowed to use a higher amount of memory so there is less of a concern on that platform.

Issue #, if available:

Description of changes: Comparable Swift Optimization: https://github.com/aws-amplify/amplify-swift/pull/1267

How did you test these changes? (Please add a line here how the changes were tested)

Documentation update required?

General Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

codecov-commenter commented 6 months ago

Codecov Report

Attention: Patch coverage is 72.41379% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 44.03%. Comparing base (0f61cc8) to head (15da6ac). Report is 29 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2808 +/- ## ========================================== + Coverage 43.00% 44.03% +1.02% ========================================== Files 905 925 +20 Lines 29179 30245 +1066 Branches 4153 4298 +145 ========================================== + Hits 12549 13318 +769 - Misses 15271 15500 +229 - Partials 1359 1427 +68 ```