Questions tagged [swap]

Linux divides its physical RAM (random access memory) into chucks of memory called pages. Swapping is the process whereby a page of memory is copied to the preconfigured space on the hard disk, called swap space, to free up that page of memory. The combined sizes of the physical memory(RAM) and the swap space is the amount of virtual memory available. Linux has two forms of swap space: the swap partition and the swap file.

From linux.com All about swap space:

Linux divides its physical RAM (random access memory) into chucks of memory called pages. Swapping is the process whereby a page of memory is copied to the preconfigured space on the hard disk, called swap space, to free up that page of memory. The combined sizes of the physical memory and the swap space is the amount of virtual memory available.

Swapping is necessary for two important reasons. First, when the system requires more memory than is physically available, the kernel swaps out less used pages and gives memory to the current application (process) that needs the memory immediately. Second, a significant number of the pages used by an application during its startup phase may only be used for initialization and then never used again. The system can swap out those pages and free the memory for other applications or even for the disk cache. However, swapping does have a downside. Compared to memory, disks are very slow.

Linux has two forms of swap space: the swap partition and the swap file. The swap partition is an independent section of the hard disk used solely for swapping; no other files can reside there. The swap file is a special file in the filesystem that resides amongst your system and data files.

Swap space size should be either similar to system RAM or double it's size.

340 questions
4
votes
4 answers

Who is using the swap memory and why?

My database server is using 191MB of swap space - but also shows 182MB of free RAM The box is a dedicated MySQL server, running Debian Lenny. How can I determine who and why is filling the swap space instead of using the free RAM?
Miko
  • 1,709
  • 4
  • 22
  • 28
4
votes
1 answer

Swap file for a Hyper-V host

We have a machine running Windows 2008 Enterprise with the Hyper-V Server role. The machine has 48 GB of RAM, and a RAID1 of just 74 GB. The VMs are stored on a SAN. My question is, does the Hyper-V host server itself need a big swap file for…
andreialecu
  • 237
  • 1
  • 2
  • 9
4
votes
4 answers

System swapping ... how do I figure out what the problem is

I have an ubuntu vps running that has about 300MB of memory, of which only 20% or less is free right now ... My question is, how can I figure out what particular program I'm running that is causing it to swap so much?
trustfundbaby
  • 205
  • 2
  • 3
  • 9
3
votes
2 answers

Is swap compression in RAM (ZSWAP) benefitial on a Linux server with SSD drives?

I am trying to improve performance (responsivity) of a webserver during rare events of high memory utilization (90%...) where it starts to swap a lot, in order to help manual intervening faster and less error prone. I can't add more RAM to the…
Ján Lalinský
  • 262
  • 1
  • 10
3
votes
2 answers

Is adding Swap on a server with an SSD discouraged?

In this tutorial Digital Ocean explain how to enable swap on Ubuntu 14.04. I arrived at this article after experiencing some issues with my server and this looked like it could help. However, they preface the article with a warning that dissuades…
Jack Roscoe
  • 133
  • 4
3
votes
1 answer

Centos clear swap usage

I got nagios monitoring and it is picking up high swap usage on a specific server. The user is using some application which triggers the high swap. Even after they quit the application, top still shows high swap used. I've tried using swapoff -a and…
lbanz
  • 1,579
  • 4
  • 18
  • 30
3
votes
2 answers

Server using swap with plenty resources left

I have a Centos 7 with a swap of 256 MB. I have at least 1GB o free RAM memory all the time and my CPU never gets over 60% of usage. But anytime I check the swap use it's using about 200 MB! My Swappiness is 30 and everything is running smoothly.…
Gil
  • 39
  • 2
3
votes
2 answers

Swap memory exhausting server even site has small visitors

I have CentOs 6.5 running on a 32bit VPS host. It is running only php-fpm, nginx, and mysql. I have a site that gets on average 20 visitors per day, but I am recently getting this message from my host provider. This is an automated notification to…
robue-a7119895
  • 167
  • 1
  • 8
3
votes
4 answers

Windows swap file: why do I have a 3GB swap file when I have 8GB RAM?

Here is my system info: I built a DIY system with the expectation that there wouldn't be any need for a swap file, yet there it is, 3340MB. Can anyone explain this? Is it really anything I should be concerned about? In case this matters:
user16542
3
votes
5 answers

Swap space getting used

I am having a system with 8GB of RAM and running mysql on it ,top command shows Mem: 8124416k total, 8110004k used, 14412k free, 21292k buffers Swap: 8388600k total, 1712132k used, 6676468k free, 2058600k cached vmstat 1 gives this…
Pankaj Joshi
3
votes
1 answer

Limiting memory usage and minimizing swap thrashing on Unix / Linux

I have a few machines that I machine that I use for running large numbers of jobs where I try to limit the number of jobs so as not to exceed the available RAM of the machine. Occasionally I mis-estimate how much memory some of the jobs will take,…
camelccc
  • 255
  • 1
  • 15
3
votes
3 answers

Disadvantages of a large swap partition

I'm aware that there is a huge performance decrease when using swap memory, but if you have wasted hard drive space is there any disadvantages to having (hopefully not using) a large swap partition?
John Wheal
  • 456
  • 5
  • 17
3
votes
2 answers

Why is my KVM, RHEL6.2 server swapping?

I have a RHEL6.2 server that I'm using to run KVM virtual machines. The server itself has 16 GB of RAM. I want to see the biggest VM I can run on it and not let the qemu-kvm process swap. The VM ram is ~15GB. (Yes, I realize that this is pushing…
Michael Closson
  • 211
  • 1
  • 4
  • 10
3
votes
1 answer

Force process pages to get unswapped

I started 4 processes doing heavy computations. The machine has 4 full cores, and each process is single-threaded, so they don't compete for CPU. However I realized that they require more memory than physically exist in this system (16GB). Now their…
liori
  • 737
  • 3
  • 14
3
votes
3 answers

top reports swap at 100%, free memory available

On RedHat 5 servers, we see top reporting swap has 0k free. vmstat shows the same amount of swap used, but no paging. We kill our only app, and top still reports 100% of swap used. If we reboot, swap goes to 0k used. Any comments: am I…
cvsdave
  • 141
  • 5