Closed Bug 819628 Opened 12 years ago Closed 7 years ago

Use incremental commits to stores when synchronizing calendars.

Categories

(Firefox OS Graveyard :: Gaia::Calendar, defect, P4)

defect

Tracking

(tracking-b2g:backlog, b2g1828+)

RESOLVED WONTFIX
tracking-b2g backlog
Tracking Status
b2g18 28+ ---

People

(Reporter: jlal, Unassigned, Mentored)

References

Details

(Keywords: perf, Whiteboard: [c=progress p= s= u=] [LOE:S])

Attachments

(1 file, 15 obsolete files)

46 bytes, patch
jlal
: review+
Details | Diff | Splinter Review
Brief background on our current sync structure: 1- We authorize account and save credentials (one transaction) 2- We sync calendars adding/removing as needed (all one transaction for all changes) 3- Per calendar we request events and sync them with the ones currently present via etag comparison all changes per calendar are in a single transaction. --- This bug is to break up the event sync (3) into multiple commits based on the volume of changes. about:memory indicates most memory usage is in the worker (15mb~ on my test vs 5mb~) so we we likely see some benefit from doing this (as we can free records from memory much sooner) but it will be less then further optimizing the worker. The benefits here are we will be more likely to sync larger calendars (as each transaction is broken up into smaller chunks) and in the case of memory related crashes further sync attempts will consume less (assuming we have persisted at least one chunk per transaction). For greatest effect this bug needs to be completed with 819519. Implementation guidelines: - Each transaction must consist of the complete details of a given event (alarms, icalComponent, busytimes, frozen recurring iterator). - We must not update the ctag on the calendar (when the ctag is updated we will not attempt to sync we use it to indicate we are in the same state as the server) unless all transactions complete successfully. In the case of a single transaction failure we continue (non-fatal) but we could attempt to sync again (or simply notify the user/wait for next sync). - Need to determine best number to commit in single transaction, each operation is fairly expensive but the memory overhead is likely more expensive for huge calendars so we need to find the right balance.
BB+, P3 for performance
blocking-basecamp: ? → +
Priority: -- → P3
Blocking- for not enough information about impact on user. We can't block on every performance issue. Please renominate if there's specific problem that makes the app performance unusable.
blocking-basecamp: + → -
(In reply to Dietrich Ayala (:dietrich) from comment #2) > Blocking- for not enough information about impact on user. We can't block on > every performance issue. Please renominate if there's specific problem that > makes the app performance unusable. True, although we should get more information here. James - Can you be more specific on end-user impacts in terms of performance? Basically, exact user flows that would be affected and how much.
Flags: needinfo?(jlal)
As I said earlier its going to vary but on slower connections this is likely to greatly improve performance from the users perspective as they will see events prior to the entire request completing. I have a patch up for review in the CalDAV lib now and this should land in gaia this week.
Flags: needinfo?(jlal)
This could also make a big difference with crashes. Even if we crash during the first sync we can potentially complete it by syncing multiple times. I think we should b+ this bug given the number of OOM crashes we have seen recently.
blocking-basecamp: - → ?
(In reply to James Lal [:lightsofapollo] from comment #5) > This could also make a big difference with crashes. Even if we crash during > the first sync we can potentially complete it by syncing multiple times. > > I think we should b+ this bug given the number of OOM crashes we have seen > recently. bug 826872 for example.
Blocks: 826872
blocking-basecamp: ? → +
Target Milestone: --- → B2G C4 (2jan on)
Assignee: nobody → jlal
After running DMD and speaking with jlebar this probably will do little to resolve the OOM issues as they are related to XHR (response bodies) and not to the database. This is still a nice to have but I am not sure we need it given it is very unlikely to improve the OOM situation greatly until we resolve the problems with XHR.
blocking-basecamp: + → ?
Let's just unnom in that case. No need to send through triage again.
blocking-basecamp: ? → ---
This definitely is required for huge calendars, we have resolved (in calendar & in gecko) the largest memory consumption issues but we still have run out of memory on massive calendars (on the main thread) because we are buffering all the data until the first sync (per calendar) is complete. I really don't think this blocks, out of all the accounts I have found only one can actually crash the calendar on the latest build with the initial version of the workers patch.
Summary: Implement/Experiment with incremental commits to stores when synchronizing calendars. → Use incremental commits to stores when synchronizing calendars.
Assignee: jlal → nobody
Whiteboard: [mentor=jlal@mozilla.com][LOE:S] → [mentor=jlal@mozilla.com][LOE:S][FFOS_perf]
James, could you investigate on this ?
Flags: needinfo?(jlal)
Blocks: 846560
Sorry for not responding... Not sure what we need to investigate now as per comment #9 we need this for syncing accounts with many events on many calendars. The threshold will vary but this should help us free up memory to handle all sizes of calendars. In addition we could limit the number of calendars we sync concurrently. noming for visibility but we should target some release to fix this
blocking-b2g: --- → leo?
Flags: needinfo?(jlal)
blocking-b2g: leo? → koi?
Whiteboard: [mentor=jlal@mozilla.com][LOE:S][FFOS_perf] → [mentor=jlal@mozilla.com][LOE:S][FFOS_perf] c=
Priority: P3 → --
Whiteboard: [mentor=jlal@mozilla.com][LOE:S][FFOS_perf] c= → [mentor=jlal@mozilla.com][LOE:S] [c= ]
Target Milestone: B2G C4 (2jan on) → ---
Assignee: nobody → gghosh
Attachment #769920 - Attachment is obsolete: true
Attachment #769920 - Flags: review?(gaye)
Attachment #775245 - Flags: review?(jlal)
Comment on attachment 775245 [details] [diff] [review] Bug 819628 - real patch, actually commits incrementally Please attach a pull request- I cannot review this as a single commit.
Attachment #775245 - Flags: review?(jlal) → review-
Attachment #775245 - Attachment is obsolete: true
Attachment #775726 - Flags: review?(jlal)
Comment on attachment 775726 [details] [diff] [review] Bug 819628 - Use incremental commits to stores when synchronizing calendars. decent first round- see my review comments on github and reset the review flag to ? when we are ready for another round.
Attachment #775726 - Flags: review?(jlal) → review-
Attachment #775726 - Attachment is obsolete: true
Attachment #776703 - Flags: feedback?(jlal)
Status: NEW → ASSIGNED
Comment on attachment 776703 [details] [diff] [review] Incrementally commits without flags closer- but see my GH comments
Attachment #776703 - Flags: feedback?(jlal) → feedback-
Attachment #776703 - Attachment is obsolete: true
Attachment #777407 - Flags: feedback?(jlal)
Attachment #777407 - Attachment is obsolete: true
Attachment #777407 - Flags: feedback?(jlal)
Attachment #777453 - Flags: feedback?(jlal)
Comment on attachment 777453 [details] [diff] [review] Incrementally commits without resetting objects and some style changes Looks pretty good but see my comments on GH and remember about the complete/error/abort? events for the final review.
Attachment #777453 - Flags: feedback?(jlal)
Attachment #777453 - Attachment is obsolete: true
Attachment #778022 - Flags: feedback?(jlal)
Comment on attachment 778022 [details] [diff] [review] Incrementally commits and passes all tests right direction still but more to go
Attachment #778022 - Flags: feedback?(jlal) → feedback+
Attached patch General Improvements to Tests (obsolete) — Splinter Review
Attachment #778022 - Attachment is obsolete: true
Attached patch General Improvements to Tests (obsolete) — Splinter Review
Attachment #779486 - Attachment is obsolete: true
Attachment #779489 - Flags: feedback?(jlal)
Comment on attachment 779489 [details] [diff] [review] General Improvements to Tests Looks almost the same as before? Did you forget to push a commit?
Attachment #779489 - Flags: feedback?(jlal)
Attachment #779489 - Attachment is obsolete: true
Attachment #780058 - Flags: review?(jlal)
Attachment #780058 - Attachment is obsolete: true
Attachment #780058 - Flags: review?(jlal)
Attachment #781081 - Flags: feedback?(jlal)
Comment on attachment 781081 [details] [diff] [review] Restructures commit tests completely, removes callback from commitGroup and emit end in manager see github
Attachment #781081 - Flags: feedback?(jlal)
Attached patch adds event api (obsolete) — Splinter Review
Attachment #781081 - Attachment is obsolete: true
Attachment #782950 - Flags: feedback?(jlal)
Comment on attachment 782950 [details] [diff] [review] adds event api Looks better! Please address / argue all of my comments before flagging for a final review... I have not looked closely at the tests yet so I may have some more comments there.
Attachment #782950 - Flags: feedback?(jlal) → feedback+
Attachment #782950 - Attachment is obsolete: true
Attachment #784050 - Flags: review?(jlal)
Blocks: 900656
Blocks: 900659
blocking-b2g: koi? → koi+
Attachment #784050 - Attachment is obsolete: true
Attachment #784050 - Flags: review?(jlal)
Attachment #784639 - Flags: review?(jlal)
Comment on attachment 784639 [details] [diff] [review] Incrementally commits and passes all tests We are very close here... I found a bug but mostly this is all style issues I have not tried this yet on my device with a large set of data.. I will do that later today and may have some more comments then.
Attachment #784639 - Flags: review?(jlal) → review-
Attachment #784639 - Attachment is obsolete: true
Attachment #787155 - Flags: review?(jlal)
Comment on attachment 787155 [details] [diff] [review] Incrementally commits and passes all tests [recap from in person conversation] This is soooo close. In the case of syncing a calendar for the first time this works really well. There is some bustage when trying to expand a recurring event that never ends though. What It looks like there are two events we expect to be fired from the caldav service: eventComplete and event. In the case where we want to expand a recurring event we don't fire these right now. To reproduce this problem you can create a recurring event with no end ( Every Saturday of the month, etc...) then go forward 6-8 months in time and you should see erorrs in logcat and really weird behavior in calendar like duplications of the events.
Attachment #787155 - Flags: review?(jlal) → review-
Attachment #787155 - Attachment is obsolete: true
Attachment #789233 - Flags: review?(jlal)
Priority: -- → P1
Whiteboard: [mentor=jlal@mozilla.com][LOE:S] [c= ] → [mentor=jlal@mozilla.com][LOE:S] [c= p= s= u=1.2]
Attachment #789233 - Flags: review?(jlal) → review+
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
backed out of master/1.2 for delete breakage.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
oops... reverted here: b9b99e5cd922d7cdaa5574b553d83cfac99c3bff
Assignee: gghosh → nobody
This fix was reverted and no longer meets blocking criteria. Will try again in a future release.
blocking-b2g: koi+ → 1.3?
Whiteboard: [mentor=jlal@mozilla.com][LOE:S] [c= p= s= u=1.2] → [mentor=jlal@mozilla.com][LOE:S] [c= p= s= u=][perf-reviewed]
(In reply to Dylan Oliver [:doliver] from comment #41) > This fix was reverted and no longer meets blocking criteria. Will try again > in a future release. Dylan, is this still targeted for 1.3? If not please minus this.
Flags: needinfo?(doliver)
Priority: P1 → --
Whiteboard: [mentor=jlal@mozilla.com][LOE:S] [c= p= s= u=][perf-reviewed] → [mentor=jlal@mozilla.com][LOE:S] [c= p= s= u=]
Cleared blocking flag - this is not required for 1.3.
blocking-b2g: 1.3? → ---
Flags: needinfo?(doliver)
blocking-b2g: --- → backlog
Whiteboard: [mentor=jlal@mozilla.com][LOE:S] [c= p= s= u=] → [mentor=jlal@mozilla.com][LOE:S] [c= p= s= u=][tarako]
HI James, wonder how much memory saving we can get from this? trying to decide if this is needed for Tarako. therefore 1.3? to keep in tarako radar for now if this is not needed for tarako, will switch blocking flag back to backlog. thanks
blocking-b2g: backlog → 1.3T?
Flags: needinfo?(jlal)
Whiteboard: [mentor=jlal@mozilla.com][LOE:S] [c= p= s= u=][tarako] → [mentor=jlal@mozilla.com][LOE:S] [c= p= s= u=]
Hi Dylan, is it something you can help answering? thanks
Flags: needinfo?(doliver)
I'll have to let James comment on the potential memory savings but generally I think this is a risky fix for 1.3 and therefore it's unlikely. We have tried to fix this before and had to revert it. We would need to spend more time to get this one right.
Flags: needinfo?(doliver)
The memory saved here is going to be dependent on the size of the calendar synchronized on smallish calendars the savings will be minimal (maybe none) on larger calendars (>100~) the savings will be fairly large as we will save state to idb and free memory periodically.
Flags: needinfo?(jlal)
Joe, is the testing that's being done for calendar not acceptable enough for 1.3T? Have we done any related testing that can give some numbers here ?
Flags: needinfo?(jcheng)
Flags: needinfo?(brhuang)
Bhavana, We did not have the test data from QA side. I will check with Joe if need to run to get the data. Joe, if you need the data, I will ask William to provide the data in the bug.
Flags: needinfo?(brhuang)
Hi, Joe, Could I reconfirm the requirement? Do you mean you need the calendar loading time? If so, I can use Buri/Taroko to do the test (Baseline). But, I also need the patch land on master to compare the difference. Thanks.
Flags: needinfo?(jcheng)
let's clarify what's needed here it seems like with large calendars (>100), memory saving can be quite a lot and therefore, calendar app should perform better? in term of app launching / scrolling...etc (ni? James to provide further insights) so the question for QA, how's calendar performing in terms of app launching / scrolling (unless James comes up with other comments)? do we feel current tarako calendar performance is not acceptable that we need to further improve? if so, we can probably consider this bug Thanks
Flags: needinfo?(jcheng)
Flags: needinfo?(whsu)
Flags: needinfo?(jlal)
>it seems like with large calendars (>100), memory saving can be quite a lot and therefore, calendar app should perform better? The larger the calendar the bigger the savings here... this will not directly effect scrolling or launching only the time to sync the given calendars.
Flags: needinfo?(jlal)
Try to get large calendar (Clint's, Ashley, Kim, etc) and sync to tarako. Benchmark the memory, and time required.
Flags: needinfo?(jhammink)
Keywords: qawanted
QA Contact: jsmith
(In reply to Joe Cheng [:jcheng] from comment #51) > let's clarify what's needed here > > it seems like with large calendars (>100), memory saving can be quite a lot > and therefore, calendar app should perform better? in term of app launching > / scrolling...etc (ni? James to provide further insights) > > so the question for QA, how's calendar performing in terms of app launching > / scrolling (unless James comes up with other comments)? do we feel current > tarako calendar performance is not acceptable that we need to further > improve? if so, we can probably consider this bug > > Thanks Hi, Joe, Thanks for the information. We need to prepare the test data first, then performing the related tests.
Flags: needinfo?(whsu)
Flags: needinfo?(whsu)
Not blocking at this time until we have more definitive info from whsu's investigation. Also as stated in comment #46, this is a larger effort and we are not likely to be able to deliver this in the 1.3T time frame.
blocking-b2g: 1.3T? → backlog
Clearning NI - I'll follow this if it blocks in the future.
Flags: needinfo?(jhammink)
Sorry! Other stuffs occupied my resource so I cannot reply you immediately. Here are the detailed information * Test parameters 1. I only used 30~35 events to do the tests. 2. Every event repeats 10 times on my Google calendar. So, my Google calendar had 300+ records. 3. Every record contains 1000 characters at least. 4. Syncing calendars via Wi-Fi(Mozilla Guest) * Test cases: i. Cold launch time Step 1: Tap the calendar icon Step 2: Waiting until the calendar main page is displayed ii. Sync 30+ events Step 1: Tap the "Accept" button of Google authorize page Step 2: Waiting until first notification is popped up iii. Cold launch time (30+ events on calendar) Step 1: Tap the calendar icon Step 2: Waiting until the calendar main page is displayed All events show on calendar ix. Remove local data (30+ events) Step 1: Tap "Done" button of settings page Step 2: Waiting until the Google account is removed from calendar Results are as below. FYI. - -- - -- - --- -- - -- - --- -- - -- - -- * Tarako device (V1.3T) i. Cold launch time 1. 1.13 sec 2. 1.20 sec 3. 1.15 sec Average: 1.16 sec ii. Sync 30+ events 1. 23.79 sec 2. 21.21 sec 3. 25.40 sec Average: 23.46 sec iii. Cold launch time (30+ events on calendar) 1. 2.52 sec 2. 2.79 sec 3. 2.62 sec Average: 2.64 sec ix. Remove local data (30+ events) 1. 7.24 sec 2. 7.37 sec 3. 9.07 sec Average: 7.89 sec - -- - -- - --- -- - -- - --- -- - -- - -- * Buri device (V1.4) i. Cold launch time 1. 0.99 2. 0.95 3. 1.13 Average: 1.02 sec ii. Sync 30+ events 1. 18.90 sec 2. 18.37 sec 3. 16.47 sec Average: 17.91 sec iii. Cold launch time (30+ events on calendar) 1. 2.12 sec 2. 2.14 sec 3. 2.50 sec Average: 2.25 ix. Remove local data (30+ events) 1. 8.17 sec 2. 6.01 sec Average: 7.09 sec - -- - -- - --- -- - -- - --- -- - -- - -- * Build info.: + V1.3T with latest PAC file (0402) - Gaia 02b97c89dec7a10a955c85b921b2a66181eebb0e - Gecko f8bca24057937f5b09d73512ba1e771011ab4203 - BuildID 20140331101634 - Version 28.1 + V1.4 - Gaia 4c3b2f57f4229c5f36f0d8fd399e65f4db88f104 - Gecko https://hg.mozilla.org/releases/mozilla-aurora/rev/3aaca223b673 - BuildID 20140330160202 - Version 30.0a2
Flags: needinfo?(whsu)
Keywords: qawanted
Priority: -- → P4
Whiteboard: [mentor=jlal@mozilla.com][LOE:S] [c= p= s= u=] → [c=progress p= s= u=] [mentor=jlal@mozilla.com][LOE:S]
Mentor: jlal
Whiteboard: [c=progress p= s= u=] [mentor=jlal@mozilla.com][LOE:S] → [c=progress p= s= u=] [LOE:S]
blocking-b2g: backlog → ---
Firefox OS is not being worked on
Status: REOPENED → RESOLVED
Closed: 11 years ago7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: