Swap memory issue


 
Thread Tools Search this Thread
Operating Systems Linux Swap memory issue
# 1  
Old 03-10-2014
Swap memory issue

Hi,

In our production box i can see the Swap space using the below command
Code:
 free
             total       used       free     shared    buffers     cached
Mem:      65963232   41041084   24922148          0     877160   35936292
-/+ buffers/cache:    4227632   61735600
Swap:      4192880    1915204    2277676

I heard in forums SWAP space should be double the size of RAM or atleast half of it.

Also with TOP command and sorted on Swap i got the below output
Code:
13554 db2inst1  18   0 5648m 473m 463m S  0.0  0.7  13:38.10 5.1g db2sysc
 1979 root      21   0 2880m 1.5g  30m S  0.0  2.4  28:39.52 1.3g java

The first two entries itself will add up above 6GB
How come one command shows the SWAP as less than 4GB and the top command show as used more than 6GB.

We had few performance issue in the prod box. trying to analyse some good practice on memory setup

Code:
uname -a
Linux XXXXXXXXXX 2.6.18-308.4.1.el5 #1 SMP Wed Mar 28 01:54:56 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux

NOTE: swappiness is 60
# 2  
Old 03-10-2014
Show the parameters of the top command you used as well as the column headings for it.

FYI: I looks like you have approx 65 GB of ram and 4GB of paging space. Most swap specifications I have ever seen depend upon the total amount of memory in the system...so it's never "always half" or "always double".
# 3  
Old 03-10-2014
Quote:
Originally Posted by ratheeshjulk
I heard in forums SWAP space should be double the size of RAM or atleast half of it.
These are just thumb rules to start with. The real rule is simple, the swap should be large enough to avoid being out of swap and might be much larger with no negative effect. This is essentially unrelated to the RAM size but definitely related to the sum of the memory required by all running applications.
Quote:
The first two entries itself will add up above 6GB
How come one command shows the SWAP as less than 4GB and the top command show as used more than 6GB.
Top swap column shows the amount of non resident address space. It doesn't need to reside on the swap area but might simply be on memory mapped plain files.
This User Gave Thanks to jlliagre For This Post:
# 4  
Old 03-11-2014
Quote:
Originally Posted by jlliagre
These are just thumb rules to start with. The real rule is simple, the swap should be large enough to avoid being out of swap and might be much larger with no negative effect. This is essentially unrelated to the RAM size but definitely related to the sum of the memory required by all running applications.
Top swap column shows the amount of non resident address space. It doesn't need to reside on the swap area but might simply be on memory mapped plain files.
During the peak of our batch we will have lot of processes trying to access the resources. during this time Swap space reach 100% and even after all the process completed the swap space will not come down below 40%.
we will process nearly 100GB of data during this time, not sure how much will go through memory or not.

---------- Post updated at 09:54 AM ---------- Previous update was at 09:51 AM ----------

Quote:
Originally Posted by blackrageous
Show the parameters of the top command you used as well as the column headings for it.

FYI: I looks like you have approx 65 GB of ram and 4GB of paging space. Most swap specifications I have ever seen depend upon the total amount of memory in the system...so it's never "always half" or "always double".
This is the top command result with the header and first two lines which use the most of the swap space.
Code:
top - 09:52:55 up 5 days,  3:54,  8 users,  load average: 0.07, 0.08, 0.25
Tasks: 466 total,   1 running, 465 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.1%us,  0.1%sy,  0.0%ni, 99.9%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  65963232k total, 51535512k used, 14427720k free,   807228k buffers
Swap:  4192880k total,  2397768k used,  1795112k free, 46612976k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU SWAP %MEM    TIME+  COMMAND
13554 db2inst1  18   0 5650m 510m 497m S  0.0 5.0g  0.8  20:23.87 db2sysc
 1979 root      21   0 2880m 1.6g  29m S  0.0 1.2g  2.5  33:43.26 java

# 5  
Old 03-11-2014
Quote:
Originally Posted by ratheeshjulk
Also with TOP command and sorted on Swap i got the below output
Code:
13554 db2inst1  18   0 5648m 473m 463m S  0.0  0.7  13:38.10 5.1g db2sysc
 1979 root      21   0 2880m 1.5g  30m S  0.0  2.4  28:39.52 1.3g java

The first two entries itself will add up above 6GB
The virtual addresses add up to about 6 GB. The resident memory is about 2 GB.

If a program allocates a 5 GB array its virtual address space utilization instantly increases by 5 GB because addresses must be assigned to all 5 GB. But the OS is not stupid enough to instantly dedicate 5GB of physical memory to that array. As the program actually uses the array the OS will allocate memory page by page.

