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
5
votes
5 answers

How much swap do you allocate for your Solaris server?

I'm still seeing system administrators using the old rule of thumb that swap should be double the memory, even in servers with 32GB of memory. These systems have relatively expensive disks (shipping with 200GB drives) and allocating 64GB of that to…
Andre Miller
  • 222
  • 5
  • 10
5
votes
2 answers

Linux swap not used, even when OS run out of memory

The swap is at low usage, and the OS sometime run out of memory and start scarifying processes swapon -s Filename Type Size Used Priority /dev/vda1 partition …
Nabil Sham
  • 267
  • 1
  • 2
  • 9
5
votes
2 answers

How is my server hitting swap?

Here is the summary from 'top' command top - 20:14:50 up 18 days, 23 min, 1 user, load average: 0.22, 0.20, 0.18 Tasks: 99 total, 1 running, 98 sleeping, 0 stopped, 0 zombie Cpu(s): 1.1%us, 0.1%sy, 0.0%ni, 94.2%id, 3.5%wa, 0.0%hi, …
nano
  • 173
  • 1
  • 4
5
votes
1 answer

BIND 9.10 constantly killed on FreeBSD 10.0 with out of swap space

In one of our slave DNS servers BIND, version bind910-9.10.0P2_3, constantly get killed with the following message in /var/log/messages: Jul 30 01:00:10 cinnabar kernel: pid 602 (named), uid 53, was killed: out of swap space This service runs on a…
Vinícius Ferrão
  • 5,400
  • 10
  • 52
  • 91
5
votes
1 answer

Mysterious swap usage on EC2

We're in the middle of a project to move our infrastructure from a co-lo situation into Amazon EC2 and we've noticed some weird memory characteristics of the processes in our setup. Without going into too much detail about the specifics of our…
rusty
  • 163
  • 6
5
votes
2 answers

Should swap space be in a logical volume, or directly on disk?

What are the benefits of putting swap into a logical volume over using direct disk access? For example, with a fresh, default install of RHEL5 or 6, a volume group is created on the default disk along with one other small non-logical partition (for…
warren
  • 17,829
  • 23
  • 82
  • 134
5
votes
1 answer

why is kswapd using high CPU on an idle system?

I have an idle Linux centOS system and yet kswapd is using 100% cpu. All I have running is a single bash session with top running.... I have 32G RAM and yet kswapd is constantly using 100% cpu for over 4 hours.
Deshawn
  • 363
  • 2
  • 4
  • 5
5
votes
6 answers

What and why is my swap space used under linux

on my linux system I get these stats from top: Tasks: 155 total, 1 running, 153 sleeping, 0 stopped, 1 zombie Cpu(s): 1.5%us, 0.3%sy, 0.0%ni, 97.4%id, 0.7%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 8177180k total, 2025504k used, 6151676k free,…
Fabian
  • 51
  • 1
  • 2
5
votes
5 answers

How to prevent going to SWAP?

We have a critical application which uses pretty much of our RAM memory. At most time the application stays in RAM, however there are some situation (e.g. when some other applications and deamons start using more RAM) which make it going to SWAP…
Jakub
  • 151
  • 1
  • 3
5
votes
4 answers

How can I monitor what process is swapping?

I have a linux webserver. It's running Apache and a python based web application and postgres. It's quite slow. By running ab (apache benchmark) and vmstat I could see that it was swapping while requests were coming in. Is there any programme that…
Amandasaurus
  • 30,211
  • 62
  • 184
  • 246
5
votes
4 answers

Should I turn off swap on AWS EC2?

I'm running a webserver and database server on the same AWS EC2 instance. I know it's a bad idea to have swap for web server, so should I just turn it off? Will it affect the database service (I guess not but I'm not sure on this). If yes, how do I…
5
votes
2 answers

(CentOS) Adding swap file failed

Im trying adding swap file by following this guide: http://www.redhat.com/docs/manuals/linux/RHL-8.0-Manual/custom-guide/s1-swap-adding.html Everything is fine, but starting swapon /swapfile, I got this message: swapon: /swapfile: Operation not…
Faris
4
votes
1 answer

Swap Memory Anomoly

I am currently experiencing a memory issue on my centos 7.6 distro. It began with my system swapping even though up to 80GB ram should have been available. free -m total used free shared buff/cache …
GreyStone
  • 45
  • 5
4
votes
5 answers

SSDs as Linux swap for large virtual mem applications?

This question topically touched on this, but running on 64-bit Linux, I have a set of data caching JVMs as well as wanting a large web cache. Each cache today is configured to in gross fit in system memory (24GB) and persist to disk in LRU. I'm…
Jé Queue
  • 363
  • 1
  • 3
  • 10
4
votes
0 answers

AWS ElastiCache Redis - Why has SwapUsage slowly climbed just over 100MB dispite having FreeableMemory available?

Starting around 7/28/2017 the SwapUsage started to climb for reasons I cannot figure out. I have spent many hours Googling and reading AWS documentation. At no point do we run out of FreeableMemory. CloudWatch Dashboard for the Redis server Does…