How to review Swap space usage on a Linux server

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Linux system administration is outside the scope of Atlassian support. This page is provided for your information only.

As a system administrator, you may see the swap space fill up on the Bamboo server. The following will show some options for determining how much of the swap space each application is using.

Solution

TOP

Unix operating systems have the top command which will show memory usage. This is useful as a general overview, but SWAP is approximated as Virtual memory - Resident (physical) memory, so it less accurate than the other tools on this page.

However, once top is opened, you can sort by SWAP usage as follows:

  1. Type f to open the "Add column" menu

  2. Use the up/down arrow keys to navigate to SWAP

  3. Type d or <Space> to select SWAP for display

  4. Tap the right arrow to select the SWAP column to reorder

  5. Type s to select SWAP as your sort column

  6. Type q to return to the main screen

You can save the current top configuration by typing Shift + W.

Example output:

1 2 3 4 5 6 7 8 9 PID USER PR NI VIRT RES SWAP SHR S %CPU %MEM TIME+ COMMAND 1 root 20 0 33492 1628 1224 1476 S 0.0 0.1 0:00.75 init 316 root 20 0 51508 1032 736 988 S 0.0 0.1 0:00.02 systemd-udevd 312 root 20 0 19472 468 252 468 S 0.0 0.0 0:00.06 upstart-udev-br 493 root 20 0 23472 208 212 208 S 0.0 0.0 0:00.00 rpc.idmapd 496 root 20 0 43444 1620 200 1460 S 0.0 0.1 0:00.00 systemd-logind 443 message+ 20 0 39212 1064 196 872 S 0.0 0.1 0:00.06 dbus-daemon 648 root 20 0 15536 756 156 384 S 0.0 0.0 0:00.02 upstart-file-br ...

FREE

Another useful Linux command is free, which, when run with the -m flag, will return memory usage for your machine, including SWAP.

For example:

1 2 3 4 total used free shared buffers cached Mem: 32109 30982 1126 0 301 2916 -/+ buffers/cache: 27764 4345 Swap: 8191 6107 2084

PROC STATUS

Finally, this command will list all applications with how much swap space each is using in kilobytes by looping through the status snapshots in the /proc/ directory:

1 for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file; done | sort -k 2 -n -r | less

(Source)

Example:

1 2 3 4 5 6 7 8 9 10 11 root@bamboo:/home/vagrant# for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file; done | sort -k 2 -n -r | head init 1008 kB systemd-udevd 736 kB upstart-udev-br 220 kB dbus-daemon 192 kB writeback watchdog/0 vmstat VBoxService 0 kB upstart-socket- 0 kB upstart-file-br 0 kB
Updated on April 2, 2025

Still need help?

The Atlassian Community is here for you.