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

p2p: snappy encoding for devp2p (version bump to 5) #15106

Merged
merged 2 commits into from
Sep 26, 2017

Conversation

karalabe
Copy link
Member

@karalabe karalabe commented Sep 6, 2017

Implements ethereum/EIPs#706.

This PR bumps the version number of the devp2p protocol to v5 and implements (mandatory) Snappy compression for the message payload fields. The results are staggering:

Rinkeby fast sync without compression:

{
  InboundTraffic: {
    Avg01Min: "80.09M (1.33M/s)",
    Avg05Min: "945.18M (3.15M/s)",
    Avg15Min: "1.95G (2.17M/s)",
    Overall: "2.51G (4.09M/s)"
  },
  OutboundTraffic: {
    Avg01Min: "1.46M (24.29K/s)",
    Avg05Min: "15.19M (50.63K/s)",
    Avg15Min: "35.02M (38.91K/s)",
    Overall: "55.89M (90.87K/s)"
  }

Rinkeby fast sync with Snappy encoding:

{
  InboundTraffic: {
    Avg01Min: "41.58M (693.07K/s)",
    Avg05Min: "191.29M (637.63K/s)",
    Avg15Min: "344.51M (382.79K/s)",
    Overall: "463.65M (785.86K/s)"
  },
  OutboundTraffic: {
    Avg01Min: "2.64M (43.96K/s)",
    Avg05Min: "19.86M (66.20K/s)",
    Avg15Min: "34.65M (38.50K/s)",
    Overall: "46.21M (121.93K/s)"
  }
}

Mainnet fast sync without compression:

{
  InboundTraffic: {
    Avg01Min: "60.29M (1.00M/s)",
    Avg05Min: "2.25G (7.51M/s)",
    Avg15Min: "7.59G (8.43M/s)",
    Overall: "33.59G (6.58M/s)"
  },
  OutboundTraffic: {
    Avg01Min: "590.21K (9.84K/s)",
    Avg05Min: "9.27M (30.90K/s)",
    Avg15Min: "46.54M (51.72K/s)",
    Overall: "1.01G (197.11K/s)"
  }
}

Mainnet fast sync with Snappy encoding:

{
  InboundTraffic: {
    Avg01Min: "36.79M (613.15K/s)",
    Avg05Min: "309.53M (1.03M/s)",
    Avg15Min: "2.45G (2.72M/s)",
    Overall: "13.46G (3.94M/s)"
  },
  OutboundTraffic: {
    Avg01Min: "16.63M (277.12K/s)",
    Avg05Min: "82.10M (273.66K/s)",
    Avg15Min: "206.05M (228.94K/s)",
    Overall: "1.01G (294.07K/s)"
  }
}

p2p/rlpx.go Outdated
if err != nil {
return 0, err
if size > int(maxUint24) {
return msg, errors.New("decompressed message size overflows uint24")
Copy link
Contributor

Choose a reason for hiding this comment

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

Heh, "decompressed message exceeds 16MB" is too user-friendly ?

Copy link
Member Author

Choose a reason for hiding this comment

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

:)) The user won't see this. But the existing counterpart in write is "message size exceeds uint24".

Though you made me realize I need a check in write too before I compress.

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

@karalabe karalabe merged commit 2ee8859 into ethereum:master Sep 26, 2017
vincentserpoul pushed a commit to vincentserpoul/go-ethereum that referenced this pull request Nov 22, 2017
* p2p: snappy encoding for devp2p (version bump to 5)

* p2p: remove lazy decompression, enforce 16MB limit
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.

2 participants