Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Currently I am reading SSD reviews and I wonder how much exactly I will benefit if I move the 24 GB swap from 7200rpm HDD to SSD. Does anyone implemented swap space on SSD? Is this generally good idea?

On a side note: I read that ext4 has much better performance if the journal is on SSD. Anyone with such a setup?

Thanks!

Edit: Here I will answer the questions posted: Occasionally, relatively rare I am hitting the swap. I know what the swap is for and that is better to get more RAM. When the server begins to swap its performance degrades (not a surprise). The idea is if I have few memory hungry processes running, to improve the overall system performance at that time, using SSD for swap, instead of slower rotational media. At the end - I want to be able to login faster and check the server state during swapping, instead of waiting on the login prompt. And of what I see SSD is cheaper per GB than RAM.

Would I have better server performance during swapping (as rare it is) using SSD compared to HDD? Where 10k or 15k rpm HDDs would rate in this scenario?

Thank you all for your quick and prompt answers!

share|improve this question
6  
If you're using enough swap to cause you to consider switching it to an SSD, you're doing something wrong. IMHO (and many others), swap is purely there as a safety net, no more, no less. –  EEAA Feb 24 '11 at 16:20
    
I don't think using SSD for swap is money wisely spent. You're better off adding more RAM. As Erik says, if you are using swap enough that you think there may be benefit in moving it to SSD, something is very, very wrong. –  ThatGraemeGuy Feb 24 '11 at 17:58
    
if you put your entire system on a SSD then you may get an improvement but it depends on the distro. some distros boot sequences are not threaded so hdd speed does not help (starts one program and waits for it to finish before starting the next, this is the default behavior of sysvinit, this does not happen with OpenRC). Ive herd some good results from programs that reduce random IO seeks by placing the boot programs in order on the HDD, cant remember the name of it though. –  Silverfire Aug 17 '11 at 1:56
1  
Wow talk about shortsighted people. Yes a SSD will help with swap, although you should over provision it as much as possible. And to those saying more RAM, 32gb is just about the limit per cpu right now. We do statistical analysis of millions of records, and often use upwards of 50gb swap + 32gb RAM. So saying "more RAM" is not always the answer. –  Sheldon Ross Dec 13 '11 at 21:43
    
@GraemeDonaldson If you've got (say) 64 GB of RAM, adding more RAM might not be possible. It'd be a lot cheaper to by 120GB of SSD than it'd be to add more RAM even if it were possible. It'd also be cheaper than using your disks when your disks are SAS drives in hardware RAID 1 or 10 –  user140992 Oct 14 '12 at 12:46

6 Answers 6

up vote 20 down vote accepted

Are you hitting swap? Generally, the better solution is to avoid that entirely, or at least make it so that things which are swapped out are genuinely not in active use, so that the speed doesn't matter. Put your money into more RAM.

This is particularly true because while high-end SSD drives may improve performance, cheap ones are very troublesome in this regard.

There is a great article on this week's Linux Weekly News which I highly recommend reading: http://lwn.net/Articles/428584/. The summary is that cheap drives are very, very sensitive to access patterns, and Linux isn't currently designed to match that well. Worse, the drives don't really expose that information in a useful way, so Linux can't necessarily do the right thing. The best best is to use them with their pre-existing FAT32 filesystems, which are factory-configured to match the drive's expectations.

Or else you should buy expensive high-performance SSDs — but only when you're already maxed out on RAM. (And really, at that point, you might strongly consider just getting a newer server which supports more RAM.)

share|improve this answer
    
A point about the LWN article: it is looking at the SDHC and CF type flash devices, not at SSDs. Even "cheap" modern SATA SSDs will perform substantially better than the devices talked about in the article. –  Daniel Lawson Mar 3 '13 at 11:22
    
That's not entirely true. Read more carefully. Tht said, the information is now over two years old. –  mattdm Mar 3 '13 at 13:07
    
I read it again, and it's true enough. But you're right - the information (and this thread) is old now. My comment was simply to provide some modern balance to an old thread. –  Daniel Lawson Mar 4 '13 at 2:58

Do you actually use the swap? If so, you'll see a speed improvement using an SSD. The more you swap, the more benefit you'll see.

However I'd look at buying more RAM first.

share|improve this answer

Ram currently costs around 10-20 GBP/Gb, SSDs are 20-40 GBP/Gb - SSD is slower than RAM and wears out faster. Can you see where I'm going with this?

64Gb is a lot of swap. How much do you actually use? Why?

share|improve this answer
    
Where this numbers came from? What I see is: Kingston 12.0 GB DDR3-1333 (3 x 4.0) Kit = $300, Intel X25-E Extreme (Ephraim) SSDSA2SH032G1 2.5" 32GB SATA II SLC Internal Solid State Drive (SSD) - OEM = $375. –  grs Feb 24 '11 at 17:01
3  
RAM will perform far better than a SSD for a number of reasons, one od which is of course much larger bandwidth that RAM has over SATA. While price differences may be arguable, I do not think that performance is really an apples to apples comparison. Swap is swap, you actually have to basically max out RAM (normally) to begin swapping. Plus, SSDs wear out, especially when you use one to swap data in and out. RAM does not have that tendency. –  slashdot Feb 24 '11 at 21:25

Yes. There are several advantages to using SSD for swap file.

90% of data accesses are to 10% of the data. Data sets often do not fit into ram. If you are hitting the swap file, the reads and writes against the swap file can either be against a hard disc with a spinning platter or against an SSD.

Hard discs have a ~150/second limit on read/write operations per second because of seek time for the mechanical head, where as a $200 128 GB SSD can perform over 5000 IO ops per second.

Almost everyone here has said "BUY MORE RAM!!!" but unfortunately, server ram (double buffered ECC) costs 3x as much as commodity/consumer ram. For certain types of usage patterns, there is a clear price/performance advantage of SSD over ram.

SSD drives do not require installing an expensive 4 socket motherboard that supports 512 GB of expensive ECC. SSD drives are cheap and easy to add to commodity servers for storing database files or using as swap partitions.

If a $200 128 GB SSD swap partition improves performance by even 50% on a $2000 server, it is cost effective. However, you should max out the ram on the server first, given how in-expensive RAM is today.

However, the advantages of SSD for swap file usage heavily depend on your swap file patterns.

Summary: If you are doing many random access reads and few writes, you will see a large performance improvement from SSD over hard disc.

share|improve this answer

If you are maxed out on ram already, there are also SATA RAM disks out there on the market, which look like a hard drive to the system (but obviously won't retain data after being powered off - although the ones I've looked at do offer a battery). These are worth considering as they'd provide similar (or better) performance to a SSD, without the wear issues that an SSD has.

share|improve this answer

Agree with mattdm, RAM is cheaper and better than SSD for this.

Also, check /etc/sysctl.conf for vm.swapiness option, lower means lower swapping.

If you need SSD cache - buy adapter with SSD caching support or use bcache kernel patch:

http://bcache.evilpiepirate.org/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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