geofire-java
geofire-java copied to clipboard
long delay getting onGeoQueryReady callback
Am regularly seeing relatively long delay (e.g. 5-10s....but in some cases significantly longer) before onGeoQueryReady callback is invoked. This is I believe causing issue when moving quickly around map for example i.e. where another query is made before previous one completes.....what is the recommended approach in general for handling new query while one is still in progress?
The other issue I'm seeing is that other firebase queries are blocked until onGeoQueryReady() is called (e.g. if I try to make query in response to clicking on map marker)
It looks like the delay might be due to large amount of GC activity:
08-27 18:54:19.214 3979 3979 D PRETTYLOGGER: ╔════════════════════════════════════════════════════════════════════════════════════════
08-27 18:54:19.215 3979 3979 D PRETTYLOGGER: ║ Thread: main
08-27 18:54:19.215 3979 3979 D PRETTYLOGGER: ╟────────────────────────────────────────────────────────────────────────────────────────
08-27 18:54:19.215 3979 3979 D PRETTYLOGGER: ║ GeoQuery$4.run (GeoQuery.java:144)
08-27 18:54:19.215 3979 3979 D PRETTYLOGGER: ║ LocationActivity.onKeyExited (LocationActivity.java:397)
08-27 18:54:19.215 3979 3979 D PRETTYLOGGER: ╟────────────────────────────────────────────────────────────────────────────────────────
08-27 18:54:19.215 3979 3979 D PRETTYLOGGER: ║ Key ChIJIzUPEdBv5kcRbIE2RvFTOTo is no longer in the search area
08-27 18:54:19.215 3979 3979 D PRETTYLOGGER: ╚════════════════════════════════════════════════════════════════════════════════════════
08-27 18:54:23.355 3979 3991 I art : Background partial concurrent mark sweep GC freed 467577(16MB) AllocSpace objects, 15(7MB) LOS objects, 26% free, 43MB/59MB, paused 2.138ms total 138.304ms
08-27 18:54:24.096 3979 3991 I art : Background sticky concurrent mark sweep GC freed 439482(16MB) AllocSpace objects, 1(208KB) LOS objects, 24% free, 45MB/59MB, paused 2.195ms total 124.700ms
08-27 18:54:24.822 3979 3991 I art : Background partial concurrent mark sweep GC freed 453144(16MB) AllocSpace objects, 3(548KB) LOS objects, 26% free, 44MB/60MB, paused 2.652ms total 146ms
08-27 18:54:25.598 3979 3991 I art : Background sticky concurrent mark sweep GC freed 433460(16MB) AllocSpace objects, 0(0B) LOS objects, 22% free, 46MB/60MB, paused 2.320ms total 133.296ms
08-27 18:54:26.295 3979 3991 I art : Background partial concurrent mark sweep GC freed 461305(16MB) AllocSpace objects, 1(468KB) LOS objects, 25% free, 47MB/63MB, paused 2.565ms total 142.552ms
08-27 18:54:27.070 3979 3991 I art : Background sticky concurrent mark sweep GC freed 445731(16MB) AllocSpace objects, 0(0B) LOS objects, 22% free, 48MB/63MB, paused 2.278ms total 128.798ms
08-27 18:54:27.798 3979 3991 I art : Background partial concurrent mark sweep GC freed 539106(16MB) AllocSpace objects, 17(4MB) LOS objects, 26% free, 44MB/60MB, paused 1.574ms total 138.389ms
08-27 18:54:28.255 3979 3991 I art : Background sticky concurrent mark sweep GC freed 482094(17MB) AllocSpace objects, 80(1504KB) LOS objects, 24% free, 45MB/60MB, paused 1.504ms total 101.790ms
08-27 18:54:28.715 3979 3991 I art : Background partial concurrent mark sweep GC freed 484361(18MB) AllocSpace objects, 90(1680KB) LOS objects, 26% free, 45MB/61MB, paused 1.420ms total 124.530ms
08-27 18:54:28.857 915 924 I art : Background partial concurrent mark sweep GC freed 29987(1932KB) AllocSpace objects, 0(0B) LOS objects, 24% free, 49MB/65MB, paused 1.603ms total 161.349ms
08-27 18:54:29.635 3979 3991 I art : Background partial concurrent mark sweep GC freed 500111(19MB) AllocSpace objects, 101(1884KB) LOS objects, 26% free, 45MB/61MB, paused 1.525ms total 133.642ms
08-27 18:54:31.134 3979 3991 I art : Background partial concurrent mark sweep GC freed 422658(14MB) AllocSpace objects, 2(36KB) LOS objects, 24% free, 50MB/66MB, paused 1.413ms total 135.253ms
08-27 18:54:31.862 3979 3991 I art : Background sticky concurrent mark sweep GC freed 452789(15MB) AllocSpace objects, 0(0B) LOS objects, 19% free, 53MB/66MB, paused 1.509ms total 125.751ms
08-27 18:54:32.806 3979 3991 I art : Background partial concurrent mark sweep GC freed 531391(17MB) AllocSpace objects, 2(48KB) LOS objects, 24% free, 50MB/66MB, paused 2.370ms total 155.513ms
08-27 18:54:36.656 3979 3991 I art : Background sticky concurrent mark sweep GC freed 595273(16MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 50MB/66MB, paused 1.382ms total 117.751ms
08-27 18:54:40.391 3979 3991 I art : Background partial concurrent mark sweep GC freed 806127(23MB) AllocSpace objects, 0(0B) LOS objects, 26% free, 43MB/59MB, paused 1.331ms total 152.355ms
08-27 18:54:43.926 3979 3991 I art : Background sticky concurrent mark sweep GC freed 563650(16MB) AllocSpace objects, 0(0B) LOS objects, 26% free, 43MB/59MB, paused 1.245ms total 118.144ms
08-27 18:54:47.389 3979 3991 I art : Background partial concurrent mark sweep GC freed 608763(16MB) AllocSpace objects, 0(0B) LOS objects, 26% free, 43MB/59MB, paused 1.266ms total 124.058ms
08-27 18:54:53.434 3979 3991 I art : Background partial concurrent mark sweep GC freed 569641(16MB) AllocSpace objects, 0(0B) LOS objects, 26% free, 43MB/59MB, paused 1.274ms total 126.691ms
08-27 18:54:54.031 3979 3979 D PRETTYLOGGER: ╔════════════════════════════════════════════════════════════════════════════════════════
08-27 18:54:54.031 3979 3979 D PRETTYLOGGER: ║ Thread: main
08-27 18:54:54.031 3979 3979 D PRETTYLOGGER: ╟────────────────────────────────────────────────────────────────────────────────────────
08-27 18:54:54.031 3979 3979 D PRETTYLOGGER: ║ GeoQuery$5.run (GeoQuery.java:189)
08-27 18:54:54.031 3979 3979 D PRETTYLOGGER: ║ LocationActivity.onGeoQueryReady (LocationActivity.java:413)
08-27 18:54:54.031 3979 3979 D PRETTYLOGGER: ╟────────────────────────────────────────────────────────────────────────────────────────
08-27 18:54:54.032 3979 3979 D PRETTYLOGGER: ║ All initial data has been loaded and events have been fired!
08-27 18:54:54.032 3979 3979 D PRETTYLOGGER: ╚════════════════════════════════════════════════════════════════════════════════════════
Can you give us an idea of the amount of total data stored in your GeoFire index as well as how much data your GeoQuery matches?
Also, what versions of Firebase, GeoFire, and Android / Java are you using?
Will get data on number of matches but was seeing these delays I believe when even small amount of data was being returned.
Versions: Firebase: 9.4.0 GeoFire: 2.0.0 Android: 6.0.1
@jwngr also, what is the recommended approach in general for handling new query while one is still in progress?
If there are no indexes defined on the server, the filtering will happen client-side which can be very inefficient. Can you double check you have the right index defined (and there is no warning displayed in the logs).
Yes, index is defined (had got "Using an unspecified index. Consider adding '".indexOn": "g"' at ...." before this was added).
Is there working sample that I can try here and see if I can reproduce issue with that?
@jwngr We're blocked right now from using this library due to these performance issues......what would really help, as mentioned, was if there was working sample we could try to at least help isolate where the performance issues are occurring?
We also git bitten by this and what helped was not using the persistence enabled flag on the FirebaseReference. Ideally we should go and take some time to investigate this further.