Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
d9d60a5a
Unverified
Commit
d9d60a5a
authored
Apr 12, 2019
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: special case default cache allowance (4GB mainnet, 128MB ligh)
parent
4a4abc41
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
main.go
cmd/geth/main.go
+14
-0
flags.go
cmd/utils/flags.go
+1
-1
No files found.
cmd/geth/main.go
View file @
d9d60a5a
...
...
@@ -234,6 +234,20 @@ func init() {
if
err
:=
debug
.
Setup
(
ctx
,
logdir
);
err
!=
nil
{
return
err
}
// If we're a full node on mainnet without --cache specified, bump default cache allowance
if
ctx
.
GlobalString
(
utils
.
SyncModeFlag
.
Name
)
!=
"light"
&&
!
ctx
.
GlobalIsSet
(
utils
.
CacheFlag
.
Name
)
&&
!
ctx
.
GlobalIsSet
(
utils
.
NetworkIdFlag
.
Name
)
{
// Make sure we're not on any supported preconfigured testnet either
if
!
ctx
.
GlobalIsSet
(
utils
.
TestnetFlag
.
Name
)
&&
!
ctx
.
GlobalIsSet
(
utils
.
RinkebyFlag
.
Name
)
&&
!
ctx
.
GlobalIsSet
(
utils
.
GoerliFlag
.
Name
)
{
// Nope, we're really on mainnet. Bump that cache up!
log
.
Info
(
"Bumping default cache on mainnet"
,
"provided"
,
ctx
.
GlobalInt
(
utils
.
CacheFlag
.
Name
),
"updated"
,
4096
)
ctx
.
GlobalSet
(
utils
.
CacheFlag
.
Name
,
strconv
.
Itoa
(
4096
))
}
}
// If we're running a light client on any network, drop the cache to some meaningfully low amount
if
ctx
.
GlobalString
(
utils
.
SyncModeFlag
.
Name
)
==
"light"
&&
!
ctx
.
GlobalIsSet
(
utils
.
CacheFlag
.
Name
)
{
log
.
Info
(
"Dropping default light client cache"
,
"provided"
,
ctx
.
GlobalInt
(
utils
.
CacheFlag
.
Name
),
"updated"
,
128
)
ctx
.
GlobalSet
(
utils
.
CacheFlag
.
Name
,
strconv
.
Itoa
(
128
))
}
// Cap the cache allowance and tune the garbage collector
var
mem
gosigar
.
Mem
if
err
:=
mem
.
Get
();
err
==
nil
{
...
...
cmd/utils/flags.go
View file @
d9d60a5a
...
...
@@ -331,7 +331,7 @@ var (
// Performance tuning settings
CacheFlag
=
cli
.
IntFlag
{
Name
:
"cache"
,
Usage
:
"Megabytes of memory allocated to internal caching"
,
Usage
:
"Megabytes of memory allocated to internal caching
(default = 4096 mainnet full node, 128 light mode)
"
,
Value
:
1024
,
}
CacheDatabaseFlag
=
cli
.
IntFlag
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment