-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[Static DNS] Optimize DNS configuration update during interface-config service restart #19583
[Static DNS] Optimize DNS configuration update during interface-config service restart #19583
Conversation
…g service restart
/azpw ms_conflict |
1 similar comment
/azpw ms_conflict |
@@ -1,6 +1,11 @@ | |||
#!/bin/bash | |||
|
|||
for container in $(docker ps -a --format=" {{ .ID }}"); do | |||
networking_status=$(systemctl is-active networking.service 2>/dev/null) |
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.
why do you need this change?
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.
This is a performance optimization. We don't need to update the containers if the networking is inactive. When the networking is back online, one more update will be triggered. This reduces fast/warm reboot time on devices with weak CPUs.
exit 0 | ||
fi | ||
|
||
for container in $(docker ps -q); do |
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.
Why do you use "docker ps -q" to replace "docker ps -a"?
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.
docker ps -a
returns a list of all available containers (active and inactive). docker ps -q
returns a list of running containers. We want to update only running containers. For the inactive containers docker will uptade /etc/resolv.conf
file automatically during the container start. So they will always have up-to-date configuration.
…g service restart (sonic-net#19583) #### Why I did it The `resolvconfig` service updates the DNS configuration in the host OS and each running Docker container when a configuration change is detected. The DNS configuration update during the shutdown of the management interface is redundant, as the management interface is going down temporarily and, when it is back online, the DNS configuration will remain the same. The update of the DNS configuration adds a couple of seconds (depending on the CPU) to the interface-config service restart time when the management interface uses a dynamic IP address. This can affect the fast boot. To optimize the flow and execute the service restart faster, the update should be skipped. #### How I did it Do not run DNS configuration update during the shutdown of the management interface. #### How to verify it Measure the execution time of the `service interfaces-config restart` command on the device with the static IP address configuration on the management interface and compare it to the execution time of the same command with the dynamic IP address. The difference should be insignificant.
…g service restart (sonic-net#19583) #### Why I did it The `resolvconfig` service updates the DNS configuration in the host OS and each running Docker container when a configuration change is detected. The DNS configuration update during the shutdown of the management interface is redundant, as the management interface is going down temporarily and, when it is back online, the DNS configuration will remain the same. The update of the DNS configuration adds a couple of seconds (depending on the CPU) to the interface-config service restart time when the management interface uses a dynamic IP address. This can affect the fast boot. To optimize the flow and execute the service restart faster, the update should be skipped. #### How I did it Do not run DNS configuration update during the shutdown of the management interface. #### How to verify it Measure the execution time of the `service interfaces-config restart` command on the device with the static IP address configuration on the management interface and compare it to the execution time of the same command with the dynamic IP address. The difference should be insignificant.
Cherry-pick PR to 202405: #19985 |
…g service restart (#19583) #### Why I did it The `resolvconfig` service updates the DNS configuration in the host OS and each running Docker container when a configuration change is detected. The DNS configuration update during the shutdown of the management interface is redundant, as the management interface is going down temporarily and, when it is back online, the DNS configuration will remain the same. The update of the DNS configuration adds a couple of seconds (depending on the CPU) to the interface-config service restart time when the management interface uses a dynamic IP address. This can affect the fast boot. To optimize the flow and execute the service restart faster, the update should be skipped. #### How I did it Do not run DNS configuration update during the shutdown of the management interface. #### How to verify it Measure the execution time of the `service interfaces-config restart` command on the device with the static IP address configuration on the management interface and compare it to the execution time of the same command with the dynamic IP address. The difference should be insignificant.
Why I did it
The
resolvconfig
service updates the DNS configuration in the host OS and each running Docker container when a configuration change is detected. The DNS configuration update during the shutdown of the management interface is redundant, as the management interface is going down temporarily and, when it is back online, the DNS configuration will remain the same. The update of the DNS configuration adds a couple of seconds (depending on the CPU) to the interface-config service restart time when the management interface uses a dynamic IP address. This can affect the fast boot. To optimize the flow and execute the service restart faster, the update should be skipped.Work item tracking
How I did it
Do not run DNS configuration update during the shutdown of the management interface.
How to verify it
Measure the execution time of the
service interfaces-config restart
command on the device with the static IP address configuration on the management interface and compare it to the execution time of the same command with the dynamic IP address. The difference should be insignificant.Which release branch to backport (provide reason below if selected)
Tested branch (Please provide the tested image version)
Description for the changelog
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)