From 76d5223c9a99a54621b87872db8db786c9fcb684 Mon Sep 17 00:00:00 2001 From: shlomibitton <60430976+shlomibitton@users.noreply.github.com> Date: Tue, 10 Aug 2021 14:22:58 +0300 Subject: [PATCH] [hostcfgd] Delay hostcfgd and aaastatsd for faster boot time (#7965) #### Why I did it hostcfgd is starting at the same time as 'create_switch' method is called on orchagent process. This introduce a degradation on the function execution time which eventually cause the fast-boot flow and a boot scenarion in general to run slower (~6 seconds). This change will delay the start time of this daemon. The aaastatsd will delay as well since it has a dependency on hostcfgd, so it is required to delay both. 90 seconds determined as the maximum allowed downtime for control plane to come back up on fast-boot flow. #### How I did it Add two timers for hostcfgd and aaastatsd services in order to delay the startup of these services. #### How to verify it Install an image with this change and observe the daemons start 90 seconds after the system boot. --- .../debian/sonic-host-services-data.aaastatsd.service | 3 --- .../debian/sonic-host-services-data.aaastatsd.timer | 11 +++++++++++ .../debian/sonic-host-services-data.hostcfgd.service | 3 --- .../debian/sonic-host-services-data.hostcfgd.timer | 11 +++++++++++ 4 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 src/sonic-host-services-data/debian/sonic-host-services-data.aaastatsd.timer create mode 100644 src/sonic-host-services-data/debian/sonic-host-services-data.hostcfgd.timer diff --git a/src/sonic-host-services-data/debian/sonic-host-services-data.aaastatsd.service b/src/sonic-host-services-data/debian/sonic-host-services-data.aaastatsd.service index b03c6a9551c0..b93fe92c04ed 100644 --- a/src/sonic-host-services-data/debian/sonic-host-services-data.aaastatsd.service +++ b/src/sonic-host-services-data/debian/sonic-host-services-data.aaastatsd.service @@ -12,6 +12,3 @@ Restart=on-failure RestartSec=10 TimeoutStopSec=3 -[Install] -WantedBy=sonic.target - diff --git a/src/sonic-host-services-data/debian/sonic-host-services-data.aaastatsd.timer b/src/sonic-host-services-data/debian/sonic-host-services-data.aaastatsd.timer new file mode 100644 index 000000000000..e0458ff326f5 --- /dev/null +++ b/src/sonic-host-services-data/debian/sonic-host-services-data.aaastatsd.timer @@ -0,0 +1,11 @@ +[Unit] +Description=Delays aaastatsd daemon until SONiC has started +PartOf=aaastatsd.service + +[Timer] +OnActiveSec=1min 30 sec +Unit=aaastatsd.service + +[Install] +WantedBy=timers.target sonic.target + diff --git a/src/sonic-host-services-data/debian/sonic-host-services-data.hostcfgd.service b/src/sonic-host-services-data/debian/sonic-host-services-data.hostcfgd.service index 4adf2aba77ad..5e2434527124 100644 --- a/src/sonic-host-services-data/debian/sonic-host-services-data.hostcfgd.service +++ b/src/sonic-host-services-data/debian/sonic-host-services-data.hostcfgd.service @@ -9,6 +9,3 @@ After=sonic.target Type=simple ExecStart=/usr/local/bin/hostcfgd -[Install] -WantedBy=sonic.target - diff --git a/src/sonic-host-services-data/debian/sonic-host-services-data.hostcfgd.timer b/src/sonic-host-services-data/debian/sonic-host-services-data.hostcfgd.timer new file mode 100644 index 000000000000..baf80f4b4cbd --- /dev/null +++ b/src/sonic-host-services-data/debian/sonic-host-services-data.hostcfgd.timer @@ -0,0 +1,11 @@ +[Unit] +Description=Delays hostcfgd daemon until SONiC has started +PartOf=hostcfgd.service + +[Timer] +OnActiveSec=1min 30 sec +Unit=hostcfgd.service + +[Install] +WantedBy=timers.target sonic.target +