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
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
  • 405
  • 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
  • 372
  • 3
  • 14
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

swap on dev + but get mount dev + how to swap dev anyway?

when I do the: mkswap /dev/sda3 mkswap: error: /dev/sda3 is mounted; will not make swapspace. how to perfrom mkswap anyway , David
David
  • 423
  • 2
  • 6
  • 12
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
2
votes
3 answers

Diagnosing Solaris 8 server memory and swap space usage

Essentially, my question is related to memory allocation for Solaris virtual machines. I am running a couple of old Sun ONE 6 Java web servers on two Solaris 8 virtual machines. I see that there's a reasonable amount of swap space being used, but…
2
votes
4 answers

Creating swap files faster

I'm using Amazon EC2 and wish to be able to quickly generate large swapfiles (~10+GB) on instance startup. Unfortunately, I/O speed on my instances (c1.xlarge) is slow enough (20 MB/s) that this operation takes 10+ minutes, which is unacceptable…
UsAaR33
  • 1,036
  • 3
  • 11
  • 20
2
votes
2 answers

How much swap space for a 32GB ubuntu virtualization server?

I looked at many other questions on here regarding swap space, but none that I found really addressed my particular situation. I have an Ubuntu 9.10 64-bit server with 32GB of RAM running as a KVM host system. I'm using LVM on top of RAID1. The…
Tauren
  • 739
  • 4
  • 14
  • 24
2
votes
4 answers

Server uses 100% swap after fresh mysql installation

I set up a new server with 220G RAM and Ubuntu 22.04.1 LTS. After installing MySQL I changed the mysql config to: innodb_buffer_pool_size = 170G innodb_buffer_pool_instances = 64 innodb_buffer_pool_chunk_size = 134217728 innodb_log_file_size =…
Zystrix
  • 21
  • 1
1
vote
0 answers

How to investigate which docker container is causing swap to my system?

In a Debian 9 Stretch with docker 19.03.1 I'm using 6 containers and I observe swapping of 125Mo while memory usage never exceed 10% of total. ( usually around 500Mo / 16Go ). for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{…
idiocrate
  • 23
  • 4