Skip to content

Commit d3d6d0f

Browse files
shlomibittonjudyjoseph
authored andcommitted
[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 1334c04 commit d3d6d0f

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
@@ -828,6 +828,9 @@ sudo cp $BUILD_TEMPLATES/mgmt-framework.timer $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_S
828828
echo "mgmt-framework.timer" | sudo tee -a $GENERATED_SERVICE_FILE
829829
{% endif %}
830830

831+
sudo cp $BUILD_TEMPLATES/pmon.timer $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
832+
echo "pmon.timer" | sudo tee -a $GENERATED_SERVICE_FILE
833+
831834
sudo cp $BUILD_TEMPLATES/sonic.target $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
832835
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable sonic.target
833836

files/scripts/syncd.sh

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

3838
function waitplatform() {
3939

40+
BOOT_TYPE=`getBootType`
4041
if [[ x"$sonic_asic_platform" == x"mellanox" ]]; then
41-
debug "Starting pmon service..."
42-
/bin/systemctl start pmon
43-
debug "Started pmon service"
42+
if [[ x"$BOOT_TYPE" = @(x"fast"|x"warm"|x"fastfast") ]]; then
43+
debug "PMON service is delayed by a timer for better fast/warm boot performance"
44+
else
45+
debug "Starting pmon service..."
46+
/bin/systemctl start pmon
47+
debug "Started pmon service"
48+
fi
4449
fi
4550
if [[ x"$BOOT_TYPE" = @(x"fast"|x"warm"|x"fastfast") ]]; then
4651
debug "LLDP service is delayed by a timer for better fast/warm boot performance"

0 commit comments

Comments
 (0)