And think about a program like vim. It's a huge program with many features but most of us don't use them all. As we use features in vim, if the code is already in core, fine. Otherwise a page fault is generated and a page is read in. vim page-faults just enough stuff into core to do what we want. The rest stays on disk.
This User Gave Thanks to Perderabo For This Post:
# 6  
Old 03-14-2014
The problem was , when our batch was running on its peak, as i told all the resources cpu, memory and swap space were reaching 100%, and finally system become unresponsive.
later we increased the swap space , and for last few days we were observing the swap space was never even reaching 1GB and RAM is steady.
Could you please explain when Swap memory will be used. Will Swap memory be used only when Ram is full..
Want to really understand whether the increase in swap space would have reduced the issues with our process
# 7  
Old 03-15-2014
If the CPU is fully utilized, the performance slow down linearily with the extra load.
If the RAM is fully utilized, SWAP will start to be used. The performance might slow down much more intensively with the extra load, but this will really depend on the active set. There are situations where the performance won't be significantly hurt.
If the SWAP if fully utilized, applications will randomly crash.

There is a common misconception that having a large SWAP area has an adverse effect on performance. This is incorrect, having too little RAM is a serious cause of performance issues. Having too large a swap is a safe configuration.
This User Gave Thanks to jlliagre For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

SWAP memory

Admins, How can I configure the server so that it will utilize the swap file as little as possible? Please correct me if I'm wrong, I would say change the value of sysctl - vm.swappiness? And if, how can I keep it permenatly even after rebooting the system? since no related parameters in... (7 Replies)
Discussion started by: leo_ultra_leo
7 Replies

2. Red Hat

Swap memory

Hi team, Is there any ability to force the system to use the swap memory for a specific service? And prevent another service of using the swap memory? Thanks (2 Replies)
Discussion started by: leo_ultra_leo
2 Replies

3. HP-UX

How much Swap memory do i have ?

here is the output of swapinfo command ==> swapinfo Kb Kb Kb PCT START/ Kb TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME dev 8192000 0 8184000 0% 0 - 1 /dev/vg00/swap reserve - 8184000 -8184000 memory ... (5 Replies)
Discussion started by: mohtashims
5 Replies

4. UNIX for Dummies Questions & Answers

Threshold for swap memory

hi guys the monitoring team is using a tool for monitoring linux boxes and they set an alarm for swap memory to 10%(critical) I really has no idea when swap memory usage is high.... Can someone recommend me a threshold for this? when is warning or critical and this parameters can affect... (3 Replies)
Discussion started by: karlochacon
3 Replies

5. Solaris

No Space Left - Memory/Swap issue

:wall:I'm having a bit of a problem with Solaris 10u8 and one of our applications requesting memory and being told, "no space left". The break down: 24GB Physical Memory 8GB swap at the time of occurance, here's what a memory breakdown looks like: Page Summary Pages ... (21 Replies)
Discussion started by: aychbee45
21 Replies

6. UNIX for Dummies Questions & Answers

swap memory

Hi, I want to see used swap memory I know that for this there is command free -m but this shows Swap: 16383 4529 11854 by top command while load is 1.05 max CPU % 24 mysqld why used swap shows 4529 either it is not flushed there is other command... (2 Replies)
Discussion started by: kaushik02018
2 Replies

7. UNIX for Advanced & Expert Users

Issue with insufficient swap or memory space

Hi, When I execute one of my shellscript I am getting the below mentioned error message .This application takes 2input files which have the records counts 26463 and 1178046 exec(2): insufficient swap or memory available. exec(2): insufficient swap or memory available. exec(2): insufficient swap... (3 Replies)
Discussion started by: kavithakuttyk
3 Replies

8. Shell Programming and Scripting

Issue with insufficient swap or memory space

Hi, When I execute one of my shellscript I am getting the below mentioned error message .This application takes 2input files which have the records counts 26463 and 1178046 exec(2): insufficient swap or memory available. exec(2): insufficient swap or memory available. exec(2):... (2 Replies)
Discussion started by: kavithakuttyk
2 Replies

9. Solaris

swap memory

Hi Can any help me on setting the swap memory ? I would like to set swap memory for installing oracle 9i software. RAM - 512 Mb HDD - 40 Gb OS - Sun Solaris 5.9 (6 Replies)
Discussion started by: sivaramat
6 Replies

10. Filesystems, Disks and Memory

Total Memory/Swap Memory

I need to put a program together to determine the total, available memory and total and available swap on unix machines. I have been searching for weeks and I seem to run into dead ends. Every unix platform I look at has a different way to determine memory info. Any sugggestions or new... (4 Replies)
Discussion started by: ghe1
4 Replies
Login or Register to Ask a Question