[counters][202205] Improve performance by polling only configured ports buffer queue/pg counters #2474
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This reverts commit 8eea92e.
Signed-off-by: Vadym Hlushko vadymh@nvidia.com
Propagating sonic-swss/pull/2143 with resolved merge conflicts
Depends on:
sonic-utilities/pull/2239
sonic-utilities/pull/2406
sonic-mgmt/pull/6431
What I did
Currently, in SONiC all ports queue and pg counters are created by default with the max possible amount of counters.
This feature changes this behavior to poll only configured counters provided by the config DB BUFFER_PG and BUFFER_QUEUE tables.
If no tables are present in the DB, no counters will be created for ports.
Filter the unwanted queues/pgs returned by SAI API calls and skip the creation of these queue/pg counters.
Also, allow creating/removing counters on runtime if buffer PG/Queue is configured or removed.
Why I did it
Improve performance by filtering unconfigured queue/pg counters on init.
How I verified it
Check after enabling the counters, if configured counters are created in Counters DB according to the configurations.
Add/Remove buffer PG/Queue configurations and observe the corresponding counters created/removed accordingly.
New UT was added to verify this flow.
Details if related