Is there a recent guide to configuring swap on openwrt? The guide I've seen is on the archive site and I'm have difficulty ascertaining if my swap is misconfigured or just never needed. Is there a way to monitor swap file usage to a file/graph?
So you have 8 GB of RAM, and an SD card allocated as swap. A typical consumer router has anywhere between 32 MB or 1 GB RAM, and no swap at all. And you got 8 GB and you're worried about swap? What's your use case here?
Linux won't swap unless it needs to. And using slow, wear sensitive flash storage like an SD card (which is a sure way to kill it) is a bad idea.
I also set the if field in dd to the device mmcblk where the system lives, which ordinarily would be a terrible idea, but I'm just trying to max out the RAM, because the use case is learning to configure swap on the only openwrt instance I have available to me.
Where am I going wrong with my configuration? Answering a question with another question can be an example of the socratic method, but I don't see to which insights into my misconfiguration your questions lead.
I had nothing of value to your use case. These benchmark test you want to preform are reliant on wiki article's written by @trendy and @Borromini .
I wanted and did the same exact thing trying to push a system beyond the initial config. I too enabled and tested swap but my system never needed it and I to use DD. The system is also used for wbAdmin start backup -backupTarget:\\ doing Block Level Backup, and streams my Kodi Library. This in one system I don't play with or log into.. It works despite the SD Card I burnt out years ago and never replaced.
so .. wait and see if you find your bug. I cant help with that, all I managed to do was divert with Socratic method too; the way I see it.
I don't see anything wrong with your configuration. Htop sees an empty swap partition. Working as intended.
Try increasing swappines on your system and see if that gets you any closer. Way easier would just be to use an old router with limited memory and set up swap there.
Thanks @RuralRoots, however your post answers the question of what is, as the title of the article in the link you posted reads, "The right amount of SWAP".
Do you have any links relevant to the context of my "just never needed" (whilst running dd, disk to disk)?
I'm trying to find out why my openWRT never uses SWAP, even when it clearly could be doing so.
Maybe this would be easier to test with a larger/full linux distro (such as RaspberryPi OS) which takes more resources in general and has apps that can easily fill the full amount of RAM available.
OpenWrt is designed to be really lightweight in terms of storage and RAM requirements (relative to the bigger distros), and therefore you should probably never need swap in normal operation when you have so much RAM available to you.
In fact, I'd argue that if you have 8GB of RAM and need swap while running OpenWrt (any version for the foreseeable future starting in 2022), you're probably doing it wrong. If you are ever actually running such a heavily loaded system in the context of OpenWrt (or routing), you probably need a to consider beefier hardware in general (x86) and/or reconsider the use of a lightweight OS and maybe move to a full OS.
That said, as an academic exercise, measuring your swap performance is fine and you're getting some good advice about how to do it. Remember it is highly dependent on the card you are using, too.
I haven't been able to consume more than half of my memory (4GB) and I have loaded the router with quite a lot of services.
Moreover when you get to use the swap, it will become so slow that it's better if you let it die and restart, than crawling and affecting the overall performance.