0

P2P Network:

Largest message is about 300KB. Most of the messages are smaller (5-50kb). It is perfectly OK if they do not receive the messages, as they will initiate bootstrap (re-send).

I am leaning towards UDP, and you guessed it, its a blockchain software! However, our current design is TCP.

user2584960
  • 645
  • 1
  • 6
  • 20

1 Answers1

0

The largest size of a UDP packet is 65,535 bytes (including an 8 byte UDP header and 20 byte IP header), so for your largest messages you would have to implement a form of "chunking" which divides the message into smaller parts (unless you are using IPv6 Jumbograms), with a application generated header which contained the ordering of the packets, and possibly data size. You also have the issue of fragmentation when you are over the MTU size (although with a reliability mechanism like you mention this is probably not such an issue).

I guess you have to ask yourself what benefits UDP would give you over your current TCP design. The main reason to use UDP is when you need a lightweight protocol with a very small network delay or you need to be able to broadcast or multicast packets over a LAN. If you dont have these needs and TCP is doing the job, why change ?

Rob
  • 110
  • 4
  • My consensus algorithm tolerates up to 1/3 of the nodes not responding. this means I already have application layer fault handling. by using TCP, head of line blocking in the case of a slow network will cause my system's performance to degrade.this is why I am looking into UDP. – user2584960 Aug 14 '18 at 15:45
  • Exactly what head-of-line blocking scenario are you concerned about? Thousands of internet servers are able to serve tens of thousands of clients on slow networks over TCP without causing the servers' performance to degrade. – Gil Hamilton Aug 14 '18 at 16:36