Skip to contentSkip to conversation

Memory problem

DISCUSSION Cilliè Burger 2 participants 3 messages Jul 3, 2003 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to Cilliè Burger
Quoted 19 lines · Cilliè Burger

Hi Everyone

I was wondering if anyone has a solution to this problem.

I have a the following box that sits between our router and switch:

Pentium 200, 64 Mbyte RAM, Linux version 2.4.18-3 ([email protected])
(gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-110)), iptables v1.2.5

I almost never reboot this box, but lately I have noticed a dramatic increase in memory consumption.

I start out on bootup with about 40 MB or so free and in a weeks time its down to about 800KB.
When iptables is restarted and the rules flushed and reloaded I reclaim about 6024 KB, which then gradually
decreases back to about a meg in a 16 hour period.

...

Quoted 5 lines

Why does iptables consume so much memory ?
Why does iptables appear to loose so much memory ? When regarding this question, consider the following:

Quoted 9 lines

On reboot and before loading of rules there is about 40 MB free ram. After loading the rules, and about two weeks uptime
there is about 800KB of free memory. After flushing the rules, theres only 6024 KB free.
Is there a slight possibility that this may be due to a memory leak of some sort ?

Thanks in advance for your help. Keep up the good work Netfilter .

Hi Cilliè,

I understand your concerns about memory consumption, but there is no information in your mail showing that the memory used by the firewall is in fact used by connection tracking or any other netfilter kernel structures.

In fact, many Linux admins will tell you that any Linux box that has free memory after system boot will end up using all available memory after a little while: that memory is simply used for buffering and caching filesystem operations.

So in order to get an idea about your box' memory consumption, send us the output of:

cat /proc/meminfo
cat /proc/slabinfo
wc -l /proc/net/ip_conntrack

Regards,
Filip

#0 lore raw

Hi Everyone

I was wondering if anyone has a solution to this problem.

I have a the following box that sits between our router and switch:

Pentium 200, 64 Mbyte RAM, Linux version 2.4.18-3 ([email protected]) (gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-110)), iptables v1.2.5

I almost never reboot this box, but lately I have noticed a dramatic increase in memory consumption.

I start out on bootup with about 40 MB or so free and in a weeks time its down to about 800KB. When iptables is restarted and the rules flushed and reloaded I reclaim about 6024 KB, which then gradually decreases back to about a meg in a 16 hour period.

I run about 400 rules on this box and ipt_conntrack_max is set at 4096.

I do want to add more memory to the box, but i have this strange feeling that it will just consume all of that aswell until it reaches some kind of lower limit on allowable free memory.

Unfortunately I am not sure of how to count the number of simultaneous connection but since we run a few mail and web-servers and also a few busy dns servers. I estimate that there are about 300 connections per second.

My questions, if anyone has payed attention thus far :)

Why does iptables consume so much memory ?
Why does iptables appear to loose so much memory ? When regarding this question, consider the following:

On reboot and before loading of rules there is about 40 MB free ram. After loading the rules, and about two weeks uptime there is about 800KB of free memory. After flushing the rules, theres only 6024 KB free.
Is there a slight possibility that this may be due to a memory leak of some sort ?

Thanks in advance for your help. Keep up the good work Netfilter .

Regards,

Cilliiè Burger
SA-DOMAIN Internet Services

#3 lore raw
In reply to a message not in the archive

Hi Cilliè,

Quoted 31 lines · Cilliè Burger

Here are the details you requested.

cat /proc/meminfo
total: used: free: shared: buffers: cached:

Mem:  63598592 62529536  1069056        0 23306240 19935232
Swap: 200237056  3911680 196325376
MemTotal:        62108 kB
MemFree:          1044 kB
MemShared:           0 kB
Buffers:         22760 kB
Cached:          19192 kB
SwapCached:        276 kB
Active:          26476 kB
Inact_dirty:     14428 kB
Inact_clean:      2428 kB
Inact_target:     8664 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:        62108 kB
LowFree:          1044 kB
SwapTotal:      195544 kB
SwapFree:       191724 kB
Committed_AS:     6052 kB

------------------------------------------------------------

cat /proc/slabinfo
slabinfo - version: 1.1

kmem_cache            61     70    112    2    2    1
ip_conntrack        1193   1628    352  127  148    1

...

Quoted 2 lines
inode_cache        17328  19976    496 2497 2497    1
dentry_cache       17522  23275    112  665  665    1

...

Quoted 1 line

buffer_head 9797 12040 96 272 301 1

...

Quoted 4 lines

wc -l /proc/net/ip_conntrack
1107 /proc/net/ip_conntrack

See, ip_conntrack is only using 1193 * 352 bytes per connection, and the number of connections tracked is quite reasonable.

You can also see that a fair amount of RAM is simply used for caching of filesytem operations (see cached: entry of meminfo output and the inode_cache and dentry_cache in slabinfo output).

So I wouldn't worry about any memory leaks in netfilter connection tracking. The numbers you provided look quite normal.

Regards,
Filip