Visit Our UNIX and Linux User Community


Size of swap partition during installation


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Size of swap partition during installation
# 15  
Old 09-17-2009
Quote:
Originally Posted by Scrutinizer
Actually pseudo-swap is the default on HP-UX systems.
Granted.
Quote:
I think virtual swap or pseudo-swap is a terrible idea, especially if you make it the default.
Perhaps with HP-UX with which I have no recent experience but virtual swap was definitely an enhancement when it was implemented with other Unixes.
Quote:
It leads admins into thinking that they do not need to allocate swap space, while there are penalties involved in doing so.
I don't get why reserving virtual memory would be faster whether it is backed by disk or not. In both cases, the back-end device is not accessed anyway.
Quote:
It effectively means you are using memory for paging space, well basically you are marking pages as non-pageable.
Only if there is no more free swap space available. I'm afraid you are confusing reserving and allocating virtual memory. Reserving consume no RAM space. The pages on RAM will certainly be paged out to swap when needed.
Quote:
This part of memory will then fill up much more quickly than usual
This incorrect. RAM will be only allocated for accessed (read from/write to) pages and hopefully there is no difference between HP-UX and other OSes here.
Quote:
so in fact you are throwing away the benefit of demand-paging while keeping its downside.

Also what happens under load is that only a small part of memory actually gets paged out and if paging then occurs, then instead of a smooth transition it will be much more abruptly with the most recent processes taking the brunt.
I doubt that make any visible difference.
Quote:
In other words the system will waste copious amounts of memory and becomes less stable under load.
Only unused memory is wasted memory. As I already wrote, there is absolutely no difference between hp-ux and other Unixes regarding the RAM footprint of identical applications.
# 16  
Old 09-17-2009
I'm not sold on the idea of a "smooth transition" between swapping and not swapping in any case, unless some memory is reserved for disk cache. It's an interesting argument either way, but I believe we are getting distracted here... The system in question:
  1. Does not run HP-UX,
  2. Has a bit of a disk bottleneck.
Even if it has enough swap to hold all memory, loading it to the point where it needs it will hurt performance quite a lot. Unless it's load that he's testing, the demands on a test server shouldn't be that extreme.
# 17  
Old 09-17-2009
Quote:
Originally Posted by jlliagre
Granted.
Perhaps with HP-UX with which I have no recent experience but virtual swap was definitely an enhancement when it was implemented with other Unixes.
With Irix it means overcommitment of virtual memory, which can lead to stability issues. With SunOS/Solaris it means delaying paging decisions needed with the performance penalties I described earlier in stressful situations. That is just a design choice with pros and cons.
Quote:
I don't get why reserving virtual memory would be faster whether it is backed by disk or not. In both cases, the back-end device is not accessed anyway.
I was not referring to speed
Quote:
Only if there is no more free swap space available. I'm afraid you are confusing reserving and allocating virtual memory. Reserving consume no RAM space. The pages on RAM will certainly be paged out to swap when needed.
I am not confusing anything. I was talking about pseudoswap, where virtual memory that gets reserved actually gets preallocated. Pages in pseudoswap will not be paged out.
Quote:
This incorrect. RAM will be only allocated for accessed (read from/write to) pages and hopefully there is no difference between HP-UX and other OSes here.
It is not incorrect (see above). There is a big difference here.
Quote:
I doubt that make any visible difference.
Well I have witnessed it.
Quote:
Only unused memory is wasted memory. As I already wrote, there is absolutely no difference between hp-ux and other Unixes regarding the RAM footprint of identical applications.
There is for pseudoswap. For every other system that does not have enough physical paging space available the effect is similar, because virtual memory is limited and this typically means a large part of your RAM never gets used.

---------- Post updated at 03:18 PM ---------- Previous update was at 02:43 PM ----------

Quote:
Originally Posted by Corona688
I'm not sold on the idea of a "smooth transition" between swapping and not swapping in any case, unless some memory is reserved for disk cache. It's an interesting argument either way, but I believe we are getting distracted here... The system in question:
  1. Does not run HP-UX,
  2. Has a bit of a disk bottleneck.
Even if it has enough swap to hold all memory, loading it to the point where it needs it will hurt performance quite a lot. Unless it's load that he's testing, the demands on a test server shouldn't be that extreme.
I agree the discussion is becoming a bit broad here, HP-UX was not even directly relevant to the discussion but served as an example and we fanned out from there Smilie

