openvswitch / ovs-issues

Issue tracker repo for Open vSwitch
10 stars 3 forks source link

Start and stop dhcp flapping traffic, the OVS memory decreases but does not decrease to the initial value. #283

Open coolMarlon opened 1 year ago

coolMarlon commented 1 year ago

Test:

I am doing some test on OVS, i tried to inject DHCP flapping traffic to generate CLS flows with source IP address and source MAC address changes.

image

Phenomenon

DHCP flapping traffic triggers “FLOW MISS”,Thus, generate a large number of CLS Flow(30K+) image

I found when I inject traffic, the memory of ovs-vswitchd will increased from 150MB to 330MB. When i stop injecting traffic, the memory decreases to 210 MB, not 150MB(initial value).

Quesiton

I'm not sure if this is a memory leak. The OVS I use has some modifications of its own. I want to test opensource OVS whether have same problem, but it is difficult to consturct such environmet. I used valgrind to start ovs, but i can not find memory leak in log.

It is diffuicult to analyize why after injecting traffic, the memory is not restored to the initial value? Do you have some advice? thanks.

igsilya commented 1 year ago

@coolMarlon glibc has issues with releasing small memory chunks back to the system. So, even if OVS free()d the memory, it doesn't mean it will actually be returned to the system, unless we explicitly call malloc_trim(). OVS doesn't trim the memory explicitly today. You can test that theory by adding malloc_trim() call to the main loop in ovs-vswitchd, or by trying a different memory allocator that doesn't have this kind of issues, e.g. jemalloc (at least older versions of it).