sonic-net / sonic-buildimage

Scripts which perform an installable binary image build for SONiC
Other
740 stars 1.43k forks source link

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

Closed vivekrnv closed 1 month ago

vivekrnv commented 2 months ago

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 commented 2 months ago

@SviatoslavBoichuk FYI for banner config

gechiang commented 2 months ago

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