Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 02 Oct 2014, 06:41
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
Does running without swap memory hurt performance?
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 2 of 3 Posts_count   Goto page: Previous 1, 2, 3 Next
Author Message
illidan.modeler

Joined: 02 Sep 2013
Posts: 35

PostPosted: Tue 17 Sep 2013, 05:07    Post_subject:  

Karl Godt wrote:
Code:
geany /etc/rc.d/rc.sysinit

and in the Find box type swap and hit the magnifier button to search .


Nice. I've found the script snippet that deals with swap file. However, I notice that it tries to load a file named /pupswap.swp.

Will this file take up my space in save.2fs which is already tight? In addition, bigger save.2fs seems to take longer time to compress when I shut down the system. So I might need to balance between the time it takes to shut down and the room within the SAVE file preventing me from setting a too large SAVE file.

_________________
Laptop1(Core i3, 2G , 320G ): Ubuntu 12.04
Laptop2(Celeron SU2300, 2G , 320G ): Lubuntu 13.04
Laptop3(Turion64 MT28, 1280M, 40G): Bodhi 2.4 with E17
External HDD1: SalixOS 14.0 with fvwm
External HDD2: Blag Linux and GNU 140k
Pen Drive: Slacko 5.6
Back to top
View user's profile Send_private_message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Tue 17 Sep 2013, 06:29    Post_subject:  

Code:
 [ "$PSWAPFILE" ] && SWAPFILE="`echo -n "$PSWAPFILE" | cut -f 3 -d ','`"  #/etc/rc.d/PUPSTATE


Older? Pups created a pupswap.swp file in /etc/rc.d/rc.shutdown in special cases automatically .

Everything depends on the PUPMODE that you are running : Look into /etc/rc.d/PUPSTATE .


pupswap.swp in full installation should reside on toplevel=/ like Windows's pagefile.sys
and on fraggle insulation on /initrd${PUP_HOME} -- also look into PUPSTATE file for PUP_HOME

-- Cannot remember that PUP_HOME would be inside the pup_ro1 pupsave file , but there are few PUPMODEs out from PUPPY-VERSION-1 times mentioned here and there in the codes , that I never had the pleasure to experience myself .
Back to top
View user's profile Send_private_message Visit_website 
mikeb


Joined: 23 Nov 2006
Posts: 8257

PostPosted: Tue 17 Sep 2013, 08:04    Post_subject:  

Quote:
Ok this is from Lucid...if no swap partition then it tries to load pupswap.swp located in the root of the save drive...

Code:
#if no go, try for a swap file...
if [ "$SWAPON" != "yes" ];then
SWAPFILE="/pupswap.swp"
if [ -f /initrd${PUP_HOME}${SWAPFILE} ];then
echo -n "Loading swap file ${SWAPFILE}..." >/dev/console
swapon /initrd${PUP_HOME}${SWAPFILE}
status_func $?
[ $? -eq 0 ] && SWAPON="yes"
fi
if [ -f $SWAPFILE ];then
echo -n "Loading swap file ${SWAPFILE}..." >/dev/console
swapon $SWAPFILE
status_func $?
[ $? -eq 0 ] && SWAPON="yes"
fi
fi


It may well still be the case for newer puppies...

heres a swap file ..extract and enjoy..its magic Smile
http://dl.dropbox.com/u/110545536/Puppy/pupswp_512.tar.gz

mike


you obviously did not see this the first time lol
I must get a bath....
wibble wibble snidge and fluffle

bye

Edited_time_total
Back to top
View user's profile Send_private_message 
musher0


Joined: 04 Jan 2009
Posts: 4245
Location: Gatineau (Qc), Canada

PostPosted: Tue 17 Sep 2013, 09:27    Post_subject:  

This is what I would suggest, then:

Download and unzip the slaxsave.zip file attached above.
Unzip save512.zip. A slaxsave.dat file of 512 Mg will be unpacked.
Rename this slaxsave.dat to pupswap.swp.
Move this pupswap.swp to /mnt/home.
and at next boot you will have a 512 Mg swap file.

I do not wish to start an argument, but in my experience,
it doesn't make sense to put your swap file in / , since that
will only occupy space on your pupsave file.

I believe the proper place for it is on a disk partition
such as /mnt/sda1 or /mnt/sda2 (which are traditionally
the hard drives) or even on your USB drive if you
have space enough there.

Regards.

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send_private_message Visit_website 
mikeb


Joined: 23 Nov 2006
Posts: 8257

PostPosted: Tue 17 Sep 2013, 09:48    Post_subject:  

Quote:
I do not wish to start an argument, but in my experience,
it doesn't make sense to put your swap file in / , since that
will only occupy space on your pupsave file.


No argument intended...in fact you made me realise my last post was unclear..I edited it... /swapsave.swp is for a full install (yes could be useful to full installers)... but for a frugal install its swapon /initrd${PUP_HOME}${SWAPFILE} which is indeed /mnt/home.... in both cases its in the root of the partition.
Note for anyone trying this no sub folders can be used.

Since this forum seems to be the unofficial wiki we all tend to try to add as much information as we can. Smile

regards
mike
Back to top
View user's profile Send_private_message 
illidan.modeler

Joined: 02 Sep 2013
Posts: 35

PostPosted: Tue 17 Sep 2013, 10:59    Post_subject:  

musher0 wrote:
This is what I would suggest, then:

Download and unzip the slaxsave.zip file attached above.
Unzip save512.zip. A slaxsave.dat file of 512 Mg will be unpacked.
Rename this slaxsave.dat to pupswap.swp.
Move this pupswap.swp to /mnt/home.
and at next boot you will have a 512 Mg swap file.

I do not wish to start an argument, but in my experience,
it doesn't make sense to put your swap file in / , since that
will only occupy space on your pupsave file.

I believe the proper place for it is on a disk partition
such as /mnt/sda1 or /mnt/sda2 (which are traditionally
the hard drives) or even on your USB drive if you
have space enough there.

Regards.



Code:

#if no go, try for a swap file...
 if [ "$SWAPON" != "yes" ];then
  SWAPFILE="/pupswap.swp"
  if [ -f /initrd${PUP_HOME}${SWAPFILE} ];then
   echo -n "Loading swap file ${SWAPFILE}..." >/dev/console #loading swap file
   swapon /initrd${PUP_HOME}${SWAPFILE}
   status_func $?
   [ $? -eq 0 ] && SWAPON="yes"
  fi
  if [ -f $SWAPFILE ];then
   echo -n "Loading swap file ${SWAPFILE}..." >/dev/console
   swapon $SWAPFILE
   status_func $?
   [ $? -eq 0 ] && SWAPON="yes"
  fi
 fi


I found this script snippet in /etc/rc.d/rc.sysinit, following the suggestions of Godt. I think I should assgin a swap file under root path accroding to this piece of script. Maybe I was wrong for I did not read the script as a whole and I might make a misunderstanding.

I just tried to make one swap file under /mnt/home. It works fine. Great.

Code:

cd /mnt/home
dd if=/dev/zero of=pupswap.swp bs=1024 count=102400
chmod 600 pupswap.swp
mkswap pupswap.swp
swapon -v pupswap.swp

These commands make a swap file of 100M. Change count according to your need.

Code:

swapon -s
free

to see the effect and result.

_________________
Laptop1(Core i3, 2G , 320G ): Ubuntu 12.04
Laptop2(Celeron SU2300, 2G , 320G ): Lubuntu 13.04
Laptop3(Turion64 MT28, 1280M, 40G): Bodhi 2.4 with E17
External HDD1: SalixOS 14.0 with fvwm
External HDD2: Blag Linux and GNU 140k
Pen Drive: Slacko 5.6
Back to top
View user's profile Send_private_message 
sunburnt


Joined: 08 Jun 2005
Posts: 5032
Location: Arizona, U.S.A.

PostPosted: Tue 17 Sep 2013, 14:18    Post_subject:  

Generally a swap partition or file is a good idea.
But with 2 GB or more of ram, then no swap is needed.

Having no swap is faster as the cpu isn`t doing R/W to the slow H.D. all the time.
And if the O.S. is setup with no initramfs, then the cpu and ram don`t have it either.

But as said, enough ram is needed, at least 512 MB, but I`d say 1 to 2 GB is better.
To run even a few apps at one time have 1 GB, and maybe more for heavy use.
.
Back to top
View user's profile Send_private_message 
musher0


Joined: 04 Jan 2009
Posts: 4245
Location: Gatineau (Qc), Canada

PostPosted: Wed 18 Sep 2013, 00:01    Post_subject:  

Hi, sunburnt.

FWIW, I read somewhere (was it a post by Flash?) that you needed a swap partition or file even if you have enough RAM and the swap is not used, because it is "a habit" of Linux. (Coded in the kernel?)

Maybe it's psychological, but I find that the old Windows rule of (the size of static swap should equal the size of RAM x 2.5) gives the best performance and speed on my older machine.

Probably no technical basis to it, but still...

BFN.

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send_private_message Visit_website 
amigo

Joined: 02 Apr 2007
Posts: 2252

PostPosted: Wed 18 Sep 2013, 09:54    Post_subject:  

The best advice is to always have at least even a tiny bit of swapspace -whether it be a partition or as a file. In fact, even as a file or partition in a RAM-disk or tmpfs.

The reason is that in the case that all RAM is used, the kernel must move something out of the cache into swapspace -otherwise an OOM condition occurs (Out Of Memory). There is a kernel config option which enables the kernel to ask you which process to kill -or if this is not enabled you get a hard freeze. 'All RAM used' means that both running processes and those in cache are occupying the net RAM available -a RAM-disk or tmpfs are still separate. That's why even a small swapfile in such dedicated RAM can save your bacon.

Editing huge sound or video files or compiling huge, complex sources can definitely exhaust RAM of 1-2GB -just yesterday I read of something that needs 8GB swap+RAM to compile and link.

The key to a usable size for a swap device lies in the minimum configurable value= 4K -exactly one page of memory. If you run a machine with just 256MB of RAM, you can easily run out of RAM just from opening a few tabs in the browser at the same time. Having an extra 16-128MB of swapspace can avoid lots of lockups and really slow program response. I think a minimally-useful swapspace should be at least 512K for emergencies -that's 128 pages of memory.

While technically true that data input/output to a swap *partition* is faster than to a swap *file*, one would be hard-put to measure the speed difference. Accessing a swapfile takes a bit longer as the file must be accessed as part of the filesystem instead of directly as a partition.

There are other scenarios which can cause OOM conditions other than those described above -every now and then the kernel may decide to swap a page or two out -even when there appears to be 'available' RAM.

Under any heavy swapping or OOM conditions the machine is definitely going to slow down.
Back to top
View user's profile Send_private_message 
mikeb


Joined: 23 Nov 2006
Posts: 8257

PostPosted: Wed 18 Sep 2013, 10:39    Post_subject:  

Hmm in one situation I did notice the kernel automatically killing processes to try and save ram space (firefox and then thunderbird disappeared)... might have been a slax kernel but not 100% on that. I assume puppy kernel do not have such an option set as hard loacking is what i usually get with them. Perhaps the killing processes should be included as standard since the makeup of puppy is more likely to use up ram than other more conventional systems.

swap in tmpfs...hmm so basically if the kernel can warn or kill automatically then this will happen while ram still exists even though ram is used for the swap space as the kernel will trigger its low ram mechanism(s)... is that the basic idea?

My swap calculation is usually swap = 1GB - real ram... or whatever the ideal working ram space is considered. Our 512mb machines have 512mb swap..the 1GB + ones I don't bother...seems to be ok with OUR usage. Its also worth seeing if applications can be tweaked or replaced to reduce ram usage..browsers come to mind..their usage is not set in stone.
Also..probably repeating myself..puppy can use ram for the filesystem so avoid filling it up needlessly in such configs.

mike

mike
Back to top
View user's profile Send_private_message 
sunburnt


Joined: 08 Jun 2005
Posts: 5032
Location: Arizona, U.S.A.

PostPosted: Wed 18 Sep 2013, 13:21    Post_subject:  

Yes, I`ve understood swap should be about approx. 2x the ram size.

I`ve wondered if the kernel`s swap code handled out-of-swap conditions gracefully.
As amigo says, no swap is terminally fatal. I had 256 MB and over 3 Firefox tabs was death.

But I still think that with at least 1 or 2 GB of ram, having no swap would be noticeably faster.
Having 4 GB of ram would seem to be best unless you`re a power user.

And coping Puppy`s main SFS file to ram may allow fast app. loading, but it`s a waste of ram.
.
Back to top
View user's profile Send_private_message 
mikeb


Joined: 23 Nov 2006
Posts: 8257

PostPosted: Wed 18 Sep 2013, 13:34    Post_subject:  

Quote:
And coping Puppy`s main SFS file to ram may allow fast app. loading, but it`s a waste of ram.

actually doing that along with the save avoids those dirty shutdowns... Wink

mike
Back to top
View user's profile Send_private_message 
gcmartin

Joined: 14 Oct 2005
Posts: 4298
Location: Earth

PostPosted: Wed 18 Sep 2013, 16:59    Post_subject:  

What Amigo shares is very accurate.

The OP's question on swap missing to hurt performance is contained in his answer.

On the other note, I have and continue to run FATDOG. For those who are unaware, the most recent release, OOTB, will NOT implement a SWAP whether or not it is present as either a partition or a file. Thus, to use SWAP, requires the users to know to turn it on.

I cannot detect ANY differences in desktop operations with or without the use of SWAP. The primary reason why: SWAP operations are handled as background operations. The systems (whether Linux/Unix/Macs/Windows/Mainframes) do NOT wait for RAM to fill before deciding to use RAM protect operations. This is the primary reason why it is advised and the primary reason, it is NOT noticed during system operations. If there exist some penalty, its not evident to the user or most system application operations. I always run with SWAP to provide the kind of protection that Amigo already has mentioned not to mention that I do NOT see a negative downside in my system's performance or its use.

There are some operations where a dedicated machine would want to have ALL the horse-power aimed for an application's operation. One I can think of is a PC dedicated to Music recording while a band is playing, live. There are probably some similar kinds of others, too.

Beyond that, the SWAP benefit is there, if used.

Hope this helps

_________________
Get ACTIVE Create Circles; Do those good things which benefit people's needs!
We are all related ... Its time to show that we know this!
3 Different Puppy Search Engine or use DogPile
Back to top
View user's profile Send_private_message 
sunburnt


Joined: 08 Jun 2005
Posts: 5032
Location: Arizona, U.S.A.

PostPosted: Wed 18 Sep 2013, 20:43    Post_subject:  

Hi mikeb; Yes, but probably only because Puppy`s scripts don`t handle it properly.
I`m sure it can be done without any problems, running in ram is no different really.

Hi gcmartin; There is of course a huge difference in the speed of ram compared to a HD.
In a SFS file test I copied a 500 MB folder and then an SFS file with the same contents.
Because the SFS file was smaller it`s "contents" copied almost twice as fast as the raw files.
It not only demonstrates how slow a HD is, but also what a big improvement a Squash file is.

If initrdfs used a compressed swap partition or file, then it`s be faster. But it doesn`t have one.

A Squash file in ram may be slower than raw files are as amigo ( I think...) pointed out.
But a Squash file does save approx. 3 times the ram as compared to raw files. No viruses too.
.
Back to top
View user's profile Send_private_message 
mikeb


Joined: 23 Nov 2006
Posts: 8257

PostPosted: Thu 19 Sep 2013, 05:32    Post_subject:  

The hijack bunnies are at it again Very Happy

Quote:
Hi mikeb; Yes, but probably only because Puppy`s scripts don`t handle it properly.
I`m sure it can be done without any problems, running in ram is no different really.

DEFINATELY don't handle it properly. Well it was either a total rewrite or use slax. (control has to be handed back to the initrd...with cpio thats not possible) Was much easier to have saves in ram. Having done that then puppy can run without any hard drives mounted and flash stick removed...dirty shutdowns simply cannot happen that way. I did add a couple of lines to unmount loaded sfs files at shutdown too in case apps were added while running. I suppose my pups are around the 100mb or less so don't take up as much room.
regards
mike
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 2 of 3 Posts_count   Goto page: Previous 1, 2, 3 Next
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1042s ][ Queries: 12 (0.0043s) ][ GZIP on ]