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

Code optimizations to reduce disk writes on SONiC switches #20640

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

assrinivasan
Copy link
Contributor

@assrinivasan assrinivasan commented Oct 28, 2024

Why I did it

This PR contains various optimizations to reduce disk writes on SONiC switches as mentioned in the High-level Design.

This contributes to the overall reduction in data written to the disk over time, which can help extend the life of the disk and reduce the risk of disk failure.

Work item tracking
  • Microsoft ADO (number only): 28300356

How I did it

  1. Moved supervisord logs within swss to tmpfs
  2. Optimized away repeated disk writes by vtysh in the bgp container
  3. Moved monit and logrotate writers to tmpfs

How to verify it

Flash image with these optimizations onto a sonic switch and check the following:

  1. Within swss container, supervisord logs are written to /dev/shm/supervisor/
  2. Within bgp container, verify that ~/.history_frr file is not written into repeatedly with show bgp summary json
  3. Verify that monit state file is in /dev/shm/monit
  4. Verify that logrotate status file is in /dev/shm/logrotate

Which release branch to backport (provide reason below if selected)

  • 202411

Tested branch (Please provide the tested image version)

  • 20201231.119
  • 20220531.47
  • 20230531.19

Description for the changelog

Code optimizations to reduce disk writes on SONiC switches

@@ -104,6 +104,10 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/sonic-nettools_*.deb || \
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
sudo setcap 'cap_net_raw=+ep' $FILESYSTEM_ROOT/usr/bin/wol

# This is needed for moving monit logs, state and logrotate status to tmpfs
sudo mkdir -p $FILESYSTEM_ROOT/dev/shm/monit/
sudo mkdir -p $FILESYSTEM_ROOT/dev/shm/logrotate/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't going to be present on bootup. At bootup, a tmpfs filesystem is mounted at /dev/shm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants