Open Bug 934934 Opened 6 years ago Updated 4 months ago

[meta][Session Restore] Track sites that spam sessionstore.js, find defensive strategies

Categories

(Firefox :: Session Restore, defect)

defect
Not set

Tracking

()

People

(Reporter: Yoric, Unassigned)

References

(Depends on 1 open bug, )

Details

(Keywords: meta, perf, Whiteboard: [tracking][fxperf:meta])

Attachments

(8 files)

In bug 669034, C wrote:
« So, Firefox 24.0, I only have a reasonable number of tabs, and used to see stalls of 3000 ms (yes, 3 seconds) in the parent of ssi_serializeHistoryEntry(), as well as 800 ms to write the sessionstore.js file to disk. I have a quad-core Haswell Xeon and a fast Intel SSD. The sessionstore.js file was 60MB.

I tracked it down to some ajax-y query mechanism Facebook chat uses that leaks long (>1kB) urls which all get persisted.

From a little python script I wrote to sort strings in the JSON by length, outputting keys:
1212 /windows[0]/tabs[5]/entries[5]/children[14]/url
1212 /windows[0]/tabs[5]/entries[5]/children[4]/url
1212 /windows[0]/tabs[5]/entries[5]/children[8]/url

These URLs are of the form "https://www.facebook.com/ai.php?something=1kB_of_gobblydegook". The result of GETing this 1kB URL is a 0.10kB response:

<span id="fbEmuTrackingSucc&#101;ss">Succ&#101;ss</span>

Those leaking URLs accumulated 10-50kB per minute towards my sessionstore.js, eventually leading to 3000 ms stalls every 10 seconds, which is about as fun as it sounds. I used adblock to block the URLs, and now my sessionstore.js is fairly stable at around 100-120 kB.

I'm not sure what can be done from the Firefox side to garbage collect this sort of behavior (it's hard to destroy manually without losing your session because of tab-undo); it could certainly be fixed on Facebook's end, but their public bug-filing mechanism is pretty bad.
»

That's important information. We should set out to determine which sites are hurting us and how we can work around these hurts, either through code or through evangelism.
David Tryse wrote an extension that can be useful here:
https://addons.mozilla.org/en-US/firefox/addon/about-sessionstore/
Attached image sessionstore_10min.png
about:sessionstore after unblocking facebook.com/ai.php for about 10 minutes. It's already the dominant component of a sessionstore at 36 kB. After a quick photoshopping, it's up to 42 kB already.
Thanks. I have created a sub-bug specifically for facebook.com, btw: bug 934935.
(In reply to David Rajchenbach Teller [:Yoric] <needinfo? me> from comment #0)
> In bug 669034, C wrote:
> « ...
> Those leaking URLs accumulated 10-50kB per minute ...
> »
> 
> That's important information. We should set out to determine which sites are
> hurting us and how we can work around these hurts, either through code or
> through evangelism.


OK, can you specify "hurting us"?

And are only sites are interesting that "accumulated ..kb per minute" or every site above ..kb storage ???
Google Search with logged in user.
Attached image Google Mail
Google Mail.
The new Google Maps with logged in user.
Microsoft Skydrive Excel Document.
(In reply to Tobias B. Besemer from comment #4)
> (In reply to David Rajchenbach Teller [:Yoric] <needinfo? me> from comment
> #0)
> > In bug 669034, C wrote:
> > « ...
> > Those leaking URLs accumulated 10-50kB per minute ...
> > »
> > 
> > That's important information. We should set out to determine which sites are
> > hurting us and how we can work around these hurts, either through code or
> > through evangelism.
> 
> 
> OK, can you specify "hurting us"?
> 
> And are only sites are interesting that "accumulated ..kb per minute" or
> every site above ..kb storage ???

Actually, we don't know for sure. But definitely, a site that accumulates kb per minutes is bound to hurt us.
Depends on: 938464
A Doc in an Facebook Group. New Doc Style.
A folder in Google Drive.
Attachment #832714 - Attachment description: 2013-11-15 04_31_01-about_sessionstore.png → Doc in an Facebook Group
Attachment #832716 - Attachment description: Google Drive → A folder in Google Drive
Attachment #831831 - Attachment description: 2013-11-13 18_56_13-about_sessionstore.png → Microsoft Skydrive Excel Chart
Attachment #831829 - Attachment description: 2013-11-13 22_26_17-about_sessionstore.png → New Google Maps with logged in user
Attachment #831828 - Attachment description: 2013-11-13 05_53_52-about_sessionstore.png → Google Mail
Attachment #831827 - Attachment description: 2013-11-13 05_53_04-about_sessionstore.png → Google Search with logged in user
Comment on attachment 827356 [details]
sessionstore_10min.png

Facebook Message Page
(In reply to Eugene Savitsky from comment #10)
> https://bugzilla.mozilla.org/show_bug.cgi?id=902374 - may be it's related?

Most likely not.
Attached image Google Play
Google Play Store.
All Sessionstore screenshots from me are taken from a Win7 64bit machine with the newest FF26beta, no Plugins and the activated NoScript Extension, shortly after opening the tab. Some scripts (like from google.com or facebook.com) may be allowed.

My idea behind was to first collect some 'modern' cloud pages to investigate and better track them later.
Not sure anything can be done about this, but I wanted to make a note of this:

Having various Path of Exile character builds open also significantly impacts SessionStore. It seems that every time you modify one of these builds, it creates a new entry in the page history, and each entry gets saved. I had two builds open in pinned tabs with lots of history from tweaking each build, and this caused me to experience significant jank whenever the SessionStore file was updated. about:sessionstore showed me that these tabs were causing around 26MiB of SessionStore usage, and Windows' task manager showed 400-500 MiB spikes in memory usage every time the SessionStorage file was written. Opening these builds in new tabs (thereby losing the back button history) then clearing the closed tabs entries in about:sessionstore made SessionStore size drop back down to ~400kiB and made the jank go away (it also lowered average total memory usage by about 100MiB, even beyond eliminating the spikes).

An example build is here:
http://www.pathofexile.com/passive-skill-tree/AAAAAgABlKDaYmh0-eimVzGe2E0n7Rku1I-53e8OxthYY1BQjM_2SF8_rKpyqXzZQarfvxRxpzAB5zboYSGE73Tteu9gSwUtxFgn1YTZZU1HfqvFfLvFivAfogAUTQSzAnG-vILkkBGKr_IvkFWnhBo4FCBQR0rIWK-18qlueA064fJFTeM1kv6PwBpZ8_jr9zJuqudjiPGsWew4Otg_JypNFSAs6e960359df66g9vuDiP27_DdDfzFZ6CHdkp9_EvOcVb6WkhsFp_LGJH3viXfG_qkGb6KAdzi6j38fLgpLowGpKxuab6n0k3AD0Zp_gqpaA==

You can play around with it by deallocating any of the leaf nodes and putting these points into something else.
(In reply to Emanuel Hoogeveen [:ehoogeveen] from comment #17)
> Not sure anything can be done about this, but I wanted to make a note of
> this:

Can you file a specific bug?
Depends on: 942601
(In reply to David Rajchenbach Teller [:Yoric] <needinfo? me> from comment #18)
> Can you file a specific bug?

Filed as bug 942601.
Whiteboard: [tracking]
Depends on: 1009579
A discussion about changes/improvements to the Session Restore (sessionstore):
https://groups.google.com/forum/#!topic/mozilla.dev.platform/JHrOP3yMgfg
Assignee: nobody → dteller
QA Contact: Tobias.Besemer
I'm not working on Session Restore anymore.
Assignee: dteller → nobody
(In reply to David Rajchenbach-Teller [:Yoric] (use "needinfo") from comment #21)
> I'm not working on Session Restore anymore.

Oh, OK! (Sad!) Who does it now ???

SR was getting (much) better, but I think it can/should be still improved ...
Doesn't wrote new bugs & comments anymore because I was thinking Mozilla.com is busy with 64-bit, e10s & stability ... ^^
Depends on: 1008960
Whiteboard: [tracking] → [tracking][fxperf]
Whiteboard: [tracking][fxperf] → [tracking][fxperf:meta]
You need to log in before you can comment on or make changes to this bug.