Swap Space的误区
去询问大多数Linux的工程师,一个Linux的Swap Space应该分多少大小时,你得到的答案80%以上会是“内存大小的两倍”。同样,基本上我也属于这大部分人。但看下面这段话,摘自RHEL4 System Administration Guide Chapter 11. Swap Space.
Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files. The size of your swap should be equal to twice your computer's physical RAM for up to 2 GB of physical RAM. For physical RAM above 2 GB, the size of your swap should be equal to the amount of physical RAM above 2 GB. The size of your swap should never less than 32 MB. Using this basic formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one with 3 GB of physical RAM would have 5 GB of swap.
同样,我也喜欢下面这样的话:
Unfortunately, deciding on the amount of swap to allocate to Red Hat Enterprise Linux is more of an art than a science, so hard rules are not possible. Each system's most used applications should be accounted for when determining swap size.
怎么样,是不是觉得做系统的工程师就是永远无法给出一个确定答案的那种人呢?