Skip to content

loop optimisation in bash#4451

Merged
yadvr merged 1 commit into
apache:4.15from
shapeblue:vr-bash-loop
Feb 18, 2021
Merged

loop optimisation in bash#4451
yadvr merged 1 commit into
apache:4.15from
shapeblue:vr-bash-loop

Conversation

@DaanHoogland

@DaanHoogland DaanHoogland commented Nov 6, 2020

Copy link
Copy Markdown
Contributor

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

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

Screenshots (if appropriate):

How Has This Been Tested?

@DaanHoogland

Copy link
Copy Markdown
Contributor Author

@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 yadvr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, needs testing and maybe new tests that could simulate that scale (1k+ fw rules?)

@wido

wido commented Nov 6, 2020

Copy link
Copy Markdown
Contributor

I'm not sure if this fixes it. Not against changing it, but I don't know if this is the root-cause.

@davidjumani davidjumani left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code works, LGTM

@davidjumani

Copy link
Copy Markdown
Contributor

@rhtyd @DaanHoogland Would splitting the file and processing each part sequentially work ?

@DaanHoogland

Copy link
Copy Markdown
Contributor Author

@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.

@davidjumani

Copy link
Copy Markdown
Contributor

@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

@DaanHoogland

Copy link
Copy Markdown
Contributor Author

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?

@yadvr

yadvr commented Dec 14, 2020

Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result: ✔centos7 ✔centos8 ✔debian. JID-2489

@yadvr

yadvr commented Dec 14, 2020

Copy link
Copy Markdown
Member

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@weizhouapache

Copy link
Copy Markdown
Member

@DaanHoogland @rhtyd
I suggest not to merge this pr into 4.15.0.0

@yadvr

yadvr commented Dec 14, 2020

Copy link
Copy Markdown
Member

Yes @weizhouapache, it's marked against 4.15.1.0; (I'm) just kicking tests on PRs.

@DaanHoogland

Copy link
Copy Markdown
Contributor Author

@DaanHoogland @rhtyd
I suggest not to merge this pr into 4.15.0.0

I agree, and would say let's not merge at all until we have knowledge if this is making a difference at all.

@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-3346)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 36386 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4451-t3346-kvm-centos7.zip
Intermittent failure detected: /marvin/tests/smoke/test_kubernetes_clusters.py
Intermittent failure detected: /marvin/tests/smoke/test_volumes.py
Intermittent failure detected: /marvin/tests/smoke/test_hostha_kvm.py
Smoke tests completed. 85 look OK, 1 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File
test_06_download_detached_volume Failure 312.64 test_volumes.py

@yadvr

yadvr commented Feb 1, 2021

Copy link
Copy Markdown
Member

@DaanHoogland @weizhouapache @wido should we merge this for 4.15.1.0 (targetting Q2)?

@DaanHoogland

Copy link
Copy Markdown
Contributor Author

I don't care for this code @rhtyd . I don't know but i don't think it is an improvement/optimisation

@weizhouapache

Copy link
Copy Markdown
Member

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.

@yadvr
yadvr changed the base branch from master to 4.15 February 18, 2021 08:27
@yadvr

yadvr commented Feb 18, 2021

Copy link
Copy Markdown
Member

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.

@yadvr
yadvr merged commit aab2447 into apache:4.15 Feb 18, 2021
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.

vr_cfg.sh use lots of memory failed to start if there are many firewall rules.

8 participants