-
Notifications
You must be signed in to change notification settings - Fork 281
gc optimize #1151
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
base: develop
Are you sure you want to change the base?
gc optimize #1151
Conversation
WalkthroughThis update removes automatic memory management in the Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant H as HandlerT
participant D as debug.SetMemoryLimit
U->>H: SetMemoryLimit(limit)
H->>D: SetMemoryLimit(limit)
D-->>H: previousLimit
H-->>U: previousLimit
sequenceDiagram
participant U as User
participant W as Web3 Extension
participant API as debug_setMemoryLimit
U->>W: setMemoryLimit(limit)
W->>API: debug_setMemoryLimit(limit)
API-->>W: previousLimit
W-->>U: previousLimit
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (2)
🔇 Additional comments (2)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
} | ||
// Ensure Go's GC ignores the database cache for trigger percentage | ||
cache := ctx.GlobalInt(CacheFlag.Name) | ||
gogc := math.Max(20, math.Min(100, 100/(float64(cache)/1024))) |
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.
What about just removing this dynamic setting? and keep other logic. e.g. the Lowering memory allowance on 32bit arch
logic.
this might make your peak numbers better, but I doubt it will help with the sustained throughput. |
yes, the CPU will not cost at gc at least. I will investigate the sustained throughput bottleneck. |
when send too many transaction to txpool during my benchmark, the golang gc will take 1/3 CPU profile.
I want to use the
ballast
mechanism to reduce the gc times to reduce golang GC CPU cost. I try GOGC = 500 and GOMEMLIMIT=10G, but it doesn't work. mainly because this section of code limits the GOGC to never be over 100.go-ethereum/cmd/utils/flags.go
Lines 1788 to 1802 in b393386
Assuming the memory is 30G, GOGC value is 20 after the calculation, this will make the Golang GC very frequent, wasting the CPU resources, so suggest removing this part.
If we wonder about the large number of txs that trigger the OOM, the suggestion is to set GOMEMLIMIT depending on the realistic situation.
For my benchmark, I have enough memory, I don't want the CPU waste on GC, I want to use
ballast
to reduce the GC times, I need a big GOGC value. here is the performance after the adjustment.The throughput increased 25% from 45Mgas/s to 55Mgas/s
Before update
After update.
And most of the time, just keeping the GOGC = 100 is a good decision
Summary by CodeRabbit
New Features
Refactor