Please advise good source of info about swapping


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Please advise good source of info about swapping
# 8  
Old 03-28-2012
It doesn't make swap necessary. Virtual memory makes swap possible because the OS can leave triggers for itself when certain memory is used, i.e. automatically pausing a process and sending a request to the OS when the process attempts to access a swapped-out page. The ability to flag and reorder memory as you please makes other things possible too, like read-only memory, shared memory, and mapped files...

Whether swap is necessary and how much depends on the UNIX. The behavior when the system runs out of memory also depends on the UNIX.

I don't agree that no swap is advisable. Swap is your safety buffer. And depending on how you configure it, may not be that slow either. If you put it on the same spindle as your applications it'll naturally be slow...
# 9  
Old 03-28-2012
1) The O/S will do necessary paging as processes are created and die. If you have no swap, memory will become fragmented.

2) You should never set the swap size to zero because the O/S still needs to shuffle pages around in the background. While you are tuning Oracle you need substantial leeway and I would have swap at least the same size as memory to allow for future expansion, unexpected peaks and configuration mistakes. I'd rather have the system run slow than crash.

Oracle makes extensive use of O/S Shared Memory and you must allow memory for this and build the kernel correctly.

Most unix O/S dedicate 25% of memory to disc buffers by default. You either allow for it or change the kernel parameters. If the system only ever runs Oracle then there is much scope to give memory to Oracle disc buffers.
Many Oracle DBAs don't allocate enough memory for table sorts in the SGA.

There are huge and comprehensive manuals from Oracle regarding sizing and tuning on each different O/S. In my experience Oracle will never run properly straight out of the box.

3) Yes if you have 8Gb RAM and 8Gb swap the most virtual memory you could ever use is 16Gb.
There was a historic requirement to have a minimum swap of the same size as memory and older unix would not let you use any physical memory above that point. There was no mirroring, but swap was also used for dump in the event of a system crash and it had to be big enough. That rule has been relaxed on some modern O/S.
Older unix did indeed recommend creating swap at 2x or even 3x memory and swap was used for storing idle processes on heavily loaded systems (but it was slow if any active processes got displaced into swap).

Last edited by methyl; 03-28-2012 at 02:22 PM..
# 10  
Old 03-29-2012
Guys, thanks for your valuable comments.

Could you please also comment:
1) If soft does NOT feet all available RAM - should swap be free or not?
As I understood - not, because it should solve memory defragmentation?
Is it right?

2) If you see that your host has 64Gb of RAM, has 32 Gb of allocated swap (full available swap is 64Gb for example) - is it problem?

3) vmstat shows pi po - does it indicate a problem?

4) How to determine that host is having problem with the swap?

---------- Post updated at 04:28 AM ---------- Previous update was at 04:16 AM ----------

May I ask about the windows. I know that this forum is about unix, but the question is related with the conversation about swap concept.

I am seing in task manager physical memory 2Gb, available 200K. Page file usage 2,35Gb and this is the line not changed in the time on the chart in task manager.
Why swap usage is 2,35Gb. Is it allocated_but_not_used size?

---------- Post updated at 04:55 AM ---------- Previous update was at 04:28 AM ----------

an example (vmstat Solaris 10):
Code:
 kthr      memory                       page               disk          faults      cpu
 r b w   swap      free      re   mf  pi po fr de sr m0 m1 m3 m4   in   sy      cs   us sy id
 0 5 0 124949008 30882168   1830 11959 0 2  2 0  0  0  0  0  0   51824 522265 65491 31 12 56
 0 3 0 124837640 30861096   1755 8975  0 1  1 0  0  0  0  0  0   47055 499749 56455 33 14 53
 0 3 0 124908888 30861088   1770 10615 6 1  1 0  0  0  0  0  0   47026 487126 57109 37 15 48
 0 2 0 124908920 30847944   1698 9732  0 3  2 0  0  0  0  0  0   45622 497099 56097 34 11 55
 0 2 0 124942672 30873432   1909 11107 0 1  1 0  0  0  0  0  0   43191 504910 50763 34 12 55
 0 2 0 124918896 30856128   1518 8609  0 1  1 0  0  0  0  0  0   46034 516341 55213 34 11 56
 0 4 0 124871216 30823384   1661 9245  0 0  0 0  0  0  0  0  0   47537 531603 57644 35 12 53
 0 5 0 124867672 30831888   1678 10591 2 2  2 0  0  0  0  0  0   43464 530756 52283 33 13 54

