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

Replace sonic-cfggen with sonic-db-cli in banner-config & hostname-config #20048

Closed
vivekrnv opened this issue Aug 28, 2024 · 2 comments · Fixed by #20232
Closed

Replace sonic-cfggen with sonic-db-cli in banner-config & hostname-config #20048

vivekrnv opened this issue Aug 28, 2024 · 2 comments · Fixed by #20232
Assignees
Labels
NVIDIA Triaged this issue has been triaged

Comments

@vivekrnv
Copy link
Contributor

Description

sonic-cfggen is an expensive call to make especially on devices with weaker CPU's

Eg:

root@sn2700:/home/admin# time sonic-cfggen

real	0m0.484s
user	0m0.414s
sys	0m0.069s

root@sn2700/home/admin# time sonic-cfggen -d -v 'BANNER_MESSAGE["global"]["state"]'
disabled

real	0m0.726s
user	0m0.507s
sys	0m0.090s

root@rsn2700:/home/admin# time sonic-db-cli CONFIG_DB HGET "BANNER_MESSAGE|global" state
disabled

real	0m0.016s
user	0m0.014s
sys	0m0.001s

Services like banner-config, hostname-config just read from CONFIG_DB and proceed with their own stuff. Profiling with would show this.

These services complete with swss start and add some lantency to the overall control plan downtime during WR/FW.

image image

There are straightforward calls to DB which doesn't require sonic-cfggen

@vivekrnv vivekrnv changed the title [WR/FR Optimization] Replace sonic-cfggen with sonic-db-cli in banner-config & hostname-config Replace sonic-cfggen with sonic-db-cli in banner-config & hostname-config Aug 28, 2024
@vivekrnv
Copy link
Contributor Author

@SviatoslavBoichuk FYI for banner config

@gechiang gechiang added Help Wanted 🆘 Triaged this issue has been triaged labels Aug 28, 2024
@gechiang
Copy link
Collaborator

@vaibhavhd FYI... this may be of interest to you.
Thanks!

@vivekrnv vivekrnv self-assigned this Sep 24, 2024
qiluo-msft pushed a commit that referenced this issue Oct 4, 2024
### Why I did it

Fix #20048

It is explained in ticket above, how sonic-cfggen calls in the hostname.sh, pcie-check.sh and banner-config and hogging the CPU and slightly delaying the start of swss

**pcie-check.sh**
redis-cli call is also replaced with sonic-db-cli since redis-cli is a wrapper around the actual redis-cli under database container
<img width="1113" alt="image" src="https://github.com/user-attachments/assets/bed9d055-3b9f-4f75-aabd-1e0335716396">

**swss start**
If the SKU has create_only_config_db_buffers.json set to true, the only config that's updated today is. 
```
{
    "DEVICE_METADATA": {
        "localhost": {
            "create_only_config_db_buffers": "true"
        }
    }
}
```
We use sonic-cfggen which cause 1.5 sec delay in the start of swss container. Thus replace with sonic-db-cli. If a complex use case arises in future, this can be updated.
<img width="1483" alt="Screenshot 2024-09-16 at 12 45 05 PM" src="https://github.com/user-attachments/assets/ee3248b5-7623-42c4-9b50-81b114c71ae7">


### How I did it

#### How to verify it

**Note: Everything was tested on MSN2700 device, Intel Celeron CPU with 2 cores**

- 1.5 sec saved in the swss container start
<img width="1298" alt="image" src="https://github.com/user-attachments/assets/817739f1-26a2-41ad-89e4-1e76e31532ac">

- 1.6 sec saved in the start of swss service. Previously, it took almost 1.8 sec after config-setup is finished for the swss to start. After replacing the calls, it start almost 0.2 sec after config-setup is finished

In total, anywhere between 2.5 - 3.5 sec is saved
saksarav-nokia pushed a commit to saksarav-nokia/sonic-buildimage that referenced this issue Oct 9, 2024
…et#20232)

### Why I did it

Fix sonic-net#20048

It is explained in ticket above, how sonic-cfggen calls in the hostname.sh, pcie-check.sh and banner-config and hogging the CPU and slightly delaying the start of swss

**pcie-check.sh**
redis-cli call is also replaced with sonic-db-cli since redis-cli is a wrapper around the actual redis-cli under database container
<img width="1113" alt="image" src="https://github.com/user-attachments/assets/bed9d055-3b9f-4f75-aabd-1e0335716396">

**swss start**
If the SKU has create_only_config_db_buffers.json set to true, the only config that's updated today is. 
```
{
    "DEVICE_METADATA": {
        "localhost": {
            "create_only_config_db_buffers": "true"
        }
    }
}
```
We use sonic-cfggen which cause 1.5 sec delay in the start of swss container. Thus replace with sonic-db-cli. If a complex use case arises in future, this can be updated.
<img width="1483" alt="Screenshot 2024-09-16 at 12 45 05 PM" src="https://github.com/user-attachments/assets/ee3248b5-7623-42c4-9b50-81b114c71ae7">


### How I did it

#### How to verify it

**Note: Everything was tested on MSN2700 device, Intel Celeron CPU with 2 cores**

- 1.5 sec saved in the swss container start
<img width="1298" alt="image" src="https://github.com/user-attachments/assets/817739f1-26a2-41ad-89e4-1e76e31532ac">

- 1.6 sec saved in the start of swss service. Previously, it took almost 1.8 sec after config-setup is finished for the swss to start. After replacing the calls, it start almost 0.2 sec after config-setup is finished

In total, anywhere between 2.5 - 3.5 sec is saved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NVIDIA Triaged this issue has been triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@vivekrnv @gechiang and others