LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Creating tmpfs larger than physical ram (https://www.linuxquestions.org/questions/linux-general-1/creating-tmpfs-larger-than-physical-ram-674208/)

arizonagroovejet 10-04-2008 10:56 AM

Creating tmpfs larger than physical ram
 
Say I have a machine with 512MB of ram in it and I create a 9.5GB swap partition. Then I put the necessary stuff in to /etc/fstab to mount a 10GB tmpfs partition. Is that an OK thing to do, or is it a hideously bad liable to cause the system to lock up under certain circumstances?

I've done a quick test creating a 1GB tmpfs partition and filling it by creating a big file with dd and the system kept running OK. But maybe I was lucky.

Why am I thinking of this? Because I'm thinking about a web kiosk set up where users would just be able to run Firefox and nothing else and I'd make /home a tmpfs partition for both speed and as it's wiped out by a reboot. Even with Firefox's disk cache usage left at the default 50MB there shouldn't be more than about 100MB in /home at any one time, but I'd be using hardware with only 512MB ram and I'm thinking having lots of space in /home just in case someone manages to write a bunch of stuff there (though I'd lock Firefox down and remove the file chooser dialogues) might be a good idea.

MensaWater 10-05-2008 01:50 PM

While you might be able to make it work it wouldn't really have the desired effect. In fact I suspect it would likely worsen overall performance.

This is because once the physical ram is exceeded you're immediately dropping back down to disk speed when you access swap. Additionally because you've tied up almost all your physical ram with this tmpfs you'd have caused a memory constraint on the rest of your processing (remember you need for man than tmp space for running processes).

In fact this has a lot to do with the reason why most systems these days do "paging" rather than "swapping" because performance on systems that used to do heavy swapping generally was horrible.

If you truly need the additional performance you really want to increase RAM rather than try to do this.

i92guboj 10-05-2008 02:16 PM

So you want to use disk to emulate ram to emulate a disk, odd thing.

If you really need such a huge amount of space on tmpfs, then it's definitely time to upgrade your box and buy more ram. If you are going to be swapping 9.5GB or ram at any time, your box will be definitely locked during hours to do simple tasks.

huwnet 10-05-2008 02:22 PM

Quote:

Why am I thinking of this? Because I'm thinking about a web kiosk set up where users would just be able to run Firefox and nothing else and I'd make /home a tmpfs partition for both speed and as it's wiped out by a reboot.
Perhaps it would be easier just to create a script to clear the home folder :)

arizonagroovejet 10-05-2008 04:30 PM

Quote:

Originally Posted by huwnet (Post 3301034)
Perhaps it would be easier just to create a script to clear the home folder :)

Well yeah, wiping out the contents of /home every time the machine is rebooted is trivial. I was thinking of having /home in tmpfs for speed. There would be potentially thousands of users of the kiosk each of whom have to log in with their own usercode. So I'd have home directories created for them using pam_mkhomedir (or whatever the module's called, not on a Linux box right now) and having /home in tmps dramatically reduces the time between someone logging in and being able to do stuff. Just leaving /home on the harddisk is of course the easiest thing to do, I just like the idea of making the time between login and usability as short as possible.

But it overall it sounds like using tmpfs could potentially be more trouble than it's worth so I probably won't bother.

i92guboj 10-05-2008 04:34 PM

You can try... It's a trivial thing to setup, but really, I doubt it's worth it.

Remember that firefox is not the lightest thing. Gtk2 and the gecko engine are two beasts in terms of ram usage, and if you are going to be using firefox all the time, your ram will most likely be filled completely almost always. That and tmpfs will bring your machine to it's knees, I bet. But, as said, trying doesn't hurt...

arizonagroovejet 10-05-2008 04:45 PM

Quote:

Originally Posted by i92guboj (Post 3301145)
trying doesn't hurt...


It does if it fails in a production environment :)


All times are GMT -5. The time now is 06:09 PM.