2 ms·
These estimates are bizarrely high, in my experience. Laptop: RAM + 1GB. Laptops hibernate, and they need space for that. The extra gig is for temp space duri
by dsr_ 8y ago
These estimates are bizarrely high, in my experience.
Laptop: RAM + 1GB.
Laptops hibernate, and they need space for that. The extra gig is for temp space during the hibernate/restore time periods.
Desktop: 1GB.
Linux will often use some swap space when available for libraries which are technically loaded into memory but will never actually be called again. This is typically in the 100-300MB range.
Server: minimum 1GB -> 1/16 RAM -> maximum 8GB
Servers shouldn't swap; as soon as they do, you should either be adding more RAM or figuring out what went wrong. In the meantime, a little swap will let you ride out a short storm. If you're actively swapping on 8GB of RAM, you have a more serious problem anyway.
Assume that these numbers will change, mostly under the impact of new storage technology. SSD made swapping much less nasty for the system's performance, but at a more serious cost to the storage's lifetime.
- mjw1007 8y agoRight now I'm on a 16GB machine that says it's using 3849MB of swap (to SSD). I'm not noticing any slowdown. I'm happy to let the kernel decide whether it wants to use some of the RAM for disk buffer rather than committed memory.
- davidgould 8y agoThese are close to optimal recommendations. They capture the modern truth that swap is too slow to actually transfer to and from, but that it can enlarge the effective memory slightly by providing a place to park very rarely used data. However, this is only a minor optimization and mostly it is not worth the trouble of configuring it. On servers especially I prefer zero swap. The mere existance of swap can cause pain as inevitably some new admin will come along and insist on monitoring swap use and sending alerts when it becomes full. "We have critical situation: we are using 99% of (8GB) swap on the database host (1TB main memory), I'm rebooting it". True story.