I have 32GB memory. SSD and NonSSD drives.

I installed Linux to NonSSD drive but I prefer SSD for /var directory and I didn't create swap space because there is high memory.

I know physical memory + swap = virtual memory. I know there are hugepages and memory mapped files features of linux. Memory mapped files uses virtual memory and I don't know a strategy to process a file. Is there a benefit of swap even if there is high physical memory.

I'm going to process 3GB gzipped file to import mysql database. I'm going to create application cpp boost library gzip memory mapped stream and mysql native client library.

  • My first target is detecting diff of files. I'm going to use ON DUPLICATE KEY UPDATE attempt_count = attempt_count + 1.
  • Also I need fulltext search feature and I need to filter some criteria like string length.
  • And I should integrate a management interface.

What is the best configuration for this?

  • 1
    With 32 GB RAM I wouldn't setup a swap, even if you're dealing with 3 GB zipfiles now & then. I also wouldn't put /var to the SSD. – ott-- Jul 12 '15 at 18:48
  • It's not really clear what you are asking here. At best this a a couple different questions. Try to narrow your question down to one that has a definitive answer, like How do I make sure X happens under condition Y? Questions that include the word "best" don't always specific answers. – user1794469 Jul 12 '15 at 18:49
  • 2
    Ram + swap ≠ virtual memory. However I can not think what the name for Ram + Swap is. And the more I think about it I realise that it is not that simple. – ctrl-alt-delor Jul 12 '15 at 18:50

Swap is needed for: Hibernation, and to swap out memory from RAM to avoid RAM exhaustion.

So if you have enough RAM to keep your working set, then you will only need swap for hibernation. If your working set is very big then swap may be needed. However whether swap is a good idea will depend on the work pattern. Some patterns will cause swap thrash, others will not.

It addition for memory-mapped-files and executables. The kernel will only load what is needed into RAM, and drop what is not. No swap is needed, as the file is the backing store (not swap).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.