Memory limit, kswapd, and sluggishness

I’m running node red on my board and I’m close to the memory capacity. Kswapd kicks and and I/O ops make the system incredibly slow. Node red loses its connection to Blynk and MQTT until kswapd finishes. I’ve tried tweaking vm and up-prioritizing node-red and mosquitto. Any ideas what to do next?

If you are running up against memory limitations, the best thing to try is reducing services that aren’t needed. I’ve not tried node red so I’m not sure what all services are needed.

I saw that swap was disabled. Never having done it before, do you think I could recompile the kernel to add swap? Can the giantboard-tool script be used to do that? Can that be done on the board or do I need to spin up a debian distro or is Mac ok?

There’s no need to recompile the kernel to enable swap, you can follow any Debian guide on enabling a swap file. You will likely still run into sluggishness as swapping is still pretty slow. You may also quickly use up all of the write cycles on your SD card if you constantly need the swap, which is why it’s disabled by default.

I’m following the guide here:


On Step 4:
sudo swapon /swapfile
I get:
swapon: /swapfile: swapon failed: Function not implemented

Wouldn’t wear leveling keep the sd card from premature failure?

After doing a bit a reading, it does appear you need to enable it in the kernel.
https://cateee.net/lkddb/web-lkddb/SWAP.html
Its pretty well known that SD cards don’t take a lot of writes well. Its likely that it would fail prematurely if you use it all the time as swap.

Had a similar problem installing Python 3.7 or later.
lost a lot of time and ended up changing the code of the script, was easier hehe