Closed Bug 1163532 Opened 9 years ago Closed 3 years ago

Snippets - Set snippet fetch interval to 4 hours from 24 hours

Categories

(Firefox for Android Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: giorgos, Unassigned)

References

Details

Recently we configured Desktop Firefox to request new snippets every 4 hours, instead of every 24 hours. This will allow the snippet team to push content faster to our users. 

Is this something we can also do for Fennec? Are there any battery and/or data limitations?
There are two limitations:

* If you're fetching in Gecko on a timer, your code will essentially never run on many devices. If you check whether you need to fetch on Gecko startup, then you'll have the chance to fetch, but you'll interfere with first run performance, and that's a bad thing.

Scheduling of background services in Gecko is very hard -- compare it to the archetypical Windows XP user who quits the browser between each browsing session. If background fetches are very important, then ideally you would reimplement your fetcher in Java, and not ship the Gecko implementation on Android.


* If you're fetching outside of Gecko, or inside Gecko in a perfect world (e.g., on a super-high-end device) then you'll have some impact on battery and data.

You can mitigate some of the costs by making sure you turn *off* keepalive on fetches, return 304 Not Modified when applicable, etc.

You should also calculate what the expected data load is for a week or a month -- if you're forcing users to download megabytes of snippets (or empty JSON blobs!) a month, spread across 180 fetches, then we will want to figure something else out, and the burden for justifying *why* this change is valuable will be higher.

If we're talking kilobytes per month, then that's probably OK.
(In reply to Richard Newman [:rnewman] from comment #1)
> There are two limitations:
> 
> * If you're fetching in Gecko on a timer, your code will essentially never
> run on many devices. If you check whether you need to fetch on Gecko
> startup, then you'll have the chance to fetch, but you'll interfere with
> first run performance, and that's a bad thing.
> 
> Scheduling of background services in Gecko is very hard -- compare it to the
> archetypical Windows XP user who quits the browser between each browsing
> session. If background fetches are very important, then ideally you would
> reimplement your fetcher in Java, and not ship the Gecko implementation on
> Android.

We already have this implemented using a gecko update service timer, and it is set to 24 hours:

http://mxr.mozilla.org/mozilla-central/source/mobile/android/components/MobileComponents.manifest#111

Fixing this bug would only involve updating this value, so we only need to consider consider whether or not that value change would cause problem.
(In reply to Richard Newman [:rnewman] from comment #1)
> You should also calculate what the expected data load is for a week or a
> month -- if you're forcing users to download megabytes of snippets (or empty
> JSON blobs!) a month, spread across 180 fetches, then we will want to figure
> something else out, and the burden for justifying *why* this change is
> valuable will be higher.

We are running snippets mostly for en-*, de-*, fr, pl, es-* and ru locales. Usually it's a snippet per locale which contains a 96x96px PNG, a link and 140 characters limited text. So the payload is in the range of kilobytes. Other locales usually get empty json blobs.
Giorgios, is that replaced by a 304 or similar (e.g., empty JSON) in the case of repeated fetches?
Blocks: 1167653
(In reply to Richard Newman [:rnewman] from comment #4)
> Giorgios, is that replaced by a 304 or similar (e.g., empty JSON) in the
> case of repeated fetches?

Currently no, but if we go forward with this Fennec change we will make service changes to support it. Here is how it works on Desktop:

 - Client hits snippets url 
 - Gets redirected to a snippet bundle with unique url (calculated based on the bundle contents) which has 1 month long cache headers.

Similarly for Fennec snippets, we don't use 304 or empty JSON but on every hit we will redirect to a highly cachable url.
Blocks: 1281527
We have completed our launch of our new Firefox on Android. The development of the new versions use GitHub for issue tracking. If the bug report still reproduces in a current version of [Firefox on Android nightly](https://play.google.com/store/apps/details?id=org.mozilla.fenix) an issue can be reported at the [Fenix GitHub project](https://github.com/mozilla-mobile/fenix/). If you want to discuss your report please use [Mozilla's chat](https://wiki.mozilla.org/Matrix#Connect_to_Matrix) server https://chat.mozilla.org and join the [#fenix](https://chat.mozilla.org/#/room/#fenix:mozilla.org) channel.
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INCOMPLETE
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.