NSA325 v2: relocating swap space to an external USB storage?
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:
- Throughput is key!
- The HDDs are connected to the NSA v2 via a SATA II bus.
- SATA II according to https://en.wikipedia.org/wiki/SATA#SATA_revision_2.0_(3_Gbit/s,_300_MB/s,_Serial_ATA-300) has a throughput of ~ 300 MB/s.
- The device has two USB 2.0 ports on the rear side and a USB 3.0 port on the front side.
- USB 2.0 according to https://en.wikipedia.org/wiki/USB#USB_2.0 has a throughput of theoretically max. 53 MB/s.
- USB 3.0 according to https://en.wikipedia.org/wiki/USB#USB_3.x has a throughput of ~ 400 MB/s.
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,
Mijzelf Posts: 2,281
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.0
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!
- 8.1K All Categories
- 1.6K Nebula
- 60 Nebula Ideas
- 54 Nebula Status and Incidents
- 4.4K Security
- 224 Security Ideas
- 963 Switch
- 45 Switch Ideas
- 867 WirelessLAN
- 20 WLAN Ideas
- 5.2K Consumer Product
- 139 Service & License
- 268 News and Release
- 95 Success Stories
- 53 Security Advisories
- 12 Education Center
- 573 FAQ
- 273 Nebula FAQ
- 132 Security FAQ
- 73 Switch FAQ
- 72 WirelessLAN FAQ
- 7 Consumer Product FAQ
- 34 Nebula Monthly Express
- 71 About Community
- 44 Security Highlight