You are not logged in.

#1 2011-05-08 21:31:23

scullder
Member
Registered: 2011-04-27
Posts: 21

firefox-tmpfs-daemon : sync your mozilla directories to tmpfs

Hi ! I've just written an ugly daemon script to relocate firefox profiles directory to a tmpfs !
http://aur.archlinux.org/packages.php?ID=48746

I know, it does the same as firefox-sync, but I've used another approach : the sync is made at boot and stop time with a small daemon script (though it's not a real daemon).
It uses rsync and can handle multiple users.

There are several advantages :
* the copy is made only at boot and shutdown with rsync, it has no impact on firefox startup time
* a copy is always kept on the disk, and the script can recover from a crash, using the old copy

I use it since last week, and another user helped me to debug, so I think it's ready wink

You can add the script to your daemon array in /etc/rc.conf to use it automatically :
DAEMONS=(... @firefox-tmpfs ...)

It's easy to use :
* rc.d start firefox-tmpfs : move profiles to tmpfs
* rc.d stop firefox-tmpfs : sync profiles to your disk
* rc.d restart firefox-tmpfs : ...
* rc.d save firefox-tmpfs : sync your profile to your disk (just in case), but do not stop using tmpfs

You can find firefox-tmpfs-daemon on  AUR : http://aur.archlinux.org/packages.php?ID=48746

I hope it will help you, I'd be happy to get some feedback wink

Last edited by scullder (2011-05-14 13:41:44)

Offline

#2 2011-05-11 09:53:34

unikum
Member
From: Russia
Registered: 2010-09-04
Posts: 151
Website

Re: firefox-tmpfs-daemon : sync your mozilla directories to tmpfs

I test this. Work fine.

Offline

#3 2011-05-11 11:32:00

kokoko3k
Member
Registered: 2008-11-14
Posts: 1,432

Re: firefox-tmpfs-daemon : sync your mozilla directories to tmpfs

Can i set an hourly cron job restart firefox-tmpfs?
I'm asking because i strongly use hibernation on my netbook, but 1/10 of the times it doesn't work and i'm forced to shutdown it "unproperly", so a 'sync online ' (red: while firefox is open/the profile in use) feature would be good.

thanks!

-edit-
Here's my firefox.desktop exec line now (i'm using 'timeless' sudo):

sudo /etc/rc.d/firefox-tmpfs start ; firefox %u ; for database in ~/.mozilla/firefox/*/*.sqlite; do echo processing $database... ; sqlite3 $database 'VACUUM;'; done ; sudo /etc/rc.d/firefox-tmpfs stop

One nice addition to your 'daemon' would be the ability to select what users and what profiles to keep in tmpfs.

Anyway it works fine, great

Last edited by kokoko3k (2011-05-11 11:49:58)

Offline

#4 2011-05-11 12:54:14

scullder
Member
Registered: 2011-04-27
Posts: 21

Re: firefox-tmpfs-daemon : sync your mozilla directories to tmpfs

kokoko3k wrote:

Can i set an hourly cron job restart firefox-tmpfs?
I'm asking because i strongly use hibernation on my netbook, but 1/10 of the times it doesn't work and i'm forced to shutdown it "unproperly", so a 'sync online ' (red: while firefox is open/the profile in use) feature would be good.

thanks!

I think it's a bad idea to make a restart while firefox is running, use the save target instead.

rc save firefox-tmpfs

I've never tested intensively this usage so careful wink

kokoko3k wrote:

-edit-
Here's my firefox.desktop exec line now (i'm using 'timeless' sudo):

sudo /etc/rc.d/firefox-tmpfs start ; firefox %u ; for database in ~/.mozilla/firefox/*/*.sqlite; do echo processing $database... ; sqlite3 $database 'VACUUM;'; done ; sudo /etc/rc.d/firefox-tmpfs stop

One nice addition to your 'daemon' would be the ability to select what users and what profiles to keep in tmpfs.

Anyway it works fine, great

I will make a config file in /etc/default. With the current version, you can change the users var in /etc/rc.d/firefox-tmpfs at line 14.

Change

users="`ls -d -c1 /home/*/.mozilla | cut -d/ -f3`"

With a list of users separated by spaces (should work)

users="username1 username2"

Thanks for testing and using smile

Offline

#5 2011-05-11 20:28:12

ilusi0n
Member
Registered: 2010-06-09
Posts: 187

Re: firefox-tmpfs-daemon : sync your mozilla directories to tmpfs

It's great. Thanks. Good contribution smile

Offline

#6 2011-05-11 22:06:32

scullder
Member
Registered: 2011-04-27
Posts: 21

Re: firefox-tmpfs-daemon : sync your mozilla directories to tmpfs

scullder wrote:

I will make a config file in /etc/default.

s/default/config/

Done, the configuration file is /etc/config/firefox-tmpfs ! smile
You can specify a list of users (var USERS), and the tmpfs directory (var TMPFS).

Offline

#7 2011-05-13 01:11:46

brebs
Member
Registered: 2007-04-03
Posts: 3,401

Re: firefox-tmpfs-daemon : sync your mozilla directories to tmpfs

Sqlite's fsync is a performance-killer (affects firefox4 and liferea), so an alternative I've recently started using is:

Compile sqlite with:
CFLAGS+=" -DSQLITE_NO_SYNC"

And compile firefox4 with:
echo "ac_add_options --enable-system-sqlite" >> mozconfig

This is a reasonable alternative to throwing the sqlite databases into TMPFS.

Offline

#8 2011-05-13 01:18:15

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 6,772

Re: firefox-tmpfs-daemon : sync your mozilla directories to tmpfs

Just a note - would it not be a good idea to put a link to this on the wiki (under Firefox of course).


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#9 2011-05-13 11:33:57

scullder
Member
Registered: 2011-04-27
Posts: 21

Re: firefox-tmpfs-daemon : sync your mozilla directories to tmpfs

brebs wrote:

Sqlite's fsync is a performance-killer (affects firefox4 and liferea), so an alternative I've recently started using is:

Compile sqlite with:
CFLAGS+=" -DSQLITE_NO_SYNC"

And compile firefox4 with:
echo "ac_add_options --enable-system-sqlite" >> mozconfig

This is a reasonable alternative to throwing the sqlite databases into TMPFS.

Thanks, I will test it wink

ngoonee wrote:

Just a note - would it not be a good idea to put a link to this on the wiki (under Firefox of course).

Using specific compilation options or firefox-sync / firefox-tmpfs can introduce unknown specific bugs, conflicts, etc.
In order to make a good bug report, we must use the default package / no personnal tweaks...
So I think it's a bad idea to add things like that to firefox main article on the wiki, except if you want to stress packagers of sqlite, firefox and all sqlite-dependent packages...
And there's already an article for firefox-sync with a note about firefox-tmpfs on the wiki wink https://wiki.archlinux.org/index.php/Firefox_Ramdisk

Offline

#10 2011-05-13 12:07:11

NSB-fr
Member
Registered: 2010-01-23
Posts: 45

Re: firefox-tmpfs-daemon : sync your mozilla directories to tmpfs

kokoko3k wrote:

Can i set an hourly cron job restart firefox-tmpfs?
I'm asking because i strongly use hibernation on my netbook, but 1/10 of the times it doesn't work and i'm forced to shutdown it "unproperly", so a 'sync online ' (red: while firefox is open/the profile in use) feature would be good.

thanks!

-edit-
Here's my firefox.desktop exec line now (i'm using 'timeless' sudo):

sudo /etc/rc.d/firefox-tmpfs start ; firefox %u ; for database in ~/.mozilla/firefox/*/*.sqlite; do echo processing $database... ; sqlite3 $database 'VACUUM;'; done ; sudo /etc/rc.d/firefox-tmpfs stop

One nice addition to your 'daemon' would be the ability to select what users and what profiles to keep in tmpfs.

Anyway it works fine, great

Just an idea that came to my mind reading you:

If you use pm-utils for your hibernation stuff, get a look at pm-utils hooks. A simple hook that call /etc/rc.d/firefox-tmpfs save on hibernate and suspend would do the trick and would be cleaner I think.


Carpe Diem

Offline

#11 2011-12-02 19:09:45

graysky
Member
From: /run/user/1000
Registered: 2008-12-01
Posts: 8,336
Website

Re: firefox-tmpfs-daemon : sync your mozilla directories to tmpfs

Excellent idea.  I think you should expand it to syncing other browser profiles, chromium, opera, etc.  Also, make a readme.install that explains basic usage or write a wiki page (does one exist)?

Last edited by graysky (2011-12-02 19:12:29)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#12 2011-12-03 00:54:56

graysky
Member
From: /run/user/1000
Registered: 2008-12-01
Posts: 8,336
Website

Re: firefox-tmpfs-daemon : sync your mozilla directories to tmpfs

scullder wrote:

I really don't have the time for that now. But you can fork on github wink https://github.com/hcartiaux/archlinux- … pfs-daemon

I've thought about extending the possibilities (choice of directory synced), but anyway, it would be a new package.
I don't want to change the behavior of firefox-tmpfs-daemon, because it could disturb some users who have forgotten they were using it (I hate losing my firefox profile) wink

EDIT:  sorry to hijack your thread.  I started my own.  Please post their if you wish.

Last edited by graysky (2011-12-03 11:09:39)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#13 2011-12-03 02:37:13

brebs
Member
Registered: 2007-04-03
Posts: 3,401

Re: firefox-tmpfs-daemon : sync your mozilla directories to tmpfs

I'm surprised you think that is a better idea than just "fixing" sqlite so as not to be so slow, as I mention above.

Especially in a "KISS" distro wink

Edit: I'm using sqlite 3070701 happily (their version numbers are weird) with firefox 9.0b2

Last edited by brebs (2011-12-03 02:39:23)

Offline

#14 2011-12-07 03:09:49

ZekeSulastin
Member
Registered: 2010-09-20
Posts: 266

Re: firefox-tmpfs-daemon : sync your mozilla directories to tmpfs

brebs wrote:

I'm surprised you think that is a better idea than just "fixing" sqlite so as not to be so slow, as I mention above.

Especially in a "KISS" distro wink

Edit: I'm using sqlite 3070701 happily (their version numbers are weird) with firefox 9.0b2

Honestly, barring getting the maintainer to change the repo build flags I think using a quick script in conjunction with the preexisting tmpfs is probably a great deal simpler in execution then recompiling not one but two programs (at least one of which can take quite a while) every time the programs in question update within a binary-based distro using differing flags than the norm.  You're just trading one method of complication for another sad

Last edited by ZekeSulastin (2011-12-07 03:10:14)

Offline

#15 2013-04-19 10:37:59

scullder
Member
Registered: 2011-04-27
Posts: 21

Re: firefox-tmpfs-daemon : sync your mozilla directories to tmpfs

I will ask for the removal of this package because I'm not maintaining it anymore...
If there are still users of this package, switch to the solution of graysky please wink

Offline

Board footer

Powered by FluxBB