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

Flag -maxheap #46

Merged
merged 12 commits into from
Nov 29, 2022
Merged

Flag -maxheap #46

merged 12 commits into from
Nov 29, 2022

Conversation

stephen-soltesz
Copy link
Contributor

@stephen-soltesz stephen-soltesz commented Nov 18, 2022

This change adds a new flag (-maxheap) to packet-headers that limits the total RAM used by the process. This change requires a new feature of go1.19 debug.SetMemoryLimit.

From local testing, in response to a SYN flood event:

  • SetMemoryLimit alone is not sufficient to prevent eventual RAM exhaustion. New savers are created faster than the timeout and GC removes them.
  • Conditional creation of saver.StartNew alone is not sufficient to prevent RAM exhaustion either because the GC does not activate frequently enough.

Shorter settings for -uuidwaittimeout (down to 100ms) had no effect on the eventual RAM exhaustion.

When total RAM used is greater than maxHeap, new streams will be ignored. In effect, this both limits new memory allocations and may prevent some legitimate traces from ever being collected, or collected incompletely.

Collection will resume after adequate RAM is available. The setting for -maxheap should be greater or equal to -maxidleram.

Resolves:


This change is Reviewable

@coveralls
Copy link

coveralls commented Nov 18, 2022

Pull Request Test Coverage Report for Build 24

  • 32 of 41 (78.05%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-1.4%) to 98.602%

Changes Missing Coverage Covered Lines Changed/Added Lines %
demuxer/tcp.go 21 30 70.0%
Totals Coverage Status
Change from base Build 8: -1.4%
Covered Lines: 635
Relevant Lines: 644

💛 - Coveralls

@stephen-soltesz stephen-soltesz changed the title Flag -maxramratio Flag -maxheap Nov 20, 2022
Copy link
Contributor

@robertodauria robertodauria left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 6 of 6 files at r2, all commit messages.
Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @stephen-soltesz)


demuxer/tcp.go line 67 at r2 (raw file):

	ms := runtime.MemStats{}
	runtime.ReadMemStats(&ms)
	// log.Println(ms.HeapAlloc, ">", maxHeap, "==", ms.HeapAlloc > maxHeap)

Nit: commented LOC

Copy link
Contributor Author

@stephen-soltesz stephen-soltesz left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @robertodauria)


demuxer/tcp.go line 67 at r2 (raw file):

Previously, robertodauria (Roberto D'Auria) wrote…

Nit: commented LOC

Thank you.

@stephen-soltesz stephen-soltesz merged commit 06f4dcb into main Nov 29, 2022
@stephen-soltesz stephen-soltesz deleted the sandbox-soltesz-maxramratio branch November 29, 2022 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants