What's new

swap file necessity/usage

  • 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!

bengalih

Senior Member
wanted to ask some general questions/guidelines about memory utilization and swap file usage on Merlin.
I'm running the latest release (384.6) for my RT-AC68U.

I've been having problems setting up some 3rd party tools (specifically dnscrypt) and wanted to understand how to measure memory utilization and if there is anything special on this device/distribution that I'm overlooking.

While my initial testing is still going on, it appears that I may be getting memory low issues when trying to run dnscrypt install/configuration. While it seems the install/run of this software was the main link in the chain, the issues weren't related just to it. I was getting a "can't fork" error while trying to do a simple grep command - all indicators that I am running out of memory.

I did not have a swap file configured, but it appeared I had plenty of free memory. I have configured a swap file for testing now and I seem to have a little bit better stability (though really still too early to tell). However, even with my swap file configured my memory usage looks like this:

Code:
admin@RT-AC68U-4C30:/jffs# free
             total       used       free     shared    buffers     cached
Mem:        255700     115016     140684          0       1260      16512
-/+ buffers/cache:      97244     158456
Swap:       262140          0     262140

It looks to me like none of the swap file is being used and I have well over half my memory free. The GUI supports this showing less than 50% RAM being utilized. I have never really seen it go beyond this even when I was having my issues.

Based on the above data, is it safe to say that I have plenty of free memory and the swap file, though configured is not used at all? When I did not have the swap file configured and was getting these memory messages I still had ~50% RAM according to "free".

What could be causing these apparent system wide memory shortages even if the system is reporting plenty of RAM (with or without swapon)?

thanks
 
Looks like your memory is usage is about "normal." Recent builds will show about 51% memory used with QOS and/or Network Protection enabled. Not sure what the DNSCRYPT would do to RAM use but in my experience the heavy user is when you write to a USB disk especially a large chunk of spinning rust. You do have your swap on a thumbdrive?
You may want to hold off on DNSCRYPT especially if it is version 1.x. I suspect Merlin will be incorporating DNS over TLS (D0T) and possibly DNS over HTTPS (DoH). John's fork Beta has a successful implementation of Stubby for DoT (which will work on the AC68U). Stubby is another way to put security on DNS traffic that, I feel, works better than DNSCRYPT.
 
Can't say much on how things are with AsusWRT these days...

Code:
sfx@raspy3:~ $ free
             total        used        free      shared  buff/cache   available
Mem:         961624      123056      314200       26008      524368      755824
Swap:        961616           0      961616

So we do some zram.... just keeping pressure off swap...

Code:
fx@raspy3:~ $ cat /proc/swaps
Filename                                Type            Size    Used    Priority
/dev/zram0                              partition       240404  0       5
/dev/zram1                              partition       240404  0       5
/dev/zram2                              partition       240404  0       5
/dev/zram3                              partition       240404  0       5
 
Looks like your memory is usage is about "normal." Recent builds will show about 51% memory used with QOS and/or Network Protection enabled. Not sure what the DNSCRYPT would do to RAM use but in my experience the heavy user is when you write to a USB disk especially a large chunk of spinning rust. You do have your swap on a thumbdrive?
You may want to hold off on DNSCRYPT especially if it is version 1.x. I suspect Merlin will be incorporating DNS over TLS (D0T) and possibly DNS over HTTPS (DoH). John's fork Beta has a successful implementation of Stubby for DoT (which will work on the AC68U). Stubby is another way to put security on DNS traffic that, I feel, works better than DNSCRYPT.

So far I'm not using QOS or Network protection. This is a simple build with about a dozen port forwards.
I installed ab-solution for ad blocks along with pixleserv-tls.
Yes - swap file is on a thumbdrive, albeit an old 1 GB one that I just had laying around.

It looks like this dnscrypt script is a few years old at this point and appears many people are using it successfully. Most of those technologies you mention have also been around for quite some time and the fact that they aren't integrated into the base firmware yet does little to assure me it is going to happen soon. In any event, I don't want to really get into specifics of that one app...

What I don't understand is how/why am I getting programs crashing with out of memory issues, and even the shell telling me "can't fork" (generally a low memory issue), when for all appearances it looks like I have plenty of free ram?

Are there other tools or log files I can be looking at to figure out what's going on here?
 
Can't say much on how things are with AsusWRT these days...

Code:
sfx@raspy3:~ $ free
             total        used        free      shared  buff/cache   available
Mem:         961624      123056      314200       26008      524368      755824
Swap:        961616           0      961616

So we do some zram.... just keeping pressure off swap...

Code:
fx@raspy3:~ $ cat /proc/swaps
Filename                                Type            Size    Used    Priority
/dev/zram0                              partition       240404  0       5
/dev/zram1                              partition       240404  0       5
/dev/zram2                              partition       240404  0       5
/dev/zram3                              partition       240404  0       5
Ah...great! Something new to learn. Tomorrow morning, though...
 
wanted to ask some general questions/guidelines about memory utilization and swap file usage on Merlin.
I'm running the latest release (384.6) for my RT-AC68U.
've been having problems setting up some 3rd party tools (specifically dnscrypt) and wanted to understand how to measure memory utilization and if there is anything special on this device/distribution that I'm overlooking.

While my initial testing is still going on, it appears that I may be getting memory low issues when trying to run dnscrypt install/configuration. While it seems the install/run of this software was the main link in the chain, the issues weren't related just to it. I was getting a "can't fork" error while trying to do a simple grep command - all indicators that I am running out of memory.

I did not have a swap file configured, but it appeared I had plenty of free memory. I have configured a swap file for testing now and I seem to have a little bit better stability (though really still too early to tell). However, even with my swap file configured my memory usage looks like this:

Code:
admin@RT-AC68U-4C30:/jffs# free
             total       used       free     shared    buffers     cached
Mem:        255700     115016     140684          0       1260      16512
-/+ buffers/cache:      97244     158456
Swap:       262140          0     262140

It looks to me like none of the swap file is being used and I have well over half my memory free. The GUI supports this showing less than 50% RAM being utilized. I have never really seen it go beyond this even when I was having my issues.

Based on the above data, is it safe to say that I have plenty of free memory and the swap file, though configured is not used at all? When I did not have the swap file configured and was getting these memory messages I still had ~50% RAM according to "free".

What could be causing these apparent system wide memory shortages even if the system is reporting plenty of RAM (with or without swapon)?

thanks
I was looking through the posts and have to ask you...when you flashed to merlin did you say you imported a saved configuration from a stock build or did I read that wrong? Sorry if I am way off here...:eek:
 
I was looking through the posts and have to ask you...when you flashed to merlin did you say you imported a saved configuration from a stock build or did I read that wrong? Sorry if I am way off here...:eek:

Yes. I was running the stock ASUS firmware and had many port forwards setup. I have seen several places people discussing doing a flash to merlin and then importing in stock config as the base of most of the the settings is the same. I have not seen anyone state unequivocally that you should not do this, but I get the feeling from your response this is what you're getting at.
 
Yes. I was running the stock ASUS firmware and had many port forwards setup. I have seen several places people discussing doing a flash to merlin and then importing in stock config as the base of most of the the settings is the same. I have not seen anyone state unequivocally that you should not do this, but I get the feeling from your response this is what you're getting at.
Yep. I think for you to know more, or do more, you need to reset and not import a configuration of any kind. Some people can get away with it, but eventually we all have to reset. Take screenshots of settings and give it a try. This situation is just crying for a reset.
 
Yep. I think for you to know more, or do more, you need to reset and not import a configuration of any kind. Some people can get away with it, but eventually we all have to reset. Take screenshots of settings and give it a try. This situation is just crying for a reset.

Yeah, perhaps. I've done this on no less than 3 routers in the past...that is restore settings from stock firmware to hack. In those cases where I had issues and I wiped it turned out to have been something else and not the imported configs. I'll give it a go when I have time - hopefully I can find what file those port forwards are stored in and at least get those copied over.

Nonetheless, even if those values were causing an issue with the underlying OS, you would expect the OS tools to display that issue. Based on what I've seen so far I'm being told their are memory issues when there don't seem to be any. I'm not an expert here thought so hoped to find more insight into how to troubleshoot this. I've been running with the swap file for 6 hours now and don't seem to have any issues even though it shows it isn't in use.

I'm going to turn it off again and see if I have problems.
 
The differences between stock and merlin are quite large. From different drivers to whole features added and even removed like aimesh. Importing setting from a diff fw in this scenario is a bad idea. Also most of the stock is closed source now as well so alot of it merlin cant even see what theyre doing now. Best to do it clean with a reset.
 
Yes. I was running the stock ASUS firmware and had many port forwards setup. I have seen several places people discussing doing a flash to merlin and then importing in stock config as the base of most of the the settings is the same. I have not seen anyone state unequivocally that you should not do this, but I get the feeling from your response this is what you're getting at.
Look in the right places, a Factory default reset is mandatory if you come from stock Asus or some other firmware.
https://www.snbforums.com/threads/asuswrt-merlin-custom-firmware-for-asus-routers.7846/
https://www.snbforums.com/threads/faq-nvram-and-factory-default-reset.22822/
 

Latest threads

Sign Up For SNBForums Daily Digest

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