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

Merged
merged 11 commits into from
Dec 5, 2024

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

@assrinivasan
Copy link
Contributor Author

@keboliu @Junchao-Mellanox @dgsudharsan, please help review this PR, thank you in advance.

@assrinivasan assrinivasan force-pushed the optimizations-reduce-disk-io branch from 7a94212 to 397263d Compare November 2, 2024 21:03
@prgeor
Copy link
Contributor

prgeor commented Nov 5, 2024

@assrinivasan build checks failing

prgeor
prgeor previously approved these changes Nov 5, 2024
@assrinivasan
Copy link
Contributor Author

/azpw ms_conflict

@assrinivasan assrinivasan force-pushed the optimizations-reduce-disk-io branch from 7b380b4 to 1555847 Compare November 27, 2024 03:21
@assrinivasan assrinivasan force-pushed the optimizations-reduce-disk-io branch from 1555847 to db0a894 Compare November 28, 2024 03:36
@assrinivasan
Copy link
Contributor Author

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@assrinivasan
Copy link
Contributor Author

/azpw ms_conflict

@@ -212,6 +212,9 @@ mkdir -p ${rootmnt}/boot
mkdir -p ${rootmnt}/host/$image_dir/boot
mount --bind ${rootmnt}/host/$image_dir/boot ${rootmnt}/boot

## Mount the /tmp directory as tmpfs
Copy link
Contributor

Choose a reason for hiding this comment

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

@assrinivasan How much memory are we loosing on platform with small RAM? Arista 7050-QX?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are currently allocating 25% of total RAM towards /tmp directory on all platforms.

@yxieca yxieca merged commit 8dbec05 into sonic-net:master Dec 5, 2024
22 checks passed
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.

7 participants