What is the recommended swap size for Red Hat platforms?

219 篇文章 2 订阅

 

What is the recommended swap size for Red Hat platforms?

 SOLUTION 已验证 - 已更新 2016年八月30日12:29 - 

English 

环境

  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Open Stack Platform 3
  • Red Hat Enterprise Open Stack Platform 4
  • Red Hat Enterprise Linux OpenStack Platform 5

问题

  • If I add several hundred gigabytes of RAM to a system, do I really need several hundred gigabytes of swap space?
  • What are the recommended swap size settings for Red Hat Enterprise Linux 5, Red Hat Enterprise Linux 6, Red Hat Enterprise Open Stack Platform 3 and Red Hat Enterprise Open Stack Platform 4?
  • How much swap should I assign to a virtual guest, is the recommendation different from a normal system?

决议

  • In years past, Red Hat recommended a linear increase to the amount of swap space on a system as the amount of RAM increased. Specifically, the recommendation was that swap space should equal twice the amount of RAM when the system has up to 2 GB of RAM installed, and the amount of RAM plus 2GB when the system has more than 2GB of RAM installed.

  • This advice is no longer practical for modern computers and modern platforms as amounts of installed RAM have increased to multiple terabytes on some systems. The following guidelines are a better way to determine the amount of swap space a system should have:

Red Hat Enterprise Linux 5

Amount of installed RAMRecomended swap space
4GB or less2GB swap space
4GB - 16GB4GB swap space
16GB - 64GB8GB swap space
64GB - 256GB16GB swap space

Note: A swap space of at least 100GB is recommended for systems with over 140 logical processors.

Red Hat Enterprise Linux 6, Red Hat Enterprise Linux 7, Red Hat Enterprise Open Stack Platform 3 and Red Hat Enterprise Open Stack Platform 4

Amount of installed RAMRecommended swap spaceRecommended swap space if allowing for hibernation
2GB or lessTwice the installed RAM3 times the amount of RAM
> 2GB - 8GBThe same amount of RAM2 times the amount of RAM
> 8GB - 64GBAt least 4GB1.5 times the amount of RAM
> 64GB or moreAt least 4GBHibernation not recommended

Note: A swap space of at least 100GB is recommended for systems with over 140 logical processors or over 3TB of RAM.

  • The following items also influence the decision on how much swap space should be allocated:

    • Do specific application requirements exist? Applications may have been written with a specific amount of swap space in mind. If this is the case, the system should be set up with the amount of swap that is recommended by the application vendor.
    • Do other requirements exist? Workstations and laptops may use hibernation functions that store the RAM contents in the swap area. In this case, the swap space would need to be equal to or greater than the amount of RAM installed in the system to enable hibernation.
    • Assigning swap as 'last effort' memory While the block devices hosting swap are generally many times slower than RAM, it is useful to have swap as another layer of memory that's available when needed. In the case of applications with high memory utilization, swap space can allow memory to be swapped out to disk to delay or prevent the termination of applications by the OOM killer.
  • Virtual guests: for virtual guests, basically the same considerations as for physical systems apply. Also for these, using a bit of swap can influence the behaviour of a process requesting more and more memory, so the process gets slowed down first (leaving time for a sysadmin to manually fix the situation) before eventually also the swap is exhausted and the OOM killer terminates processes. If the memory written by the processes is not exceeding the available swap, the system will just experience a temporary slowdown.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值