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

TCP P2P optimization #710

Merged
merged 55 commits into from
May 6, 2019
Merged

Conversation

shargon
Copy link
Member

@shargon shargon commented Apr 22, 2019

  • VersionPayload now have a enum for services
  • The command in header now is one byte instead of 12 byte string
  • P2P have auto compression mechanism
  • MagicBytes is sent in VersionPayload
  • CRC was removed

@shargon shargon changed the title P2P optimization TCP P2P optimization Apr 22, 2019
@shargon
Copy link
Member Author

shargon commented Apr 22, 2019

Some compression samples:

Block 1945085 (Biggest):

  • Original block size: 3.002.776 bytes
  • Message size: 230.947 bytes
  • Compression ratio: 13.002
  • Space savings: 92.31%

Block 1318368 (Big one):

  • Original block size: 512.428 bytes
  • Message size: 503.367 bytes
  • Compression ratio: 1.018
  • Space savings: 1.77%

Block 4 (with only 1 tx):

  • Original block size: 686 bytes
  • Message size: 691 bytes
  • Not compressed

@vncoelho
Copy link
Member

Congratulations, @shargon!
Count with me for a deep review and revision.
I am going to wait for your signals for when to start to review.
What are the expected deadlines?

I need to focus on some other minor things during this week.

@canesin
Copy link
Contributor

canesin commented Apr 22, 2019

@shargon any opinion on https://facebook.github.io/zstd/#small-data ? Would it help here ?

@vncoelho
Copy link
Member

vncoelho commented Apr 22, 2019

@canesin, great to see you here, my friend.
I took a look and it is interesting. It uses learning techniques for optimizing the compression.
On the other hand, I am thinking about how to improve hashes compression? There might be no outstanding patterns. ahueahuea
But I believe it is worth investigating, Canesin.
What do you think, @igormcoelho?

@shargon, I think that this is the link for the C# recommended implementation: https://github.com/bp74/Zstandard.Net

neo/Network/P2P/Helper.cs Outdated Show resolved Hide resolved
@shargon
Copy link
Member Author

shargon commented Apr 22, 2019

@canesin maybe we can use different flags for different compression mechanisms, and allow more in the future. And maybe if zstandard is better for small data, we can change it on real time, and choose the best one for our packet

@vncoelho
Copy link
Member

vncoelho commented Apr 22, 2019

The compression details goes in the header, @shargon?
In this sense, those who receive it can easily identify which mechanism was used, right? I will take some time to ready the proposal as soon as possible.

@shargon
Copy link
Member Author

shargon commented Apr 22, 2019

@vncoelho yes, now we have flags for each message, and we can use it for compression, encryption, or other things

@vncoelho
Copy link
Member

@shargon, these github drafts are good, but not practical... I will mark it as ready to review.

@vncoelho vncoelho marked this pull request as ready for review April 23, 2019 18:00
Copy link
Member

@vncoelho vncoelho left a comment

Choose a reason for hiding this comment

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

I am starting to check the code, @shargon.

It looks like to be a nice job, congratulations.

neo/Network/P2P/Message.cs Show resolved Hide resolved
neo/Network/P2P/Payloads/VersionServices.cs Show resolved Hide resolved
neo/Network/P2P/MessageCommand.cs Outdated Show resolved Hide resolved
neo/Network/P2P/ProtocolHandler.cs Outdated Show resolved Hide resolved
neo/Network/P2P/RemoteNode.cs Outdated Show resolved Hide resolved
@shargon
Copy link
Member Author

shargon commented May 3, 2019

The connection is lost when we receive verack message :S

@shargon
Copy link
Member Author

shargon commented May 4, 2019

Now, is working well in my laptlop, could anyone more test it please?

erikzhang
erikzhang previously approved these changes May 5, 2019
@erikzhang
Copy link
Member

@shargon @belane When can I merge it?

@shargon
Copy link
Member Author

shargon commented May 5, 2019

I think that we can add this improve too: shargon#11

We thought that GetBlocksPayload could be improved, what do you think?

@shargon
Copy link
Member Author

shargon commented May 5, 2019

My problem was a configuration problem, so i think that we can merge it, but please, review this shargon#11 for incorporate to this pr or don't

@erikzhang
Copy link
Member

shargon#11 is good. But I can't modify it.

@shargon
Copy link
Member Author

shargon commented May 6, 2019

I invited you to the repo, and I merged it, please, modify whatever you want.

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

5 participants