Page 1 of 1
How to reduce memory use?
Posted: Thu Apr 24, 2014 11:24 pm
by macsrwe
I have an OmniTik tower that also serves as a gateway router. It's limited to 32MB. Recently, I've been getting out-of-memory crashes on it. When I checked on it, it was running with 5MB free, and for short periods as little as 800K. I can't find a way to determine what's actually using memory, so I've been guessing in an attempt to free some more up.
I cut the logging memory down to 100 lines (no appreciable change); disabled the openflow package which I had installed planning to use it later (saved about 1MB), deleted a bunch of disabled rules from my firewall (no change), and looked for queue trees (there wasn't any -- all there was was a single simple queue for one attached user). I have about 90 active firewall rules, all of which do necessary stuff. I could disable ipv6 if I really had to, I'd just feel antisocial.
I looked at tools profile. Most of the time, the router is 82% idle. Every so often there is a spike in flash and management, which I suspect is just log lines writing to disk. Every so often, CPU briefly spikes to 100% in the Winbox menu bar, but it's not easy to catch the reason in profile.
I have a hard time believing that this router needs 26MB for what I ask it to do, but maybe I'm overlooking something. It does NAT about 60 machines, so maybe this is a factor. Again, there's no way I can find to ask the router to simply tell me where all this memory is going. I can't even find the packages' memory requirements in the wiki.
Where else should I look? What else should I cut?
Re: How to reduce memory use?
Posted: Fri Apr 25, 2014 2:14 am
by MovingNetworksFwd
I can help you with this, if you let me connect to this unit with a read only user I can find exactly whats causing it, if you don't want to give out access (which I understand) I should be able to work with a supout file if you attach it here.
Ryan
Re: How to reduce memory use?
Posted: Fri Apr 25, 2014 10:40 am
by jarda
Just reveal how to check memory usage distribution. I am also going to hit the memory limit on some devices and I would like to know what is the reason.
Re: How to reduce memory use?
Posted: Tue Apr 29, 2014 12:09 am
by MovingNetworksFwd
Because there are so many variables that can use disk space/memory you will need to login to your Mikrotik account and upload the supout.rif file to let it tell you what all is on the system. You can at this point start removing/disabling the various files/packages causing the problem.
Ryan
Edited for clarity.
Re: How to reduce memory use?
Posted: Tue Apr 29, 2014 1:20 am
by jarda
This is not about disk usage but about memory usage.
Re: How to reduce memory use?
Posted: Tue Apr 29, 2014 1:32 am
by MovingNetworksFwd
This is not about disk usage but about memory usage.
There is a memory mapping section in the supout file that can be viewed within your Mikrotik account.
Re: How to reduce memory use?
Posted: Tue Apr 29, 2014 3:59 am
by slawekk
Do you use DNS/Hotspot/Web proxy?
If yes then check how high memory limit was set for this services.
Re: How to reduce memory use?
Posted: Tue Apr 29, 2014 6:42 am
by macsrwe
Good points.
I do use DNS. Cache was set to 4M, is currently using 1.6M. I brought the limit down to 1.4M to see if that helped.
I also use proxy, but only to show a "pay me" screen to users with overdue accounts. Since I haven't had any for months, it wasn't using any memory.
I don't use Hotspot.
Here is the information from the Resources portion of the supout for an "out of memory" crash. It doesn't say much useful to me.
MEMORY
MemTotal: 29376 kB
MemFree: 1132 kB
Buffers: 0 kB
Cached: 9732 kB
SwapCached: 0 kB
Active: 10944 kB
Inactive: 4760 kB
Active(anon): 6448 kB
Inactive(anon): 96 kB
Active(file): 4496 kB
Inactive(file): 4664 kB
Unevictable: 236 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 6228 kB
Mapped: 5240 kB
Shmem: 336 kB
Slab: 7772 kB
SReclaimable: 1960 kB
SUnreclaim: 5812 kB
KernelStack: 488 kB
PageTables: 636 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 14688 kB
Committed_AS: 13032 kB
VmallocTotal: 261940 kB
VmallocUsed: 28108 kB
VmallocChunk: 226980 kB
Re: How to reduce memory use?
Posted: Tue Apr 29, 2014 2:34 pm
by Valentina
It seems my Mikrotik affected too
I updated RouterOS to 6.7 and after that memory leak started. Memory usage used to be about 30MB before update.
What is SUnreclaim? Can it be used by OS?
MEMORY
MemTotal: 126840 kB
MemFree: 2772 kB
Buffers: 0 kB
Cached: 23812 kB
SwapCached: 0 kB
Active: 14560 kB
Inactive: 16860 kB
Active(anon): 9108 kB
Inactive(anon): 64 kB
Active(file): 5452 kB
Inactive(file): 16796 kB
Unevictable: 1480 kB
Mlocked: 1256 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 9108 kB
Mapped: 7560 kB
Shmem: 328 kB
Slab: 86504 kB
SReclaimable: 3252 kB
SUnreclaim: 83252 kB
KernelStack: 504 kB
PageTables: 692 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 63420 kB
Committed_AS: 72472 kB
VmallocTotal: 261940 kB
VmallocUsed: 51568 kB
VmallocChunk: 201496 kB
Re: How to reduce memory use?
Posted: Wed Apr 30, 2014 7:12 am
by slawekk
ros code
uptime: 3w6d6m9s
version: 6.9
build-time: Jan/31/2014 11:18:19
free-memory: 7.6MiB
total-memory: 32.0MiB
cpu: MIPS 24Kc V7.4
cpu-count: 1
cpu-frequency: 400MHz
cpu-load: 16%
free-hdd-space: 47.9MiB
total-hdd-space: 64.0MiB
write-sect-since-reboot: 4145994
write-sect-total: 7842732
bad-blocks: 0%
architecture-name: mipsbe
board-name: RB OmniTIK U-5HnD
platform: MikroTik
3 cpe nv2 a/n 20mhz ospf routed network some vlans bridged and few firewall filter rules
no: nat/dns/hotpot/pppoe
Try to lower the memory limit for DNS to minimum, you get more space for testing and less kernel panics.
Re: How to reduce memory use?
Posted: Thu Sep 21, 2023 10:32 am
by gh05t
Hi,
Just wanted to chime in.
I had a similar problem just now with my hAP AC2 with 128mb RAM. had a disconnect just a few min ago where the router rebooted due to running out of RAM.
I just tracked my problem down... it was the MTU setting.
I recently increased it to use jumbo frames of 9000.
Once I turned that setting off it went right back to 50% constant usage.
Maybe some mikrotik guru can explain to me why jumbo frames are using so much of my memory. Is it that it needs to keep track of all the jumbo frames or something?
As a side note: my supout.rif file didn't have a -- SECTION MEMORY for some reason.