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

[Static DNS] Optimize DNS configuration update during interface-config service restart #19583

Merged
merged 1 commit into from
Aug 13, 2024

Conversation

oleksandrivantsiv
Copy link
Collaborator

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
  • Microsoft ADO (number only):

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)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305

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)

@oleksandrivantsiv
Copy link
Collaborator Author

/azpw ms_conflict

1 similar comment
@oleksandrivantsiv
Copy link
Collaborator Author

/azpw ms_conflict

@qiluo-msft qiluo-msft requested a review from ganglyu August 5, 2024 22:35
@@ -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)
Copy link
Contributor

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?

Copy link
Collaborator Author

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
Copy link
Contributor

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"?

Copy link
Collaborator Author

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.

@qiluo-msft qiluo-msft merged commit 3a143ad into sonic-net:master Aug 13, 2024
22 checks passed
matiAlfaro pushed a commit to Marvell-switching/sonic-buildimage that referenced this pull request Aug 21, 2024
…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.
mssonicbld pushed a commit to mssonicbld/sonic-buildimage that referenced this pull request Aug 22, 2024
…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.
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202405: #19985

mssonicbld pushed a commit that referenced this pull request Aug 23, 2024
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants