Skip to content
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

[flex-counters] Delay flex counters stats init for faster boot time #1749

Merged
merged 3 commits into from
Jun 14, 2021
Merged

[flex-counters] Delay flex counters stats init for faster boot time #1749

merged 3 commits into from
Jun 14, 2021

Conversation

shlomibitton
Copy link
Contributor

Signed-off-by: Shlomi Bitton shlomibi@nvidia.com

What I did
Update flex counters DB with counters stats only when counters are enabled.
As long as the polling counters are not enabled, flex counters information will stored internally on PortsOrch.

Why I did it
Creating flex counters objects on the DB will trigger 'SYNCD' to access the HW for query statistics capabilities.
This HW access takes time and will be better to finish boot before doing this (mainly for fast-reboot but good to have in general).
The flex counters are not crucial at boot time, we can delay it to the end of the boot process.

How I verified it
Reboot a switch and observer the flex counters DB populated after counters are enabled.

Details if related

@liat-grozovik
Copy link
Collaborator

@shlomibitton please resolve conflicts for the review to start.

Add flex counters unit-test

Signed-off-by: Shlomi Bitton <shlomibi@nvidia.com>
@shlomibitton
Copy link
Contributor Author

@shlomibitton please resolve conflicts for the review to start.

@liat-grozovik done.

@liat-grozovik
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liat-grozovik
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liat-grozovik
Copy link
Collaborator

@qiluo-msft kindly reminder. we need the fix merged in order to test fastboot and get some improvements.

@qiluo-msft qiluo-msft requested a review from yxieca June 7, 2021 07:13
@qiluo-msft
Copy link
Contributor

qiluo-msft commented Jun 7, 2021

Compared with #1646, what are changed?


In reply to: 855660011

@shlomibitton
Copy link
Contributor Author

Compared with #1646, what are changed?

This is with the fix to the bug where PORT_STAT is empty on COUNTERS DB as a result of query port counter statistics from the CPU interface.
A unit test improvements added as well.
As you requested this PR include the previous changes, the fix and the unit tests.

Copy link
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As comments

@qiluo-msft qiluo-msft self-requested a review June 10, 2021 15:50
@qiluo-msft qiluo-msft dismissed their stale review June 10, 2021 15:51

Not to block, only minor issue remains.

std::unordered_set<std::string> counter_stats;
for (const auto& it: port_stat_ids)
auto flex_counters_orch = gDirectory.get<FlexCounterOrch*>();
/* Delay installing the counters if they are yet enabled
Copy link
Contributor

@qiluo-msft qiluo-msft Aug 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delay

How long do you delay? I cannot find the constant in code. How did you test the delay? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qiluo-msft please check this file:
https://github.com/Azure/sonic-buildimage/blob/master/dockers/docker-orchagent/enable_counters.py#L55
it will enable the counters on CONFIG DB, we handle this change here:
https://github.com/Azure/sonic-swss/pull/1749/files#diff-77a2299548b8c0b1cfa565b28cdc46051dbb6c325d91011fab5fe9df283a03c8R112
and then update m_port_counter_enabled = true
If the counter is already enabled, the normal flow will take place like it used to be before.

raphaelt-nvidia pushed a commit to raphaelt-nvidia/sonic-swss that referenced this pull request Oct 5, 2021
…onic-net#1749)

**What I did**
Update flex counters DB with counters stats only when counters are enabled.
As long as the polling counters are not enabled, flex counters information will stored internally on PortsOrch.

**Why I did it**
Creating flex counters objects on the DB will trigger 'SYNCD' to access the HW for query statistics capabilities.
This HW access takes time and will be better to finish boot before doing this (mainly for fast-reboot but good to have in general).
The flex counters are not crucial at boot time, we can delay it to the end of the boot process.

**How I verified it**
Reboot a switch and observer the flex counters DB populated after counters are enabled.
raphaelt-nvidia pushed a commit to raphaelt-nvidia/sonic-swss that referenced this pull request Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants