loop optimisation in bash#4451
Conversation
|
@GabrielBrascher @weizhouapache @rhtyd @wido let's discuss this. I've seen issues in large isolated nets on startup but I doubt this is going to be a big help. thoughts? |
yadvr
left a comment
There was a problem hiding this comment.
LGTM, needs testing and maybe new tests that could simulate that scale (1k+ fw rules?)
|
I'm not sure if this fixes it. Not against changing it, but I don't know if this is the root-cause. |
|
@rhtyd @DaanHoogland Would splitting the file and processing each part sequentially work ? |
|
@davidjumani I like the idea, do we have a good logical splitting of the file? the problem states that many firewall rules cause the issue , so splitting over functional parts wouldn't solve this. |
|
@DaanHoogland Assuming that the rules are in multiple lines, loading all the lines in memory and processing them would kill the VR. Instead splitting the file into smaller ones and reading them could solve the memory issue |
|
Again @davidjumani I like the idea. What is the criterium? (no of lines, sections some combination of criterea) can we be sure that lines are self contained and do not require context or order of executing and can we guarantee that? |
|
@blueorangutan package |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos7 ✔centos8 ✔debian. JID-2489 |
|
@blueorangutan test |
|
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
@DaanHoogland @rhtyd |
|
Yes @weizhouapache, it's marked against 4.15.1.0; (I'm) just kicking tests on PRs. |
I agree, and would say let's not merge at all until we have knowledge if this is making a difference at all. |
|
Trillian test result (tid-3346)
|
|
@DaanHoogland @weizhouapache @wido should we merge this for 4.15.1.0 (targetting Q2)? |
|
I don't care for this code @rhtyd . I don't know but i don't think it is an improvement/optimisation |
same to me. |
|
Considering all I could find, the pipe based thing would be better compared to redirection as it would avoid memory exhaustion; the pipe/buffer synchronisation (https://stackoverflow.com/questions/9553628/piping-and-redirection). Let's merge this in 4.15 and test over next few weeks, we can revisit and revert if necessary. |
Description
A small optimisation as suggested by the user in #4449 . I'm not convinced this is actually reducing the memory usage as they suggest. the code itself seems rathrer risk-free. let's discuss.
Fixes: #4449
Types of changes
Screenshots (if appropriate):
How Has This Been Tested?