Talked about this before

Hi,

Quick Question, how much memory does the bgp tables actually take. I'm
estimating 32 mb in my plan, but I'm worried that's not enough.

Thanks,

Jane

"Jane" == Pawlukiewicz Jane <pawlukiewicz_jane@bah.com> writes:

    > Hi,

Good morning.

    > Quick Question, how much memory does the bgp tables actually
    > take. I'm estimating 32 mb in my plan, but I'm worried
    > that's not enough.

I guess that depends which BGP implementation you're using... And the
number of sessions with full routes... route-views.oregon-ix.net seems
to be using about 215Mb, but it has a lot of peers.

"Jane" == Pawlukiewicz Jane <pawlukiewicz_jane@bah.com> writes:

    > Quick Question, how much memory does the bgp tables actually
    > take. I'm estimating 32 mb in my plan, but I'm worried
    > that's not enough.

that was 320Mb, no? :wink:

>>> "Jane" == Pawlukiewicz Jane <pawlukiewicz_jane@bah.com> writes:

    > Quick Question, how much memory does the bgp tables actually
    > take. I'm estimating 32 mb in my plan, but I'm worried
    > that's not enough.

that was 320Mb, no? :wink:

Here is a show ip bgp summ from a router with 2 full views and 6 iBGP
peers, and a couple of customer peers with < 10 routes each:

BGP router identifier 209.196.121.1, local AS number 4278
BGP table version is 7175400, main routing table version 7175400
112794 network entries and 505980 paths using 33655314 bytes of memory
89941 BGP path attribute entries using 5037424 bytes of memory
44221 BGP AS-PATH entries using 1134058 bytes of memory
63070 BGP route-map cache entries using 1261400 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
Dampening enabled. 127 history paths, 118 dampened paths
223243 received paths for inbound soft reconfiguration
BGP activity 219567/1719967 prefixes, 5720413/5214433 paths, scan
interval 60 secs

also fyi

#sh ver
IOS (tm) RSP Software (RSP-JK8SV-M), Version 12.2(8)T4, RELEASE SOFTWARE (fc1)

#sh ip bgp sum
113668 network entries and 263570 paths using 21568596 bytes of memory
83881 BGP path attribute entries using 5034840 bytes of memory
24724 BGP AS-PATH entries using 637716 bytes of memory
16 BGP community entries using 384 bytes of memory
77639 BGP route-map cache entries using 1242224 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
Dampening enabled. 211 history paths, 234 dampened paths
BGP activity 286636/18319023 prefixes, 13135930/12871489 paths, scan interval 60
secs

#sh mem sum
                Head Total(b) Used(b) Free(b) Lowest(b) Largest(b)
Processor 62AADE40 223683008 126211276 97471732 87582336 93694864
     Fast 62A8DE40 131080 82776 48304 48304 48252

Probably not. I assume you're talking about Cisco? I've done some
calculations under different circumstances, but the results vary. I think
the IOS version and CPU architecture have something to do with that. And
then there's stuff like average AS path length and how many other
attributes, such as communities, routes tend to have. Quick rule of thumb:
about 300 bytes per BGP route, where each route from each peer counts
seperately.

Don't forget you also need a routing table, which uses about the same
(maybe slightly less) per entry, but there is only one entry in the
routing table per destination prefix (unless you do load balancing).
Finally, you're probably running CEF so that's another several hundred
bytes per destination (this one seems to vary the most).

A quick guestimate would be:

    (# full BGP views + 2) * global routing table size * 300 bytes

I tried to figure out the numbers for Zebra just the other day, and they
were surprisingly similar.

Two views:

hln-cs1#sh ip bgp summ
BGP router identifier 206.127.65.1, local AS number 4043
BGP table version is 132881, main routing table version 132881
112575 network entries and 336143 paths using 24365495 bytes of memory
60397 BGP path attribute entries using 3624720 bytes of memory
53004 BGP AS-PATH entries using 1426946 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
20536 BGP filter-list cache entries using 246432 bytes of memory
Dampening enabled. 96 history paths, 45 dampened paths
111752 received paths for inbound soft reconfiguration
BGP activity 112575/456 prefixes, 336319/176 paths, scan interval 15 secs

That said:

hln-cs1#sh mem
                Head Total(b) Used(b) Free(b) Lowest(b)
Largest(b)
Processor 623C83E0 219380768 117525008 101855760 100536360
100521172
      I/O F500000 11534336 8157292 3377044 3365952
3352444

By the time you populate the routing table and/or cef, and do a few other
things, you probably want at least 256MB.

If you are using something else, YMMV - it all depends on how efficient
the software is at storing it in memory.

- Forrest W. Christian (forrestc@imach.com) AC7DE

Forrest W. Christian wrote:

Quick Question, how much memory does the bgp tables actually take. I'm
estimating 32 mb in my plan, but I'm worried that's not enough.

Two views:

hln-cs1#sh ip bgp summ
BGP router identifier 206.127.65.1, local AS number 4043
BGP table version is 132881, main routing table version 132881
112575 network entries and 336143 paths using 24365495 bytes of memory
60397 BGP path attribute entries using 3624720 bytes of memory
53004 BGP AS-PATH entries using 1426946 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
20536 BGP filter-list cache entries using 246432 bytes of memory
Dampening enabled. 96 history paths, 45 dampened paths
111752 received paths for inbound soft reconfiguration
BGP activity 112575/456 prefixes, 336319/176 paths, scan interval 15 secs

That said:

hln-cs1#sh mem
                Head Total(b) Used(b) Free(b) Lowest(b)
Largest(b)
Processor 623C83E0 219380768 117525008 101855760 100536360
100521172
      I/O F500000 11534336 8157292 3377044 3365952
3352444

By the time you populate the routing table and/or cef, and do a few other
things, you probably want at least 256MB.

If you are using something else, YMMV - it all depends on how efficient
the software is at storing it in memory.

And add to that the below, noting the 20%+ difference between what the process holds and what is reported via the bgp commands :

router#sh proc mem
Total: 226435680, Used: 98336472, Free: 128099208
  PID TTY Allocated Freed Holding Getbufs Retbufs Process
    0 0 98188 1848 5744500 0 0 *Init*
    0 0 716 473572020 716 0 0 *Sched*
    0 0 1695597520 282572480 48536 182184 0 *Dead*
...
  103 0 394643684 1139584448 91248608 13000 0 BGP Router
...

router#sh ip bgp sum
BGP table version is 45578905, main routing table version 45578905
112990 network entries and 338257 paths using 23363262 bytes of memory
59466 BGP path attribute entries using 3568080 bytes of memory
52666 BGP AS-PATH entries using 1780032 bytes of memory
1 BGP community entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP activity 7862100/10119105 prefixes, 24954823/24616566 paths, scan interval 60 secs

router#sh mem
                 Head Total(b) Used(b) Free(b) Lowest(b) Largest(b)
Processor 6210DDA0 226435680 98330588 128105092 122426928 124143936
       I/O F900000 7340032 2345240 4994792 4859760 4994748

FYI, 3660 w/256MB and 3 transit peers with 112K+ routes each.