1
I'm a web developer who is pretty new to the industry. I was presented with a coding challenge for a job interview where I need to design a messaging system and architect a system for how it deals with messages, malformed messages, different message types, status logging, et cetera...
My question is regarding packet size over TCP.
Incoming messages are at a rate of 10,000 messages/sec at a size of 2KB per message. I've been trying to find the max, max-safe, or max-practical packet size limitation. I've seen in several unverified places (i.e. not in technical documentation) that the max theoretical size is 64KB. Is that correct? In that case my example of sending 2KB messages would easily fit into a single packet and reduce the complexity of this system.
If 64KB is an incorrect number, what would the correct number be? Additionally, I'm not simply trying to understand the max theoretical size but the max practical size. I want to cover edge cases where messages may be slightly larger than the targeted 2KB as well as leave room for the various headers that TCP needs.
So, you're saying that while TCP can theoretically contain up to 64KB of data no network can transmit that size, correct? – MBak – 2018-07-18T19:43:37.400
@MBaka A single IP datagram can be 64KiB, but the vast majority of networks would require the IP layer to fragment that datagram into lots of smaller packets and transmit it that way, with the IP layer networking software on the destination host reassembling them back into the 64KiB datagram before passing it further up the stack. – Spiff – 2018-07-18T19:54:55.363
Got it! But if that's the case, why was the IP datagram even designed like that if networks can't support that without fragmenting it further? – MBak – 2018-07-19T18:09:32.053
@MBaka Decades ago when IPv4 was designed, the designers figured MTUs would grow and left room for that growth. It’s kind of surprising that Ethernet’s 1500 byte MTU has stuck around and stayed influential for so long. – Spiff – 2018-07-19T18:51:35.750
That makes sense. Thanks for the response and knowledge! – MBak – 2018-07-23T00:10:11.620