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

Add new command line option --database-handles (#16796) #17597

Closed

Conversation

juergenhoetzel
Copy link

@juergenhoetzel juergenhoetzel commented Sep 6, 2018

This allows tuning the go-leveldb OpenFilesCacheCapacity option (capacity of
the open files) and thus improve performance by reducing the number of
open/close syscalls.

By increasing the number of DB handles to 100000 I was able to reduce the number of open/close syscalls (10 seconds interval) significantly from:

  open                                                            219
  close                                                           221

to

  close                                                            26
  open                                                             48

and thus increase the sync rate.

This Graphs shows the sync rate (Blocks/Minute) running with defaults (1024 handles) till 7:20 and --database-handles 100000 from 7:20.

eth

@@ -307,6 +307,11 @@ var (
Usage: "Number of trie node generations to keep in memory",
Value: int(state.MaxTrieCacheGen),
}
DatabaseHandles = cli.IntFlag {
Copy link
Contributor

Choose a reason for hiding this comment

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

travis lint error found at this line. simply remove space, IntFlag { to IntFlag{ will work.

This allows tuning the go-leveldb OpenFilesCacheCapacity (capacity of
the open files) and thus improve performance by reducing the number of
open/close syscalls.
@juergenhoetzel
Copy link
Author

juergenhoetzel commented Sep 7, 2018 via email

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Can't wait for the merge 😄

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

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

LGTM! I will run some benchmarks on this an post to the PR

@holiman
Copy link
Contributor

holiman commented Sep 21, 2018

So here are some stats from a fast-sync, with experimental being this PR, and master the current master branch.

  • experimental
    • Fast sync started at 09:15, completed at 15:55: 6h40m
    • Filehandles rose to about 30K during the sync
  • master
    • Fast sync started at 09:15, completed at 18:15: 9h0m
    • Filehandles stayed steady at around 2k during the sync

filehandles_stats_fastsync

So the fast sync was 35% faster, which is very good (but it's just one datapoint so far).

@holiman
Copy link
Contributor

holiman commented Sep 21, 2018

A full sync is also in progress, and the results so far are not showing any similar improvement. The experimental is slightly ahead (30m or so), but that slight difference may just as well be related to differences in hardware.

While master is keeping open files at around 2K, the experimental has (over 24 hours) slowly grown roughly linearly to 18k so far.

I guess the file handle is more of a bottleneck during fast sync, and not so much as bottleneck during full sync.

@fjl
Copy link
Contributor

fjl commented Sep 22, 2018

We might be able to get similar benefits with less file handles by increasing the compaction table sizes in leveldb config. Right now the DB keeps thousands of small files and the access pattern is random so they're all accessed occasionally.

@mrFranklin
Copy link
Contributor

good job!

This allows tuning the go-leveldb OpenFilesCacheCapacity option (capacity of
the open files) and thus improve performance by reducing the number of
open/close syscalls.

By increasing the number of DB handles to 100000 I was able to reduce the number of open/close syscalls (10 seconds interval) significantly from:

  open                                                            219
  close                                                           221

to

  close                                                            26
  open                                                             48

and thus increase the sync rate.

This Graphs shows the sync rate (Blocks/Minute) running with defaults (1024 handles) till 7:20 and --database-handles 100000 from 7:20.

eth

HackyMiner writes:
@hackmod commented on this pull request. travis lint error found at this line. simply remove space, IntFlag { to IntFlag{ will work.
Thanks for the heads-up! I amended the commit.

good job!
could you tell me which tool do you use to generate the beautiful graph above?

@mrFranklin
Copy link
Contributor

So here are some stats from a fast-sync, with experimental being this PR, and master the current master branch.

  • experimental

    • Fast sync started at 09:15, completed at 15:55: 6h40m
    • Filehandles rose to about 30K during the sync
  • master

    • Fast sync started at 09:15, completed at 18:15: 9h0m
    • Filehandles stayed steady at around 2k during the sync

filehandles_stats_fastsync

So the fast sync was 35% faster, which is very good (but it's just one datapoint so far).

Could you tell me which tool can generate the graphs above? thanks

@holiman
Copy link
Contributor

holiman commented Nov 18, 2018

@mrFranklin it's from datadog. We export metrics through datadog to get nice charts from our benchmarking nodes.
@fjl so, what should we do about this? I think it seems to be a good PR, but if we can get similar improvements through some other means, I'm all ears...

@karalabe
Copy link
Member

Superseded by #18211, which should solve the same problem, but automagically.

@karalabe karalabe closed this Nov 29, 2018
@hadv
Copy link
Contributor

hadv commented Nov 29, 2018

@mrFranklin it's from datadog. We export metrics through datadog to get nice charts from our benchmarking nodes.

@holiman Do you have a link that document detail steps to do this? Thank you!

osoese pushed a commit to egem-core-bu/go-egem that referenced this pull request Mar 25, 2019
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.

7 participants