What's new

N66U- any reason to have a swap file? If so, how big?

  • Thread starter Deleted member 27741
  • Start date
  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

D

Deleted member 27741

Guest
Hey all, I am going to put a 32Gb usb thumbdrive on my n66u instead of the cheapo drive I currently have. I was wondering, should I use a swap file? I have a swap file on my current thumb drive but it doesn't seem like it is ever used.
 
Are you using all your mem?

I usually have like 90% free.
 
Under normal operating conditions, it mostly free like you (72%). I have not watched memory usage during the stuff that I normally use- OpenVPN server and client, FTP, Samba share. Do these things even use up router memory? If not, swap may have little use for me.
 
Ah, after watching I see swap is used when I copy files. I suppose I will put a swap partition in then.
 
I was wondering, should I use a swap file? I have a swap file on my current thumb drive but it doesn't seem like it is ever used.
Hi,

If you use any of the additional features (on top of routing the network traffic), you should install a swap file.
The size is max. the RAM you have (256 MByte) and typically will never be used fully.

For this you do not need a big (but a good!) USB drive - the best in sense of durability would be a HDD, but a good (branded) USB drive will do it for a while.

Remember: Swap will write often to the same file and might use up your USB drive write cycles fast...
To overcome this issue, you could create on every reboot a new swap file and use it only until the next reboot. This will avoid that the same place will be rewritten often by the swap usage... ;)

With kind regards
Joe :cool:
 
Do your files copy faster with swap enabled?

I thought swap was best avoided unless you required the increased virtual memory.
 
Remember that ideally you would want your swap file activity to be as little as possible (i.e. zero).

Access times on flash drives are thousands of times slower than RAM so you want to avoid it.
 
Last edited:
Thanks for all your help, guys! Yes, swap will be slow so I was thinking of setting swappiness to 0 or 10. Do you guys think a swappiness of 0 would be best for performance?
 
Thanks for all your help, guys! Yes, swap will be slow so I was thinking of setting swappiness to 0 or 10. Do you guys think a swappiness of 0 would be best for performance?
Hi,

Wikipedia has the answer for you: It's 10! :eek:

But leaving it on default does not harm: The swapping will only happen once and might (or not) read back the information later on. There is no big or permanent read/write to the swap file - unless you run something really, really heavy or strange workload on your small router! ;)

With kind regards
Joe :cool:
 
Last edited:
But leaving it on default does not harm: The swapping will only happen once and might (or not) read back the information later on. There is no big or permanent read/write to the swap file - unless you run something really, really heavy or strange on your router!
That's not necessarily true. But (as you implied) the actual activity will vary from user to user and also from one moment in time to another. In other words, it's impossible to generalise because every situation is different and changes over time.

Consider this theoretical example:

Your router is running various services which have a combined memory requirement greater than your RAM (which is why you've created a swap file in the first place).

Your bit torrent program starts up and requires RAM but there is none free, so some of the memory allocated to the DLNA server is moved to the swap file. This is takes time so the bit torrent program is slow to load.

After a few minutes, the DLNA client wakes up to do it's periodic media scan (or because it's been polled by a client device). The memory moved to swap has to be moved back to RAM, so part of the Samba code/buffers is moved into swap instead. Again this is a slow process.

Next, a user tries to copy a file to the Samba share....

Well you can see where this is going ;) If you are over-allocating memory usage it is quite possible that you will experience significant degradation in responsiveness and load times. But, in it's defence, Linux usually does a good job of working out the best things to move to swap and what to leave in RAM. :) Swap is great if you've got a very fast swap device, or you're running a bunch of processes that spend most of their life quiesced such that they don't have to be constantly moved to and from the swap file.

Just my 2 cents.:D

PS And just to make things more complicated, applications themselves can dynamically alter their memory usage based on available RAM, or even "pin" certain chunks of memory in RAM so that it can't be swapped out.
 
Last edited:

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!

Staff online

Top