FDio / govpp

Go toolset for the VPP.
Apache License 2.0
185 stars 81 forks source link

Memory benchmark #186

Closed VladoLavor closed 3 months ago

VladoLavor commented 5 months ago

I have added a simple API memory benchmark/test.

Example output:

Running GoVPP API calls memory test
For 100000 show-version calls:
        Measured    Threshold
-----------------------------------------
Total alloc:    424.57 MB   250.00 MB
Memory Freed:   5.22 MB 
Heap alloc: 1.92 MB     5.00 MB 
Objects alloc:  5,499,561
Obj freed:  5,476,772
Objects remain: 22,789      50,000
Message rate:   11534 m/s
Num goroutines: 8
Duration:   8.669396593s

For 100000 create/delete loopback calls:
        Measured    Threshold
-----------------------------------------
Total alloc:    284.17 MB   350.00 MB
Memory Freed:   3.89 MB 
Heap alloc: 2.18 MB     5.00 MB 
Objects alloc:  4,108,089
Obj freed:  4,079,319
Objects remain: 28,770      50,000
Message rate:   9863 m/s
Num goroutines: 8
Duration:   10.138160233s

It measures 1k, 10k, 100k, and 1M APIs by default. A custom number of APIs can be tested with the -api-num parameter. Thresholds are pre-defined only for default values. The test runs the GetVersion API, which can be called indefinitely.

Signed-off-by: Vladimir Lavor vlavor@cisco.com