Re: Firefox profiles on a tmpfs (ramdisk)?

2010-10-25 Thread Jouko Orava
  The question is, are Ubuntu developers interested in this?

 No.

Understood. Would it be possible to add the Firefox startup and shutdown
script hooks into Firefox run-mozilla.sh in Ubuntu, though?

 Have you tried using libeatmydata?  The only key difference there should be
 with using tmpfs is that it effectively makes fsync() a noop.

No, libeatmydata is risky. The profile may be garbled if Firefox crashes.

Using a limited size profile and tmpfs (say, 64 MB) I can keep the profile
in memory even in low memory situations, without risking the profile
integrity. The profile is saved in exactly the state Firefox leaves it
when it closes or crashes.

If the workstation crashes, with tmpfs the changes made in the current
session are lost, and the profile reverts to the previous state.
Some users might prefer this behaviour; I do.

Using tmpfs, I can save and snapshot the active profile at any time,
for example in suspend scripts. As long as Firefox syncs changesets
to the profile files properly, the profile can be copied at any time.
With a helper, one could save the profile periodically, e.g. after
suitable periods of inactivity.

Thanks anyway,
Jouko

-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss


Re: Firefox profiles on a tmpfs (ramdisk)?

2010-10-25 Thread Phillip Susi
On 10/25/2010 1:34 PM, Jouko Orava wrote:
 Using tmpfs, I can save and snapshot the active profile at any time,
 for example in suspend scripts. As long as Firefox syncs changesets
 to the profile files properly, the profile can be copied at any time.
 With a helper, one could save the profile periodically, e.g. after
 suitable periods of inactivity.

This is not true.  If you copy the file wile ff is changing it, you can
end up with a corrupt copy.

-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss


Re: Firefox profiles on a tmpfs (ramdisk)?

2010-10-25 Thread Jouko Orava
  Using tmpfs, I can save and snapshot the active profile at any time,

 This is not true.  If you copy the file wile ff is changing it, you can
 end up with a corrupt copy.

I meant that you can get a copy of the profile state as if Firefox had
crashed at that point.

(You can take a snapshot opportunistically at any time, by first
 taking the snapshot of the profile, and then checking that the files
 were not modified in the last two seconds, and will not be modified
 in the next two seconds. If the profile is on tmpfs, writes should
 affect metadata immediately, and the two-second limit takes care of
 any clock granularity issues.
 If the user is active and the files were modified in the grace period,
 the snapshot may be broken, just as if Firefox had crashed.)

Since Firefox is supposed to be able to recover the session
from a crash, you *should* be able to take a snapshot of the active
profile at any time.

In fact, if you monitor Firefox file access patterns with e.g.
inotifywait -m -r path-to-the-active-profile-directory
or by stracing firefox-bin, you can see that both the session store
(sessionstore.js) and the places database (places.sqlite*) are
modified in a way that makes snapshotting safe.

(sessionstore.js is written to a temporary file, synced, then the original
 replaced with the temporary copy; places has a separate journal file
 which is written and synced before data is written to the db.)

Cheers,
Jouko

-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss


Re: Firefox profiles on a tmpfs (ramdisk)?

2010-10-25 Thread Micah Gersten
On 10/24/2010 10:12 AM, Jouko Orava wrote:
 Hello,

 For a couple of years now I've kept my active Firefox profiles on a tmpfs
 (mounted size=128M,mode=01777,atime,auto,rw,nodev,noexec,nosuid)
 on both my desktop workstation and on my minilaptop. It feels subjectively
 much snappier, but I haven't actually measured the difference.
 On the laptop, it also reduces disk usage, which is very nice.

 The profiles are unpacked from a tarball when firefox starts, and tarred
 back when firefox closes, using two script hooks in run-mozilla.sh:
   [ -x /usr/lib/firefox-profiles.sh ]  /usr/lib/firefox-profiles.sh load
 just before the final if clause, and
   [ -x /usr/lib/firefox-profiles.sh ]  /usr/lib/firefox-profiles.sh save
 just after the final if clause.

 The script itself is very careful to not fail (and not to overwrite the
 old tarball unless the new one is ok), and has never failed yet,
 even when Firefox crashes.

 I tried to get something similar upstream earlier:
   https://bugzilla.mozilla.org/show_bug.cgi?id=576707
 but it was rejected for complexity reasons.

 If the Ubuntu Mozilla team were to add the script hook into Firefox
 -- noting that it does not change the behaviour by default, only if the
 hooked script actually exists --, I could create an Ubuntu package,
 which when installed creates the necessary tmpfs, profile tarballs,
 and modifications to the profile configs to limit the profile size
 (so that the tmpfs does not grow too large).
 All of the changes are also safely undoable if the package is removed.
 Each user can also choose which profiles, if any, are kept on the tmpfs.

 The question is, are Ubuntu developers interested in this?

 It does add changes to Firefox run-mozilla.sh script, which has to be
 maintained. (However, run-mozilla.sh does not seem to change often.)

 If there is interest for this, I could upload or e-mail the scripts
 (/usr/lib/firefox-profiles.sh for Firefox, and proposed maintainer
  scripts for a package setting up the tmpfs and moving Firefox
  profiles to a tmpfs.)

 (There are also some user interface related issues to think about, too.
  For example, should the package move all profiles to tmpfs by default,
  or should it have a GUI prompting the user on the next Firefox startup?
  Is there need for a migration tool, GUI or commandline, so that users
  could choose afterwards?)

 At the minimum, adding the script hook into run-mozilla.sh makes
 the testing much easier. Now, I need to modify run-mozilla.sh whenever
 Firefox is updated, which is a bit of a chore..

 I'd be very happy to provide further information for those interested.

 Cheers,
   Jouko Orava


If upstream rejected for complexity, we won't be able to take it
either.  We will be discussing increasing the time between session saves
in Firefox though.

Thanks,
Micah Gersten
Ubuntu Mozilla Team

-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss