awslabs / awslabs/aws-mobile-appsync-sdk-android
[Performance] Apollo NormalizedCache performs merges for every item in its own separate transaction
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 106
- Forks
- 56
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
During an AppSync mutation where server changes are needed to merge with local cache, each item in the record set are merging with its very own separate transaction, which are very slow and causes performace issue.
The bug was already found and resolved in the main Android Apollo repo. The issue can be found here, and the related fix pull request can be found here.
To Reproduce
Steps to reproduce the behavior:
- Perform mutation on a large record using AppSync Android SDK
- Wait for mutation callback and experience the passage of time
Expected behavior
The mutation callback should not take that long, as SQL data merging should complete with the same transaction.
Screenshots
In my use case, a mutation with a user record around 500 key-value pair takes about 11 seconds to write into database, the Android profiling result are as follows:

Environment(please complete the following information):
- AppSync SDK Version: 2.7.9
Device Information (please complete the following information):
- Device: Pixel 2 XL, HTC U12, Simulator
- Android Version: Oreo 8.1.0, Pie 9.0.0, Q (Preview)
Additional context
Please see the discussion in the Android Apollo repo here and here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the issue's reproduction details and the referenced Apollo Android issue #726 and pull request #737, then locate the AppSync SDK's normalized-cache merge path. Confirm where each record is committed separately and compare the related upstream fix. Done means a large mutation completes its SQL cache merges in one transaction and the behavior is covered by an appropriate test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, graphql, java
- Domain
- database, mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100