NSA325 v2: relocating swap space to an external USB storage?

All -

I just came to mull over relocating the device's swap space to an external USB storage.

But I am not yet entirely sure whether it's a good idea. Or really a bad idea™.

Here is where I have stopped:

So, to actually improve things one would need to relocate the swap space to an external USB 3.0 storage connected to the front side port, as this might speed up the swap space by roughly a third.

The disadvantage seems to be that by this, the only USB 3.0 port is permanently blocked and one could connect other external USB storages only to the much slower ports on the rear side, assuming that no USB 3.0 hub is set up for the front side port.

Addditionally, if FW extensions like FFP would come into play, one cannot deploy it via that USB 3.0 storage on the front side, as it would only work if the storage is connected to a rear side port. That means one would have to deploy a second USB storage for this.

So for the time being it looks like a rather bad idea™ to me.

Then again, I might have overlooked something. Or even quite a few things.

And so I'd kindly like to ask you for any comments you might have.

Thanks & best,

-C.

Accepted Solution

  • Mijzelf
    Mijzelf Posts: 2,753  Guru Member
    250 Answers 2500 Comments Friend Collector Seventh Anniversary
    Answer ✓

    What is your goal? In most cases the 325 hardly uses any swap, so optimizing it doesn't make much sense.

    Then, for swapspace the random access time can be more important than the data througput. A simple USB thumb drive beats every rotating disk in that aspect. Which doesn't make it automatically a good idea to use that thumb drive. Flash memory has a limited lifetime when written often, and cheap thumb drives don't have a good wear leveling system, so it won't live long when (intensively) used as swap.

    When the swap space fails, the program which is swapping in will crash. If that is the kernel you have a system crash.

    Some random info: The sata bus can do 300MB/sec, but a rotating disk can't. Around 150MB/sec it's done. An good SSD could saturate the sata bus, but I doubt the 325 could take up. The theoretical 53MB/sec of USB2 is never reached. When you search for reviews of USB2 external storage, you'll see that for some reason the max is around 25MB/sec. The random access time of a rotating disk is 10~20msec. Which means that if you have to swap in or out single blocks at random places in the swapfile, you can't do more than 50~100 pages a second, which is only 400kB! That is the reason swapping is dead slow on rotating disks. A simple USB stick has random access times of «1msec. So it could do 10 times better, and still stay well within the bandwidth of USB2.

All Replies

  • Mijzelf
    Mijzelf Posts: 2,753  Guru Member
    250 Answers 2500 Comments Friend Collector Seventh Anniversary
    Answer ✓

    What is your goal? In most cases the 325 hardly uses any swap, so optimizing it doesn't make much sense.

    Then, for swapspace the random access time can be more important than the data througput. A simple USB thumb drive beats every rotating disk in that aspect. Which doesn't make it automatically a good idea to use that thumb drive. Flash memory has a limited lifetime when written often, and cheap thumb drives don't have a good wear leveling system, so it won't live long when (intensively) used as swap.

    When the swap space fails, the program which is swapping in will crash. If that is the kernel you have a system crash.

    Some random info: The sata bus can do 300MB/sec, but a rotating disk can't. Around 150MB/sec it's done. An good SSD could saturate the sata bus, but I doubt the 325 could take up. The theoretical 53MB/sec of USB2 is never reached. When you search for reviews of USB2 external storage, you'll see that for some reason the max is around 25MB/sec. The random access time of a rotating disk is 10~20msec. Which means that if you have to swap in or out single blocks at random places in the swapfile, you can't do more than 50~100 pages a second, which is only 400kB! That is the reason swapping is dead slow on rotating disks. A simple USB stick has random access times of «1msec. So it could do 10 times better, and still stay well within the bandwidth of USB2.

  • Hi @Mijzelf,

    thanks a lot for your comprehensive answer!

    What's my goal? To make and have things generally better than before. :-)

    But this idea got killed by your second sentence already - which is totally fine, as I wasn't sure about at all in the first place.

    The remaining explanations, of course, helped me to gain better knowledge about all these details to be kept in the air when coming to such decisions points.

    Once again: thanks!

    Best,

    -C.

Consumer Product Help Center