-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
tools: Accelerate config deletion in frr-reload.py by bulk execution #14927
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also (to better understand the speedup) add some before/after metrics?
33384a9
to
c55ff15
Compare
I have measured the time it takes to stop the advertisement of 1,000 networks. With the previous method, it takes about 0.1 seconds per command.
The method in this PR, which writes the commands to a temporary file and executes them all at once,
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, IMO very nice addition for frr-reload. I'm just not sure if we need an additional argument for frr-reload.py to control this batch behavior. What if we add --batch
or so?
Considering that config addition is already processed in batch, an option like Commands that do not succeed without truncation will be processed according to the established way, so this change will not affect the actual commands executed, nor will it alter the number of attempts. And many commands that do not require truncation will be rapidly executed through batch processing. The only minor change is that since we execute deletion commands in batch from a file and then retry the failed ones, the order of success for deletion commands may change where there are commands that cannot succeed without truncation. So introducing |
Hi @chiragshah6, Could you please take a look when you have a moment? Thanks for your help! |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Previously, in config deletion, each command was executed individually using vtysh -c "configure" -c ..., leading to significant delays, especially with a large number of deletions. This process could take minutes during a reload. To resolve this, deletion commands are now written to a file and processed in batch using vtysh -f, just as addition commands are. This change significantly improves the speed of configuration changes. Additionally, to handle cases where deletion commands fail, the script now captures the line numbers of failed commands from the standard error output of vtysh -f. Based on these numbers, it retrieves the corresponding commands from the file. The retrieved failed commands are subsequently reprocessed according to the established deletion workflow, which involves reattempting the failed deletion commands, truncating one word from the end of each command until it succeeds or cannot be truncated further. Signed-off-by: Yu Ishizaki <[email protected]>
Are we good to get this change in? If there are any concerns, please let me know. |
This PR is stale because it has been open 180 days with no activity. Comment or remove the |
This PR introduces an optimization for the
frr-reload.py
script,which accelerates config deletion by processing them in bulk.
Motivation
Previously, the script executed each deletion command individually using
vtysh -c "configure" -c ...
, which was time-consuming and inefficient, especially when dealing with a large number of deletions. This approach could result in minutes of delay during a configuration reload.Changes
vtysh -f
.This aligns the deletion process with how addition commands are handled and significantly speeds up
the configuration changes.
vtysh -f
. Using these line numbers, the script retrieves the corresponding commands from the file.which involves reattempting the failed deletion commands, truncating one word from the end of each command
until it succeeds or cannot be truncated further.
Impact
The bulk execution of deletion commands greatly reduces the time required for applying configuration changes in frr reload. This enhancement is particularly beneficial for environments with frequent configuration updates or large sets of deletions.