-
Notifications
You must be signed in to change notification settings - Fork 906
Improve facts gathering while creating SonicHost instance #21442
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
base: master
Are you sure you want to change the base?
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
lolyu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the running time usingsonic_basic_facts?
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
I didn't measure the running time of |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
The SonicHost __init__ method needs to run multiple commands on the SONiC host to gather some basic facts. Execution of each command has some overhead. To improve the performance, multi threads were introduced to run the commands in parallel. It looks like a over kill. In some scenarios, it will cause multiple threads in multiple threads and could make things even more complicated. What's more, getting versions still need to run commands on SONiC host multiple times. To simplify the procedure of gathering facts and ensure performance at the same time, this change introduced a new customized ansible module `sonic_basic_facts.py`. This module will be executed on SONiC host and use various methods to directly gather facts: * call sonic_py_common library * read from config_db using DB connector * read files The time requred to run the `sonic_basic_facts` module is similiar as running a single command on the SONiC device. By this method, the code for gathering facts is significantly simplified with even better performance. When there is no cache, run a script may need 10 seconds less. The __init__ method of MultiAsicSonicHost is also updated to use gathered facts instead of running the config_facts module which is a little bit slow and produces too much log. Signed-off-by: Xin Wang <[email protected]>
b316cc9 to
6bc1457
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Description of PR
Summary:
Fixes # (issue)
Type of change
Back port request
Approach
What is the motivation for this PR?
The SonicHost init method needs to run multiple commands on the SONiC host to gather some basic facts. Execution of each command has some overhead. To improve the performance, multi threads were introduced to run the commands in parallel. It looks like an over kill. In some scenarios, it will cause multiple threads in multiple threads and could make things even more complicated. What's more, getting versions still need to run commands on SONiC host multiple times.
How did you do it?
To simplify the procedure of gathering facts and ensure performance at the same time, this change introduced a new customized ansible module
sonic_basic_facts.py. This module will be executed on SONiC host and use various methods to directly gather facts:sonic_basic_factsmodule is similiar as running a single command on the SONiC device. By this method, the code for gathering facts is significantly simplified with even better performance. When there is no cache, run a script may need 10 seconds less.The init method of MultiAsicSonicHost is also updated to use gathered facts instead of running the config_facts module which is a little bit slow and produces too much log.
How did you verify/test it?
Tested on KVM testbed.
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation