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

VPP: T1797: Optimizations for VPP memory allocation during startup #2074

Merged
merged 2 commits into from
Jul 6, 2023

Conversation

zdc
Copy link
Contributor

@zdc zdc commented Jul 5, 2023

Change Summary

Optimizations for VPP memory allocation during startup

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Component(s) name

util.py, VPP

Proposed changes

  • changed memory requirement from total to available. This allows to start on
    systems with less total memory and protects from startup on systems with
    overloaded memory.
  • prevent startup if sysctl settings were not applied. This protects from
    situations when the system cannot allocate enough hugepages or apply other
    sysctl settings.

Additionally fixed sysctl helpers in util.py to make vpp.py changes possible.

How to test

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

@vyosbot vyosbot requested review from a team, dmbaturin, sarthurdev, jestabro, sever-sever and c-po and removed request for a team July 5, 2023 14:15
Copy link
Member

@dmbaturin dmbaturin left a comment

Choose a reason for hiding this comment

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

Please remember that we decided to break up the vyos.util module: https://vyos.dev/T5195

One of the most important steps to break it up is to stop expanding it. ;)

These functions should go to vyos.util.system.

One blocker for it is that there's no vyos.util.process yet. The new cmd should be in vyos.utils.process — my plan is to make those functions aware of VRF and netns, and I'll get to it when I'm back from my vacation.

For now, I suppose we can copy the old cmd to a stub vyos.utils.process just to get the ball rolling.

- modified `sysctl_read()` to return the whole value
- modified `sysctl_write()` logic to return `True` only in case a value was
changed successfully
- added `sysctl_apply()` to apply a dictionary of values at once
@zdc
Copy link
Contributor Author

zdc commented Jul 5, 2023

@dmbaturin thanks! New sysctl helpers were moved to vyos.utils.system.

src/conf_mode/vpp.py Outdated Show resolved Hide resolved
@sever-sever
Copy link
Member

Should we declare system there?

from vyos.utils import network

- changed memory requirement from total to available. This allows to start on
systems with less total memory and protects from startup on systems with
overloaded memory.
- prevent startup if sysctl settings were not applied. This protects from
situations when the system cannot allocate enough hugepages or apply other
sysctl settings.
@zdc
Copy link
Contributor Author

zdc commented Jul 6, 2023

Should we declare system there?

from vyos.utils import network

not for this case, as I can see.

@c-po c-po merged commit c13f310 into vyos:current Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants