-
Notifications
You must be signed in to change notification settings - Fork 198
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
Added memory ballast flag #3488
Conversation
Codecov Report
@@ Coverage Diff @@
## development #3488 +/- ##
============================================
Coverage 73.88% 73.88%
============================================
Files 582 582
Lines 74444 74444
============================================
Hits 55000 55000
Misses 15044 15044
Partials 4400 4400 Continue to review full report at Codecov.
|
// memory ballast is an optimization for golang's garbage collector. If set to a high value, it can decrease | ||
// the number of times when GC performs STW processes, that results is a better performance over high load | ||
memoryBallastObject = make([]byte, memBallastValue*core.MegabyteSize) | ||
log.Debug("initialized memory ballast object", "size", core.ConvertBytes(uint64(len(memoryBallastObject)))) |
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.
I think the compiler might optimize the code and remove the memBallastValue
after this call. Might add a new print on L132 that uses memBallastValue
. The node might call runtime.GC
after shuffling out a shard. This call should theoretically remove the memoryBallastObject
object.
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.
added some prints and tested locally. The object won't be removed/freed
eab3120
@@ -305,7 +305,9 @@ var ( | |||
Name: "mem-ballast", | |||
Value: 0, | |||
Usage: "Flag that specifies the number of MegaBytes to be used as a memory ballast for Garbage Collector optimization. " + | |||
"If set to 0, the feature will be disabled", | |||
"If set to 0 (or not set at all), the feature will be disabled. This flag should be used only for well-monitored nodes " + | |||
"and by advanced users, as a too high memory ballast could lead to Out Of Memory panics. The memory ballast " + |
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.
"because of golang" 🤦
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.
added a flag for memory ballast optimization