My point was simply that if you do not have enough physical swap space, part of internal memory will never get used, simply because processes will not be allowed to start due to insufficient virtual memory. If you have more swap space, say equal to the amount if internal memory then this allows you to load more processes but typically this will still not lead to a situation where actual paging does occur. If you keep adding more swap space then this allows you to continue loading up to the point where actual paging does start to occur. A little bit of paging does not hurt performance, but obviously if the pageout rate starts to become significant then this will gradually start to slow down the system. But you can simply control this situation by running fewer programs.

At least you have a choice then, which is not the case if you do not have enough swap space.

S.
# 18  
Old 09-18-2009
Quote:
Originally Posted by Scrutinizer
My point was simply that if you do not have enough physical swap space, part of internal memory will never get used, simply because processes will not be allowed to start due to insufficient virtual memory.
Okay, I finally get your point. This is however only true if the reserved but unused space is larger than the swap area. What I observe typically is much less than the 100% overhead you assume is the rule but that definitely depends on the applications. Moreover, reserved memory might eventually be used so overcommitment is risky.
Quote:
If you have more swap space, say equal to the amount if internal memory then this allows you to load more processes but typically this will still not lead to a situation where actual paging does occur. If you keep adding more swap space then this allows you to continue loading up to the point where actual paging does start to occur.
Paging will not start because you added more swap space. Paging starts when you use more vm than available ram. You can definitely have a system with say 16 GB of RAM and 4 GB of swap space already paginating.
Quote:
A little bit of paging does not hurt performance, but obviously if the pageout rate starts to become significant then this will gradually start to slow down the system.
Agreed.
Quote:
But you can simply control this situation by running fewer programs.
If possible, otherwise by adding RAM.
Quote:
At least you have a choice then, which is not the case if you do not have enough swap space.
We all agree it is unwise not to have enough swap space. The question is how much is enough and this can only be computed by observing the real peak memory load on the target system.

Here is an example of what my current desktop server running Solaris 10 is using:
Code:
$ prtconf|grep Memory
Memory size: 98304 Megabytes
$ swap -s
total: 46772240k bytes allocated + 10906200k reserved = 57678440k used, 78826904k available
$ swap -l
swapfile             dev  swaplo blocks   free
/dev/md/dsk/d1      85,1      16 110389232 110389232
$ kstat -n system_pages
module: unix                            instance: 0
name:   system_pages                    class:    pages
        availrmem                       11396580
        crtime                          167.7376366
        desfree                         96384
        desscan                         25
        econtig                         189792256
        fastscan                        1208043
        freemem                         5077669
        kernelbase                      16777216
        lotsfree                        192769
        minfree                         48192
        nalloc                          47014483
        nalloc_calls                    18457
        nfree                           35438548
        nfree_calls                     13223
        nscan                           0
        pagesfree                       5077669
        pageslocked                     926678
        pagestotal                      12337245
        physmem                         12358884
        pp_kernel                       855340
        slowscan                        100
        snaptime                        2237826.3211812

That translates to:
The box has 96 GiB or RAM and 53 GiB of swap space (55% of RAM size).
The total virtual memory is 130 GiB wich means 19 GiB are used by non VM stuff (locked pages, kernel pages, unusable memory).
57 GiB of RAM are used which means is 39 GiB are still available for applications.
Although being reported as free, some of these 39 GiB are in fact used by the kernel as file cache.

46 GiB of virtual memory is in use while 10 GiB are reserved. This is the typical ratio I observe (between 10 to 30%). There would be absolutely no benefit (but no harm either) if the swap space was raised from 53 to 96 GiB on that server like you recommend. The current swap is large enough with a wide margin to allow the OS to use the 39 GiB of RAM still available and should more memory be required by applications, the system will start to paginate on disk even while the swap area is smaller than the RAM size.

Last edited by jlliagre; 09-18-2009 at 11:44 AM..
# 19  
Old 09-18-2009
Quote:
Originally Posted by Scrutinizer
My point was simply that if you do not have enough physical swap space, part of internal memory will never get used, simply because processes will not be allowed to start due to insufficient virtual memory.
This cannot be true. I regularly boot linux livecd's that come online with no swap whatsoever. Swap isn't needed unless swapping actually happens.

Last edited by Corona688; 09-18-2009 at 01:04 PM..
# 20  
Old 09-18-2009
You are correct however Scrutinizer and I somewhat derailed the discussion toward HP-UX and Solaris behaviors.
Linux, which is definitely on topic in this thread, is different as it overcommits memory. That means it doesn't care if allocation can be fulfilled when initially asked for by the program, unlike the Unix versions we were talking about.
# 21  
Old 09-18-2009
Trivial to disable. echo 2 > /proc/sys/vm/overcommit_memory ; echo 100 > /proc/sys/vm/overcommit_ratio

