Linux.com

Home Linux Community Forums Linux System Administration System Management Swap space is never used, are my settings correct

Swap space is never used, are my settings correct

Link to this post 30 Sep 10

I'm on GNU/Linux and top command always show that swap space is always 0k used!
How to make sure that its used. I changed its priority from -1 to 1. Its still not used.
Please help me out.

Following are the various stats:

<<<<<<<<<<<<<<<<<<<<<<
top - 04:30:55 up 1 day, 1:35, 2 users, load average: 1.04, 0.47, 0.46
Tasks: 106 total, 2 running, 104 sleeping, 0 stopped, 0 zombie
Cpu(s): 1.0% us, 3.4% sy, 1.3% ni, 85.2% id, 6.4% wa, 0.0% hi, 2.7% si
Mem: 3089396k total, 1954548k used, 1134848k free, 157268k buffers
Swap: 2031608k total, 0k used, 2031608k free, 1290560k cached

%cat /proc/sys/vm/swappiness
60

%swapon -s
Filename Type Size Used Priority
/dev/mapper/VolGroup00-LogVol01 partition 2031608 0 1

# cat /etc/fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
/dev/hda /media/cdrom auto pamconsole,exec,noauto,managed 0 0
/dev/fd0 /media/floppy auto pamconsole,exec,noauto,managed 0 0
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Link to this post 30 Sep 10

Your results are showing that you have 3G of RAM which is more than enough for most basic tasks, in most cases swap is used as overflow when you exceed your RAM space. I do not understand why you would want to use swap instead of RAM, but you can change the priority by changing your swappiness value, the higher the value (up to 100) the greater potential for swap to be used.

In my case with my desktop which has 4G or RAM, I only use swap space when I am running virtual machines.

Link to this post 01 Oct 10

Thanks for the help.

More background: This machine is a server machine. There are seven to eight other client machines in the intranet which copies data from this server; upto 400MB data is copied by each client. Each client continously writes data to the server machine. So it may happen that 400MB * 7; this much data is transferred from the server!!! Plus non-stop writes to server!!

Problem: Many times, when the client machine is trying to access html pages via the browser, it takes few minutes (upto 5 minutes) to deliver the data. For this slowness I suspected that since the swap space is not used we are getting this slow response.

I want to know how to improve the performance and if unused swap space is the cause.

Link to this post 01 Oct 10

The RAM has much greater response speed than the swap, with that being the case I do not think that is the bottleneck, I think it is most likely related to available cpu cycles.

You can try increasing the swappiness to see if that will improve performance. But I think the bottleneck could be in the cpu scheduling, a network bottleneck or even an issue with the disk performance. Since this is a production server it would not be best to just start changing things, you need to run some logging and conduct some research before implementing a change or you will risk creating greater performance issues.

If you can confirm that the issue is a full cpu during these long wait times, then you would want to use the renice tool to change cpu priorities for applications to give your web services greater priority. http://www.linux.com/archive/feed/58638

If the issue is a network issue then you must look at replacing the low throughput hardware to allow more traffic to pass to the server.

After the information you posted about the delay I would interested in seeing exactly what is causing that kind of a delay, so please keep us updated on what you try and what you find.

Link to this post 02 Oct 10

Another posibility is a bottle neck at the bus with the drives. If you are really reading and writing that much data simultaneously to that machine, the drives and the bus that the drives are on may not be able to keep up.

Sources of a network bottle neck can be anythng from the switch being used in the LAN, to improper cabling (e.g. too much untwisted where it was crimped), to the bus into which the network card is plugged. Consider for example, a 1000baseT card plugged into a PCI bus. A PCI bus will NOT move data at 1000bps ....

Link to this post 02 Oct 10

I tried changing the swapiness to 100 but it did not showed any swap usage via top; although I'm waiting for observing it when same problem is seen again. I'll check if its a full CPU issue and record top details with full load.

Another thing is that this particular server is a VM. (sorry, forgot to mention this earlier). I'll keep updating.

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board