Android Expo App Extremely Slow with ElectricSQL v1.0.6 (works fine on iOS & Electron)
Client Platform: Expo (fully built apps, not Expo Go)
Android: Production build (slow)
iOS: Production build (works fine)
ElectronJS: Desktop app (works fine)
ElectricSQL: v1.0.6
Bug Description
We’re experiencing very slow synchronization on Android when using ElectricSQL v1.0.6 inside a fully built Expo app. The exact same backend and schema work as expected on:
iOS Expo app
ElectronJS desktop app
But on Android, ElectricSQL syncs extremely slowly, making the app almost unusable.
Expected Behavior
Synchronization performance should be consistent across all supported platforms (Android should be on par with iOS and desktop).
Additional Context / Notes
We’re using fully built Expo apps (not Expo Go) for testing.
Our backend runs on HTTP/2.
On Android specifically, the app might be falling back to HTTP/1.1 instead of HTTP/2, but we cannot confirm this yet.
I have tried upgrading the electric version to v1.1.7 which shows a significant improvement to speed but that's across the board and I don't believe it fully solved the difference between android expo vs ios expo or ElectronJS.
The User-Agent header shows okhttp/4.12.0 on Android.
Everything else (backend, schema, auth) is identical between platforms.
Ok so I debugged this quite a bit and it appears this is a problem with expo itself, their network calls on android specifically when you don't use anything besides their expo/fetch seems to be very slow, we tried network calls with axios and the useShape api for electric but those were unusably slow on android expo.
Thanks for the report. Does using expo/fetch fix the performance? And do you know why it's slow? I see you're running http/2 on the backend but I'm just wondering if it's related to parallel requests.
Using expo/fetch does fix the performance, I have no idea why it might be slow specifically on android. Might be worth checking out how their fetch implementation works, it says it's "[WinterCG-compliant Fetch API]" but not sure if that has anything to do with it. https://docs.expo.dev/versions/latest/sdk/expo/
I actually tested something, a completely fresh expo repo and I made 3 separate fetch calls with one using axios, normal fetch, expo/fetch and all 3 showed similar results. But there's some reason that currently using multiple useShape is causing all other network requests to slow down perhaps? while expo/fetch seems indifferent to the multiple useShapes being used.
HTTP2 support? Small connection pool waiting on the long polls?
I cannot inspect what protocol expo is using to make network requests, they don't have support for that but when I check the logs on my electric instance, it does say that it is using http2 protocol. So that must mean it is using http2.