Rechercher

Ce contenu n'est pas disponible dans la langue sélectionnée.

6.2. Checking Swap Space Size and Usage

download PDF
You can check the size and current usage of swap space by running the command: grep SwapTotal /proc/meminfo
Swap usage may slowly increase as shown above but should stop at some point. If swap usage continues to grow steadily or is already large, then one of the following choices may need to be considered:
  • Adding more RAM.
  • Reducing the size of the SGA.
  • Increasing the size of the swap space.
If you see constant swapping, then you need to either add more RAM or reduce the size of the SGA. Constant swapping should be avoided at all cost. You can check current swap activity using the following commands:
$ vmstat 3 100
procs                  memory    swap         io     system         cpu
 r  b swpd   free  buff cache si   so   bi    bo   in    cs us sy id wa
 1  0    0 972488  7148 20848  0    0  856     6  138    53  0  0 99  0
 0  1    0 962204  9388 20848  0    0  747     0 4389  8859 23 24 11 41
 0  1    0 959500 10728 20848  0    0  440   313 1496  2345  4  7  0 89
 0  1    0 956912 12216 20848  0    0  496     0 2294  4224 10 13  0 77
 1  1    0 951600 15228 20848  0    0  997   264 2241  3945  6 13  0 81
 0  1    0 947860 17188 20848  0    0  647   280 2386  3985  9  9  1 80
 0  1    0 944932 19304 20848  0    0  705     0 1501  2580  4  9  0 87
The fields si and so show the amount of memory paged in from disk and paged out to disk, respectively. If the server shows continuous swap activity then more memory should be added or the SGA size should be reduced. To check the history of swap activity, you can use the sar command. For example, to check swap activity from Oct 12th:
# ls -al /var/log/sa | grep "Oct 12"
-rw-r--r--    1 root     root      2333308 Oct 12 23:55 sa12
-rw-r--r--    1 root     root      4354749 Oct 12 23:53 sar12
# sar -W -f /var/log/sa/sa12
Linux 2.4.21-32.0.1.ELhugemem (rac01prd)       10/12/2005

12:00:00 AM  pswpin/s pswpout/s
12:05:00 AM      0.00      0.00
12:10:00 AM      0.00      0.00
12:15:00 AM      0.00      0.00
12:20:00 AM      0.00      0.00
12:25:00 AM      0.00      0.00
12:30:00 AM      0.00      0.00
...
The fields pswpin and pswpout show the total number of pages brought in and out per second, respectively.
If the server shows sporadic swap activity or swap activity for a short period time at certain intervals, then you can either add more swap space or RAM. If swap usage is already very large, do not confuse very large swap usage with constant swapping, then more RAM is recommended.
Red Hat logoGithubRedditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez leBlog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

© 2024 Red Hat, Inc.