lowering OSPF memory requirements
Jack Culpepper
jack at newdream.net
Tue Sep 9 10:21:51 CEST 2003
First off, I'll answer my own question: yes those errors are easy to fix. All
I had to do was a headstand, which allowed the yacc to drain back into the
correct section of my brain. Then I added
%token DELAY WAIT BROADCAST
to
obj/conf/cf-parse.y
This made a "configure --disable-client --with-protocols=ospf,static" compile
just fine. I also turned on #define FAKE_SLAB. The binary that came out
works just fine, but the memory footprint is almost exactly the same. Is
there some constant I can reduce so that it won't allocate so much memory up
front? I mean, look at this:
# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.159.100.40 10.171.142.202 255.255.255.252 UG 0 0 0 wlan0wds2
10.143.72.224 10.171.142.202 255.255.255.252 UG 0 0 0 wlan0wds2
10.132.150.44 10.132.166.146 255.255.255.252 UG 0 0 0 wlan0wds0
10.255.32.56 10.171.142.202 255.255.255.252 UG 0 0 0 wlan0wds2
10.171.142.200 * 255.255.255.252 U 0 0 0 wlan0wds2
10.132.166.144 * 255.255.255.252 U 0 0 0 wlan0wds0
10.223.187.136 * 255.255.255.252 U 0 0 0 wlan0wds7
10.145.52.156 * 255.255.255.252 U 0 0 0 wlan0wds1
10.125.134.8 10.171.142.202 255.255.255.248 UG 0 0 0 wlan0wds2
10.127.114.16 * 255.255.255.248 U 0 0 0 wlan0
10.69.144.192 * 255.255.255.248 U 0 0 0 eth0
10.77.41.152 10.171.142.202 255.255.255.248 UG 0 0 0 wlan0wds2
10.87.237.184 10.132.166.146 255.255.255.248 UG 0 0 0 wlan0wds0
10.83.172.184 10.132.166.146 255.255.255.248 UG 0 0 0 wlan0wds0
10.124.26.72 10.171.142.202 255.255.255.248 UG 0 0 0 wlan0wds2
10.80.116.120 10.132.166.146 255.255.255.248 UG 0 0 0 wlan0wds0
10.127.154.176 10.132.166.146 255.255.255.248 UG 0 0 0 wlan0wds0
default 10.171.142.202 0.0.0.0 UG 0 0 0 wlan0wds2
# ps ax
PID Uid VmSize Stat Command
1 root 236 S init
2 root SW [keventd]
3 root SWN [ksoftirqd_CPU0]
4 root SW [kswapd]
5 root SW [bdflush]
6 root SW [kupdated]
144 root 1036 S bird -c /var/tmp/bird.conf -s /var/tmp/bird.ctl
161 root 192 S nc -l -p 3001 -e /bin/brestart
17151 root 328 S /bin/sh
17159 root 256 R ps ax
17160 root 252 S nc 10.69.144.194 5000
# cat /proc/144/status
Name: bird
State: S (sleeping)
Tgid: 144
Pid: 144
PPid: 1
TracerPid: 0
Uid: 0 0 0 0
Gid: 0 0 0 0
FDSize: 256
Groups:
VmSize: 1128 kB
VmLck: 0 kB
VmRSS: 996 kB
VmData: 756 kB
VmStk: 12 kB
VmExe: 152 kB
VmLib: 188 kB
SigPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000001000
SigCgt: 0000000000004201
CapInh: 0000000000000000
CapPrm: 00000000fffffeff
CapEff: 00000000fffffeff
Doesn't it seem like 756 kB is a lot of memory to use when there are only 18
routes in the table? What it is using all that for? My box is really wimpy
and only has 2048 kB RAM. I know OSPF is complicated..but can't I shave a
little more off?
Jack
On Tue, Sep 02, 2003 at 02:19:44PM -0700, Jack Culpepper wrote:
> On Tue, Sep 02, 2003 at 08:38:03PM +0200, Martin Mares wrote:
> > Hi!
> >
> > > I am trying to use bird's OSPF implementation in a memory contrained linux
> > > environment. I have only 2 MB of RAM. Can you give me some tips on how to
> > > reduce the memory footprint of bird running OSPF? It is currently using about
> > > 1 MB, and I would like to try to cut that by 200 KB or so..
> >
> > First of all, configure out all protocols you don't use.
>
> A word about that.. Of "bgp ospf pipe rip static" I only want "ospf static".
> Thus:
>
> ./configure --with-protocols=ospf,static
> (works fine)
>
> However, when I 'make':
>
> .
> .
> m4 -P ../../conf/gen_commands.m4 ../../client/cmds.m4 ../../conf/confbase.Y ../../sysdep/unix/config.Y ../../sysdep/unix/krt.Y ../../sysdep/linux/netlink/netlink.Y ../../nest/config.Y ../../filter/config.Y ../../proto/ospf/config.Y ../../proto/static/config.Y | sort >commands.h
> m4 -P ../../conf/gen_parser.m4 ../../conf/confbase.Y ../../sysdep/unix/config.Y ../../sysdep/unix/krt.Y ../../sysdep/linux/netlink/netlink.Y ../../nest/config.Y ../../filter/config.Y ../../proto/ospf/config.Y ../../proto/static/config.Y >cf-parse.y
> bison -bcf-parse -dv -pcf_ cf-parse.y
> cf-parse.y:1478: symbol DELAY is used, but is not defined as a token and has no rules
> cf-parse.y:1478: symbol WAIT is used, but is not defined as a token and has no rules
> cf-parse.y:1478: symbol BROADCAST is used, but is not defined as a token and has no rules
> make[3]: *** [cf-parse.tab.c] Error 1
> make[3]: Leaving directory `/home/jack/bird-1.0.6/obj/conf'
> make[2]: *** [depend] Error 2
> make[2]: Leaving directory `/home/jack/bird-1.0.6/obj'
> make[1]: *** [.dep-stamp] Error 2
> make[1]: Leaving directory `/home/jack/bird-1.0.6/obj'
> make: *** [all] Error 2
> %
>
> Is this easy to fix?
>
> > Another thing which could help is switching off BIRD's smart allocators to the
> > system ones which are slower, but more memory efficient. You can try changing
> > "#undef FAKE_SLAB" in lib/slab.c to "#define FAKE_SLAB".
>
> Thanks! This is exactly the kind of tip I was hoping for. I'll let the list
> know what happens when I try this.
>
> > (Untested, but could help a lot.) Try linking bird with diet libc (see
> > http://www.fefe.de/dietlibc/) or uclibc (http://www.uclibc.org/).
>
> Thanks, I have been linking with uclibc, which works fine at compile time.
>
> > In any case, I'll be very glad to hear about the result.
>
> It works, although after a while bird gets hung. It doesn't crash, but sending
> a SIGINT has no effect (before the hang this causes a graceful shutdown).
> Instead, it simply stops advertising routes and sits in memory "running". I
> can kill it with a SIGKILL, but I have to reboot to get things working again.
>
> I'm running 1.0.6. BTW, I'm getting a lot of these errors:
>
> nl_parse_link: Malformed message received
>
> ..perhaps this is related to the hanging. Keep in mind that I am running this
> on some little AMD ELAN boxes, with 1 MB flash and 2 MB RAM. I have noticed
> that the hanging happens much more often on one particular box than the rest,
> though they are all running identical software. I.e., this may be a hardware
> issue (though it seems unlikely).
>
> BTW, what is the difference in 1.0.7? Is there are ChangeLog or ReleaseNotes
> file somewhere? I will try upgrading, but it would be nice to know what
> changed..
>
> Many, many thanks,
>
> Jack
More information about the Bird-users
mailing list