But it's useful, as just demonstrated; there's plenty of environments that don't have disk space to throw away like that. And somehow the world never ended from it despite all predictions Smilie No OS can run anything without sufficient memory, in the end it's just another strategy.
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #297
Difficulty: Easy
Linux Mint can be booted and run from a USB flash drive on any modern computer capable of booting from a USB drive.
True or False?

10 More Discussions You Might Find Interesting

1. Solaris

/tmp size is less whereas size allocated to swap is more

Hi, the /tmp size is less whereas the size allocated to swap is quite big. how to increase the size of /tmp - #: swap -l swapfile dev swaplo blocks free /dev/md/dsk/d20 85,20 8 273096 273096 #: swap -s total: 46875128k bytes allocated + 2347188k reserved =... (2 Replies)
Discussion started by: psb74
2 Replies

2. HP-UX

Could I mount a swap/dump partition on /tmp?

Hey Guys. Let show our disk-mapping structure on HP-UX B11.11 with df : # df /home (/dev/vg00/lvol5 ): 18979652 blocks 1224395 i /opt (/dev/vg00/lvol4 ): 120276192 blocks 1894100 i /var (/dev/vg00/lvol6 ): 19380328 blocks ... (3 Replies)
Discussion started by: aggadtech08
3 Replies

3. Filesystems, Disks and Memory

Partition 1 swap not mounting ?

Hi, running mount, I get the following, no part1 swap as part1 swap has been created and is listed below. System works fine anyway. As I cannot unmount part1, what is a standard procedure to make part1 on. Jack ============= .. $ free total used free shared buffers cached Mem:... (2 Replies)
Discussion started by: jack2
2 Replies

4. Solaris

swap partition showing mounted in df -h

Dear All Anyone can help me what is the problem of swap partition? swap partition is showing mounted in df -h command output. Regards prakash (1 Reply)
Discussion started by: pshelke
1 Replies

5. Linux

How to give UUID to a swap partition?

Dear Folks Is there anyway to give a UUID to a swap partition? mkswap on CentOS 5 (util-linux-2.13-0.45.el5_1.1) appears to override this option ;-( # swapoff -a # mkswap -L swap1 /dev/sda3 Setting up swapspace version 1, size = 4293591 kB LABEL=swap1, no uuid And there's no... (3 Replies)
Discussion started by: Santi
3 Replies

6. Linux

swap partition?

What does a swap partition do exactly? I was messing arround with a linux machine at my school and i deleted the swap partition using fdisk and then rebooted the machine and it worked fine and wrote a swap partition back in...lol. Is it a nessary part of the OS to use that partition? (7 Replies)
Discussion started by: byblyk
7 Replies

7. UNIX for Dummies Questions & Answers

Linux/Windows Fat32 Swap partition.

I run a dual boot WinXP/Red Hat 8 system on my laptop. Since my hard drive is inherently small(laptop) I am trying to creat a swap partition for keeping mutually used files such as music/video etc... I have created a 2.5GB Fat32 partition with Partition Magic Pro and have windows recognizing the... (2 Replies)
Discussion started by: djtrippin
2 Replies

8. UNIX for Dummies Questions & Answers

Size of swap

Hy all, i've a little problem with the size of the swap. I've an old solaris machine, with 4Go, and swap is taking 500Mo for only 1% used at any time. So : how can i change this size without problems ????? (ok it may be a stupid question, but it's a real problem when you lose about 1 or 2... (3 Replies)
Discussion started by: Olivier
3 Replies

9. UNIX for Dummies Questions & Answers

Linux Swap Partition

How big do I set the swap partition when i'm setting up my hard drive to install RedHat. (Using Partition Magic) thanks! primal (2 Replies)
Discussion started by: primal
2 Replies

10. UNIX for Dummies Questions & Answers

Swap Partition Space

first of all, sorry about my english...Im a spanish newbie to this marvelous OS and i have just a couple of doubts...u know? :-) 1) how big should my swap partition be if i installed debian 2.2r3 or FreeBSD 4.x on a AMD k7 1400Mhz with 512Mb of Random Access Memory? i heard that those OS... (1 Reply)
Discussion started by: I[X]ION
1 Replies

Featured Tech Videos