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.

342 questions
2
votes
1 answer

Swap 99% but regular memory fine

I have a 1GB VPS server. I setup 1GB of swap ram too a few weeks ago and quite often it's hitting 99% whilst the regular memory is usually 40% - 60%. Most of my sites on the server run fine and fast. But the wordpress website I am developing is very…
wharfdale
  • 151
  • 8
2
votes
1 answer

puppet logical conditions- "onlyif" and "unless" not working

I have written the following code and this works fine if swap is not in place, but once swap is created and if the script is executed again, it leads to error. I tried adding conditions using onlyif and unless which are commented in the following…
user228708
  • 63
  • 1
  • 1
  • 7
2
votes
0 answers

Linux (Debian 7 x64) swapping activity despite lots of free memory

Yes, I have reduced vm.swappiness a lot: % sysctl -a | grep swap vm.swappiness = 1 Memory is mostly free: % cat /proc/meminfo | head MemTotal: 8070592 kB MemFree: 2619580 kB ps_mem.py…
LetMeSOThat4U
  • 1,371
  • 2
  • 17
  • 35
2
votes
3 answers

Is there any reason to NOT have a swap file on CentOS (DigitalOcean)

I'm running a site on DigitalOcean with CentOS 6.5. As has been noted elsewhere, DigitalOcean servers are by default configured without any sort of swap, and I'm wondering if I should add one. I know just enough about this stuff to think that the…
Jim Miller
  • 713
  • 2
  • 11
  • 23
2
votes
1 answer

My Ubuntu VPS is not using available swap, even if OOM. What to do?

I recently added 1 GB of swap to my Ubuntu virtual private server to prevent MySQL crashes on RAM overloading. I followed this tutorial. I use htop to monitor resources. When I use loadimpact to test my server it crashes when no more RAM is…
2
votes
2 answers

Moving a process to and from swap

I've got several server-type processes on my linux server that use up 50MB of RAM. They are not constantly being used, and I'd like to be able to run more instances than my RAM capacity allows. I want to be able to remove a process from RAM and move…
Daniel S
  • 415
  • 2
  • 5
  • 9
2
votes
2 answers

Linux process swap usage is greater than the overall system swap usage

I have a strange problem that when I run top command it shows that some processes are using around 1.5GB of swap space but then the overall usage of the system swap is way to less to something around 117MB, so why is that? I thought the overall…
2
votes
1 answer

Is there a way to free swap?

After using vmware player with some virtual machine, it seems like my swap stays quite occupied and it doesn't changes unless i reboot it. However, regularly swap is not used much by other applications. Configuration is bit unusual: Swap is about…
mariotanenbaum
  • 382
  • 5
  • 14
2
votes
2 answers

Ubuntu: forcing processes into swap, or into RAM

I am now solving the following problem on Ubuntu: Is it possible to specify if one process should run only in the RAM (i.e. is not allowed to swap) or reversely only in the swap part? I mean that the process should be killed by the system rather…
stanekr
  • 21
  • 1
  • 2
2
votes
1 answer

How much RAM do I need to run a forum using Nginx, Gunicorn, Django?

I started an ec2 instance (micro) to test the amount of memory I have available to run a website but I was expecting having a bit more. So my question would be: How much RAM do I need to run a site using Django, Nginx and Gunicorn. This is what I…
r_31415
  • 121
  • 1
  • 4
2
votes
1 answer

Ubuntu Swap on EC2 with an EBS root

Running Ubuntu 11.04(natty) on an EC2 micro instance. Setup 1gb swap file at /mnt/swap. Works fine until I reboot and then the swap is not active. I can activate it manually using swapon -a, but my line in /etc/fstab is ignored. /mnt/swap none …
Lelon
  • 123
  • 2
2
votes
2 answers

Tuning windows virtual memory/paging for a specific workload

I have a specific ram-intensive program I run which slows down my entire system for hours after each run - does the Windows NT 6.0/6.1 kernel have any tunables to encourage processes' working sets to be paged back into RAM quicker? The program in…
2
votes
2 answers

Resizing swap partition (RHEL 5.x)

Following is how parted print looks like: (parted) print Model: VMware Virtual disk (scsi) Disk /dev/sda: 26.8GB Sector size (logical/physical): 512B/512B Partition Table: msdos Number …
ring bearer
  • 157
  • 7
2
votes
1 answer

suspend process if number of hard page faults surpasses a given amount per second

Is there a way in linux to send a signal or otherwise install an handler to be called when a process surpasses a given rate of hard page faults per second? A simple sigstop would avoid many accidental crashes I had (swap death), but I imagine there…
foober
  • 61
  • 4
2
votes
1 answer

Too much memory being swapped out, while cache uses it all on Centos 5.4

I've set swappiness on my DB server to zero, but during a large sort operation the swap space used grew even as the cache was still using a lot of memory, and then cache grew but swap was left alone. This makes no sense to me. Here's free -m as of…
ehsanul
  • 427
  • 1
  • 8
  • 19