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

GOGC and GOMAXPROCS configuration items added and defaults set #1899

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

l0k18
Copy link
Contributor

@l0k18 l0k18 commented Oct 10, 2022

I think GOGC can be set via environment variable, the runtime checks for it, maybe, but for certain it is better done directly in the app.

Increasing GOMAXPROCS above the number of CPU threads can produce substantial improvements in initial block download and validation.

These both default to prior defaults if unset but provide a way for deployments to dramatically improve IBD and speed of updating the DB when new blocks arrive. Not important improvements but produce a ~50% time to initial sync at the cost of around double memory use.

IBD is a definite weak point for btcd versus bitcoind. There is minimal cost efficiency between a 4gb vs 2gb memory availability nowadays, so this brings btcd closer to parity of performance.

I think GOGC can be set via environment variable, the runtime checks
for it, maybe, but for certain it is better done directly in the app.

Increasing GOMAXPROCS above the number of CPU threads can produce
substantial improvements in initial block download and validation.

These both default to prior defaults if unset but provide a way for
deployments to dramatically improve IBD and speed of updating the DB
when new blocks arrive. Not important improvements but produce a ~50%
time to initial sync at the cost of around double memory use.

IBD is a definite weak point for btcd versus bitcoind. There is
minimal cost efficiency between a 4gb vs 2gb memory availability
nowadays, so this brings btcd closer to parity of performance.
@coveralls
Copy link

Pull Request Test Coverage Report for Build 3219456685

  • 0 of 19 (0.0%) changed or added relevant lines in 1 file are covered.
  • 10 unchanged lines in 4 files lost coverage.
  • Overall coverage decreased (-11.2%) to 55.105%

Changes Missing Coverage Covered Lines Changed/Added Lines %
config.go 0 19 0.0%
Files with Coverage Reduction New Missed Lines %
addrmgr/addrmanager.go 1 71.7%
connmgr/connmanager.go 2 86.07%
config.go 3 5.09%
peer/peer.go 4 73.2%
Totals Coverage Status
Change from base Build 3216328982: -11.2%
Covered Lines: 26518
Relevant Lines: 48123

💛 - Coveralls

if cfg.GoGC < 1 {
cfg.GoGC = 1
}
if cfg.GoGC > 1000 {
Copy link
Member

Choose a reason for hiding this comment

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

FWIW this can already be set as an env variable:

btcd/btcd.go

Lines 331 to 338 in 718d268

// If GOGC is not explicitly set, override GC percent.
if os.Getenv("GOGC") == "" {
// Block and transaction processing can cause bursty allocations. This
// limits the garbage collector from excessively overallocating during
// bursts. This value was arrived at with the help of profiling live
// usage.
debug.SetGCPercent(10)
}

@mleku
Copy link

mleku commented Oct 24, 2023

fwiw, i extended this a little by embedding the sample configuration, integrating the RPC credentials rewrite, that to date has never been updated to 1.16 embed capability despite targeting 1.17.

mleku@c08425a

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.

None yet

4 participants