Why swap != 0 ? And why swap is changed in time when free memory 30Gb ?

Last edited by sant; 03-29-2012 at 07:18 AM..
# 11  
Old 03-29-2012
1) Yes.

2) Not necessarily. It only matters if active tasks are being swapped out. It would be a very serious problem if say your database engine was beings swapped out. If all that is swapped out is idle user sessions, it is pretty harmless.

3) Interpretation of vmstat is system specific. Paging is really only an issue if the system actually runs slowly. Paging figures in vmstat can seem high on a modern fast system with fast discs with no detrimental effect whereas the same figures on an older slower system would indicate a serious problem. You need to monitor your system over an extended period of time to determine what is "normal".
Beware of overmonitoring. I've seen a system brought to its knees by C.A. Unicenter software. Good old unix "sar" is still a useful tool when configured correctly.
In an Oracle environment you can get much useful performance information from the database statistics.

4) Apart from the obvious where the system feels slow or even stops dead for several seconds, there are many other warning signs. I/O queue for discs (especially one containing a swap partition) is one. A severely overloaded unix system will log errors in system logs and start killing off tasks to prevent a crash.

5) Windows is highly version specific. Always mention the version.
Most of them allocate page file space to roughly match the size of the running programs plus any overload. Some of the paging technology came from Xenix (an old unix which Microsoft owned for a while) but unix has advance somewhat since.
The figures you post suggest that the Windows system is short of physical memory by about half a Gigabyte.

6) A vmstat running for a few seconds is totally meaningless. What command did you type?
The system will be using swap space to shuffle pages in memory and to page in/out idle pages.
On the system in question is all the swap on disc, or is some of it in memory?


Unless the computer needs to do some serious number crunching we always go for larger memory and faster discs, but fit multiple slower CPUs to keep the costs down.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Solaris

Swapping

Hi Guys I am using SPARC-T4 (chipid 0, clock 2998 MHz), SunOS 5.10 Generic_150400-38 sun4v. How do I see if the server was doing some swapping like yesterday? I had a java application error with java.lang.OutOfMemoryError, now I want to check if the server was not doing some swapping at... (4 Replies)
Discussion started by: Phuti
4 Replies

2. Solaris

Secondary group info source

Experts, I know when I use id it shows only the primary group information for the given user, and that info comes from passwd file. When I use groups it shows all groups user are member of, however from where come information given by groups command? grep fmtt3990 /etc/passwd... (6 Replies)
Discussion started by: fmattos
6 Replies

3. UNIX for Dummies Questions & Answers

Good source of X11 programming info?

Is there a good book or something on practical programming in X11? I have the O'Reilly X window system book set. They don't seem to cover the nuances very well (at least for me). So far the only thing I find on the web is the text from these books. Specifically, I'm looking for optimization... (2 Replies)
Discussion started by: willil
2 Replies

4. UNIX for Advanced & Expert Users

source reader info

Hi friends, I urgently need to know if there is any tool called source reader in C or Unix or Linux...... If so ..plz let me know the details.I am running out of time..... (0 Replies)
Discussion started by: vijaya2006
0 Replies

5. SuSE

Swapping

Hello! Why does my SuSE GNU/Linux machine swap? I have a Gig of ram, currently 14MBs of free RAM, 724MB - buffers and caches... That is 685MB of cached RAM, then kernel really should'nt have to swap, It should release cached memory in my thinkin... It has only swaped 3MB's but still,... (3 Replies)
Discussion started by: Esaia
3 Replies

6. AIX

Good source of AIX Specific Scripting?

Hi everyone, I need to write some AIX scripts (ksh?), kind of fast so I'm looking for somewhere to get a crash course in it. Are there any AIX Specific Scripting resource sites that anyone can recommend, really not getting a whole lot from google. Thanks in advance, Darren (3 Replies)
Discussion started by: dbridle
3 Replies

7. UNIX for Dummies Questions & Answers

how to get swapping info

Hi How can I determine if swapping is occuring on a server. Thanks, Leo (2 Replies)
Discussion started by: leo
2 Replies
Login or Register to Ask a Question