ygot icon indicating copy to clipboard operation
ygot copied to clipboard

perf(logging): prevent unnecessary processing for debug logging

Open jayzhudev opened this issue 1 year ago • 5 comments

The debug logging calls can consume significant amount of CPU resources at scale because many of them use function call returns directly as arguments. This resulted in expensive functions being called anyway regardless of the value of debugLibrary. This commit prevents such unnecessary processing.

This commit also includes performance improvements from reducing expensive string split calls and using more performant int/uint to ascii conversions.

Here are some rough reference numbers from e2e testing sending 2000 leaf-list updates in a SetRequest:

Version Time
Before #828 ~2,300 ms
After #828 ~1,600 ms

jayzhudev avatar May 01 '23 22:05 jayzhudev

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar May 01 '23 22:05 google-cla[bot]

Note: I'm working on getting my username added to our CLA group. Will keep you posted : )

jayzhudev avatar May 01 '23 22:05 jayzhudev

Update: the CLA check is passing now.

jayzhudev avatar May 02 '23 21:05 jayzhudev

Coverage Status

Coverage: 88.89% (-1.2%) from 90.12% when pulling ad55b2fcaedf93ff83cf35c0048b15ac883f0352 on jayzhudev:logging-perf into cbef8ea8b7af75441628d44165298fcc3e3bf6d4 on openconfig:master.

coveralls avatar May 02 '23 21:05 coveralls

@robshakir for any comments before merge. The coverage decreased because the the debugging statements inside the if statements are not covered. Since these are debugging statements I'm ok with them being uncovered.

wenovus avatar May 22 '23 22:05 wenovus