-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show bgp ipv4 json detail command increases the Linux VM size dramatically #16643
Comments
will the work in the open PR about memory footprint in vtysh show commands ( #16498 ) help with this - have you tried that diff in this scenario? |
The result is slightly better, but is not zero effort.
My fear is still memory fragmentation, |
what does leak sanitizer say when running that command? |
Assuming I'm looking at the right code, I'm guessing that command emits a json that looks a bit like:
If there are 900k of those, with each having a 10 bytes key and value, you should expect roughly 92MB for in-memory object storage, and definitely no more than that to serialize the object to a string. If you find that your use of the json-c library uses much more than that, open a new issue over in the json-c project (i.e. please don't just piggy-back on json-c/json-c#552) |
Hi Eric, thanks for the quick update. As example, please find an extract of what the output looks like. The below route entry represents one of the 993276 entries present.
The whole file is https://drive.google.com/file/d/1NnXSUX_wuKN2Zcu8r1b8jkjbg63kG8Jx/view?usp=sharing Thanks also for the numbers provided. I do some experiments on memory management:
after:
I could have a global VM size of 2043920 KB instead of 2137220 KB
This is based on the last experiment that I need some help on the json APIs available to build such cases. |
As additional test done, without changing the json model, I could see that the vty_json_no_pretty() function takes a lot of memory.
if the call is not done, the virtual memory size is far better.
Finding out how to optimize the display could help resolve this spike in VM size. |
Description
Under a linux device that received a 900K prefixes full route, if I dump the detailed json output on a file, I can see a dramatic increase in the virtual memory size used.
Virtual Memory size went from 1224200 to 2638212 KB
Resident Memory size went from 1044208 to 2457428 KB
Version
How to reproduce
get a full route setup, wait for stabilisation in the ZEBRA RIB.
Then request bgpd with above command.
Expected behavior
I dont expect a memory increase in VM size
Actual behavior
dramatic increase of VM size
Additional context
This is a full route extract with router peering with a single device.
However, in a real ISP scenario, multiple peering may happen.
Increasing the number of peers increases the memory used.
Checklist
The text was updated successfully, but these errors were encountered: