Using swapcache to speed up external disk writes?
PeerCorps Trust Fund
ipc at peercorpstrust.org
Wed Dec 17 10:35:11 PST 2014
Thanks! This was extremely helpful!
On 12/17/2014 07:41 PM, Matthew Dillon wrote:
> Swapcache will speed up accesses to the external disk very nicely, but not
> have much of an effect on write performance. But writes are already
> buffered to some degree, and NFS clients usually flush modifies files on
> close() for safety reasons (which might be why you see some latency). That
> can often be turned off on the client but I do not recommend doing so.
>
> The main problem with USB-attached drives is that the I/Os are basically
> serialized, so random access performance is going to be horrible. For a
> server you really need a SATA attached drive. Swapcache will improve
> random access performance though once things get cached.
>
> Depending on the number of files you are storing verses the size of the
> vnode cache on the server, you might want to turn on the
> vfs.hammer.double_buffer feature (via sysctl).
>
> To use swapcache, make sure a large amount of swap space is configured on
> the SSD and then enable it via sysctl. Typical starting configuration is
> something like the below. 'man swapcache' for more information.
>
> vm.swapcache.use_chflags = 0
> vm.swapcache.read_enable=1
> vm.swapcache.meta_enable=1
> vm.swapcache.data_enable=1
>
> To really be useful you want as many gigabytes of swap space as you can
> bear. 100G if you can. Small amounts of swap space, like ~4GB isn't going
> to do much to help cache a TB+ HDD. 40GB will help a little. The more the
> better.
>
> -Matt
>
> On Wed, Dec 17, 2014 at 2:35 AM, PeerCorps Trust Fund <
> ipc at peercorpstrust.org> wrote:
>>
>> Ha! Thanks for this. I actually set it up yesterday only to get a critical
>> error notice that the external disk just couldn't keep up (my translation
>> of the jargon it spit out). I had to stop the transfer and make a hard
>> restart of the laptop.
>>
>> I am using a Thinkpad x200 and do intend on upgrading it via expresscard
>> to USB 3.0. The external disk itself is USB 3.0 2 terabyte drive.
>>
>> FreeBSD was tested previously and works well. My draw to Dragonfly's is
>> related to its NFS performance which seems to be consistently faster in my
>> testing. I was also keen to experiment more with HAMMER outside of a
>> virtual system. HAMMER's lower resource requirements are also a strong draw.
>>
>> On 12/17/2014 12:23 PM, Michael Neumann wrote:
>>>
>>>
>>> Am 17.12.2014 um 03:52 schrieb Justin Sherrill:
>>>> Short answer: yes, set up swapcache on the SSD and you'll benefit.
>>>> That's the goal of swapcache. See the swapcache man page for a guide
>>>> on how large to make your partition, and use the rest for / or however
>>>> you want to arrange it.
>>>
>>> But keep in mind swapcache does not work as a write-cache. It's only
>>> caching reads.
>>>
>>> USB 2.0 sets a limit which is higher than the 20 MB/sec you get, so I
>>> assume it's your disk that is not the fastest (which I guess is quite
>>> common for "USB" disks). I doubt you get more out of that disk on any
>>> other operating system.
>>>
>>> FreeBSD/ZFS has something called ZFS Intent Log, which does write
>>> caching. But I doubt you want to use it on your laptop as in general ZFS
>>> is a bit more hungry in terms of resources.
>>>
>>> I'd suggest you to buy a good/fast harddisk and attach it via eSATA or
>> USB 3.0
>>> (is it supported by DragonFly / your laptop?). Fast disks usually are
>> powered
>>> by an external power supply and not via the USB power (things might have
>>> changed during the years). Swapcache can then help you to improve read
>>> performance, which also helps write performance as it takes off read
>> load from
>>> the disk. A good harddisk should be able to give your 100 MB/sec of
>> sequential
>>> writes, but for random reads the performance is abysmal, this is where
>> the SSD
>>> shines.
>>>
>>> Regards,
>>>
>>> Michael
>>
>>
>
--
Michael L. Wilson
International Project Coordinator
PeerCorps Trust Fund - Tanzania
More information about the Users
mailing list