Z
Z
zizop2010-12-22 17:57:47
linux
zizop, 2010-12-22 17:57:47

Can you tell me the optimal swap partition size for an SSD drive?

The situation is this, there is a server with 16Gb RAM and a 32Gb SSD hard drive. Previously, when allocating swap, I was guided by the rule Vswap = 2 * Vram. But what to do in this situation, and is a swap partition needed at all in this situation?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
I
Ivan, 2010-12-22
@iSage

Depends on tasks. If now everything fits into memory with a large margin, it is not needed. It doesn’t fit - you need as much as it doesn’t fit + a certain margin.
In general, for servers, they usually either don’t do a swap, or do it with Vram / 2.

P
phasma, 2010-12-22
@phasma

> But what to do in this situation, and is a swap partition needed at all in this situation?
it is better to leave a couple of gigabytes just in case, because. if the memory suddenly runs out, then due to the swap there will be a chance that it will be able to fork and the system will continue to function.

A
almazmusic, 2010-12-22
@almazmusic

Your task is specific, you need to personally test this case, keep logs in order to know how much maximum RAM is occupied. For example, I have 8GB of RAM, 40GB of ssd and I set the swap file from 64MB to a couple of gigs - I have never had more than 64MB, although the RAM usually takes up to 6-7 gigs.

V
Vladimir Chernyshev, 2010-12-22
@VolCh

Swap is needed when there is not enough RAM. Linux (by default, there may be settings that affect "aggressiveness") differs from "some other OS" in its economical use, not striving to have half the RAM for caches and buffers. But there is also a negative point in this - even programs / data that are used very rarely, it will keep in RAM until the last, instead of unloading them for a couple of weeks, and giving the memory to the cache. With your RAM / screw ratios, I would give the swap a gig or two (if it's not a pity) for every fireman and in the hope that something will be unloaded there, but from messages like "can't fork" or "out of memory" this is not it will save, as well as allocation for swap, say, 16 GB - if 16 GB of RAM is not enough, then in 99% of cases it is the wrong memory consumption due to incorrect software settings

H
homm, 2010-12-24
@homm

How can there be a "swap partition for an SSD drive"? An SSD drive does not need a swap partition, it is needed by the system that is installed on this SSD. The system can do without swap, clean it up. Most web servers run at 40-60% memory usage, the rest is disk cache.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question