Category Archives: Guide

Background Sync

From the version 2.0.0, RssBook support ‘Background App Refresh’. This leads to support ‘Auto Sync Anytime’, such as get synced while you’re sleeping. This is a brief guide for this feature.

Auto sync can be run in two modes. 1) Run only when app is active or 2) always enabled. Auto sync options(interval, wifi, battery) are applied same to both modes.

We call ‘always enabled auto sync’ as ‘Background Sync’. It takes advantage of ‘Background App Refresh‘ introduced in iOS 7 (Specifically ‘Background fetch’). But it was not easy to make good use of. Because background mode allows only 30 seconds to run at a time. Generally, time needed to sync exceeds it.

So, we make sync as ‘resumable’. If user press home button while syncing, app goes to paused status. When user returns, app resumes previous sync. Before supporting this resumable feature, sync will end with timeout error on return.

With the help of resumable sync, we can complete one sync out of multiple background runs. The frequency how often background mode called may vary by situation. But we expect that there will be several calls for a hour at night time when device is not used and under charging.

In fact, we use only 20 seconds for each background run(for stablility). So, it can take up to one or more hours to complete one sync. It may need your tuning to find out how long it will take. For the convenience, we add ‘background sync start time’ at ‘Last Sync Status’ detail. It will help you to calculate actual background sync time.

Tip:
Even though our app is enabled for ‘Background App Refresh’ in settings, if you close our app explicitly in ‘App Switcher‘, backgound mode will not be fired because iOS intelligently block it. So it can be a convenient method to disable background sync temporarily – until next time you launch our app.

PS:
Because RssBook supports resumable sync, following situation is possible.

  • If app is moved to background(by pressing home button) while sync is in progress, that sync may complete in background mode or resume when app is re-activated.
  • There’ll be a increased chance that sync is already in progress when user activate app. This is because background sync has already began but not completed.

Background sync can not be strictly time scheduled. It depends mainly on iOS system allocation. iOS system will not allow run in busy or low resource condition. And auto sync option will be only effective for blocking sync in certain criteria. So, you better to think ‘Background Sync’ as a time-saving feature rather than a strict sync scheduler. Once background sync has enabled, it will dramatically reduce your active sync time because it may already make close to up-to-date states before your using.

Performance Info

Save articles as many as possible,
Use memory as small as possible,
Perform as fast as possible.

This is RssBook’s development mission. For this, a lot of effort has done and successfully accomplished.

To accommodate large articles, all data is stored in local sqlite database. For the high speed, well-defined index data is always loaded in runtime. When displaying folders or grouing/filtering, index data is used. When requested article contents, load dynamically from database or from runtime cache. This mechanism lead to fast but small memory system.

Memory footprint

Internal index data size is approximately 12 MB per 100,000 articles. Cache size is under 10MB and automatically cleared when not used or low memory condition. This amount of memory usage will be no problem for most iOS devices.

Instrument screen capture for memory allocation with iPad
•When article counts 106,879

•When article counts 204,282

In actual use, there are other factors that use large memory. Web pages, images, UI objects and so on. iOS system is reliable to handle low memory condition. But in rare case, memory is not recovered as expected. You can monitor current memory usage in last sync status menu.

Drawback

One of drawbacks in index mechanism is index loading time. When RssBook lauches, index data is loaded into runtime memory. More articles, Longer loading time.
If article exceed a certain count(for example, 200,000 for iPad2), loading index will be considerably delayed. But once loading finishes, runtime speed will be fast enough.

The things that help performance

Lastest devices, of course, will be favored, especially for dual core CPU.

Free disk space is also important. RssBook use database, so disk speed is significant factor for syncing and startup index loading. In our test, performance was best when at least 15% free space is available.