Skip to content

Commit 4ec3af8

Browse files
authored
[Fastboot] Delay PMON service for better fastboot performance (#10567)
- Why I did it Profiling the system state on init after fast-reboot during create_switch function execution, it is possible to see few python scripts running at the same time. This parallel execution consume CPU time and the duration of create_switch is longer than it should be. Following this finding, and the motivation to ensure these services will not interfere in the future, PMON is delayed in 90 seconds until the system finish the init flow after fastboot. - How I did it Add a timer for PMON service. Exclude for MLNX platform the start trigger of PMON when SYNCD starts in case of fastboot. Copy the timer file to the host bin image. - How to verify it Run fast-reboot on MLNX platform and observe faster create_switch execution time.
1 parent 80f5d36 commit 4ec3af8

File tree

5 files changed

+24
-6
lines changed

5 files changed

+24
-6
lines changed

files/build_templates/init_cfg.json.j2

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
{%- set features = [("bgp", "enabled", false, "enabled"),
3131
("database", "always_enabled", false, "always_enabled"),
3232
("lldp", "enabled", true, "enabled"),
33+
("pmon", "enabled", true, "enabled"),
3334
("pmon", "enabled", false, "enabled"),
3435
("radv", "enabled", false, "enabled"),
3536
("snmp", "enabled", true, "enabled"),

files/build_templates/pmon.service.j2

-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,3 @@ ExecStartPre=/usr/bin/{{docker_container_name}}.sh start
1717
ExecStart=/usr/bin/{{docker_container_name}}.sh wait
1818
ExecStop=/usr/bin/{{docker_container_name}}.sh stop
1919
RestartSec=30
20-
21-
[Install]
22-
WantedBy=sonic.target

files/build_templates/pmon.timer

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Unit]
2+
# This delay is for fast/warm reboot performance
3+
Description=Delays pmon docker until SONiC has started
4+
PartOf=pmon.service
5+
6+
[Timer]
7+
OnUnitActiveSec=0 sec
8+
OnBootSec=1min 30 sec
9+
Unit=pmon.service
10+
11+
[Install]
12+
WantedBy=timers.target sonic.target sonic-delayed.target

files/build_templates/sonic_debian_extension.j2

+3
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,9 @@ sudo cp $BUILD_TEMPLATES/mgmt-framework.timer $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_S
831831
echo "mgmt-framework.timer" | sudo tee -a $GENERATED_SERVICE_FILE
832832
{% endif %}
833833

834+
sudo cp $BUILD_TEMPLATES/pmon.timer $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
835+
echo "pmon.timer" | sudo tee -a $GENERATED_SERVICE_FILE
836+
834837
sudo cp $BUILD_TEMPLATES/sonic.target $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
835838
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable sonic.target
836839

files/scripts/syncd.sh

+8-3
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,15 @@ function startplatform() {
4545

4646
function waitplatform() {
4747

48+
BOOT_TYPE=`getBootType`
4849
if [[ x"$sonic_asic_platform" == x"mellanox" ]]; then
49-
debug "Starting pmon service..."
50-
/bin/systemctl start pmon
51-
debug "Started pmon service"
50+
if [[ x"$BOOT_TYPE" = @(x"fast"|x"warm"|x"fastfast") ]]; then
51+
debug "PMON service is delayed by a timer for better fast/warm boot performance"
52+
else
53+
debug "Starting pmon service..."
54+
/bin/systemctl start pmon
55+
debug "Started pmon service"
56+
fi
5257
fi
5358
if [[ x"$BOOT_TYPE" = @(x"fast"|x"warm"|x"fastfast") ]]; then
5459
debug "LLDP service is delayed by a timer for better fast/warm boot performance"

0 commit comments

Comments
 (0)