Community discussions

MikroTik App
 
User avatar
macsrwe
Forum Guru
Forum Guru
Topic Author
Posts: 1007
Joined: Mon Apr 02, 2007 5:43 am
Location: Arizona, USA
Contact:

How to reduce memory use?

Thu Apr 24, 2014 11:24 pm

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?
 
MovingNetworksFwd
Frequent Visitor
Frequent Visitor
Posts: 61
Joined: Tue Feb 18, 2014 1:50 am
Location: Arkansas
Contact:

Re: How to reduce memory use?

Fri Apr 25, 2014 2:14 am

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
 
jarda
Forum Guru
Forum Guru
Posts: 7756
Joined: Mon Oct 22, 2012 4:46 pm

Re: How to reduce memory use?

Fri Apr 25, 2014 10:40 am

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.
 
MovingNetworksFwd
Frequent Visitor
Frequent Visitor
Posts: 61
Joined: Tue Feb 18, 2014 1:50 am
Location: Arkansas
Contact:

Re: How to reduce memory use?

Tue Apr 29, 2014 12:09 am

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.
Last edited by MovingNetworksFwd on Tue Apr 29, 2014 1:34 am, edited 1 time in total.
 
jarda
Forum Guru
Forum Guru
Posts: 7756
Joined: Mon Oct 22, 2012 4:46 pm

Re: How to reduce memory use?

Tue Apr 29, 2014 1:20 am

This is not about disk usage but about memory usage.
 
MovingNetworksFwd
Frequent Visitor
Frequent Visitor
Posts: 61
Joined: Tue Feb 18, 2014 1:50 am
Location: Arkansas
Contact:

Re: How to reduce memory use?

Tue Apr 29, 2014 1:32 am

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.
 
slawekk
just joined
Posts: 24
Joined: Sun Jan 02, 2011 3:48 pm

Re: How to reduce memory use?

Tue Apr 29, 2014 3:59 am

Do you use DNS/Hotspot/Web proxy?
If yes then check how high memory limit was set for this services.
 
User avatar
macsrwe
Forum Guru
Forum Guru
Topic Author
Posts: 1007
Joined: Mon Apr 02, 2007 5:43 am
Location: Arizona, USA
Contact:

Re: How to reduce memory use?

Tue Apr 29, 2014 6:42 am

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
 
Valentina
just joined
Posts: 1
Joined: Thu Jul 11, 2013 6:18 pm
Location: Russia, Samara

Re: How to reduce memory use?

Tue Apr 29, 2014 2:34 pm

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
 
slawekk
just joined
Posts: 24
Joined: Sun Jan 02, 2011 3:48 pm

Re: How to reduce memory use?

Wed Apr 30, 2014 7:12 am

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.
 
gh05t
just joined
Posts: 7
Joined: Mon Jul 17, 2023 4:32 am

Re: How to reduce memory use?

Thu Sep 21, 2023 10:32 am

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.

Who is online

Users browsing this forum: Amazon [Bot], Bing [Bot], jaisal, pav5, sindy, Tony93, vagrik and 220 guests