nowkarol

nowkarol

Release It! Second Edition: TCP errors

Hi @mtnygard, sorry for not following template. I’ve read your book „Release It Second Edition!” and found some TCP related errors worth mention:

  • Ephemeral Ports on page 54 you wrote „The operating system assigns inbound connections to an „emphemeral” port that represents the receiving side of the connection … So we can stretch that range to ports 1024-65535, for maximum of 64,511 connections.”
    You also mention it on page 153 „Socket numbers only range from 1 to 65535, so at best a single NIC can support about 64,000 connections”.
    To precisely identify connection Operating system uses five-tuple (Protocol, Source Address, Destination, Address, Source Port, Destination Port) RFC 6056: Recommendations for Transport-Protocol Port Randomization. Ephemeral ports are used by Client as a way to route data to correct process. They aren’t depleted on server side when it accepts connection. It’s accept connection on well known port and uses ephemeral port to create answer for one particular IP address. So only limitation is on possible connection between particular (Client) IP, particular (Server) IP with known server port (for example 80). When different Clients open connections to port 80 they have different IP addresses and they are distinguished by them, ephemeral ports are used when one Client opened few connections to one Server to make sure they don’t mess with each other. You wrote that adding another Network Card could help. If one Client needs to open as many connections to one Server then it would be easier to just accept request on other server port (81, 82… but this seem improbable)

  • TCP multicasting on page 73. I haven’t heard about TCP implementation which would allow for TCP multicasting because TCP stack cares a lot about connection state (window size, acknowledged bytes, occurrence of congestion etc…). It would need to maintain those for all multicast receivers which is something what multicast was created to avoid.

  • (Just opinion) TCP retry on page 93. You wrote „ Some kinds of transient failures might be overcome with a retry (for example, dropped packets over a WAN).” Actually there is nothing wrong with that statement because you didn’t mention transport mechanism. But many people (me too) by default thinks about TCP. Which will do retry by itself (but no faster than one second RFC 6298: Computing TCP's Retransmission Timer)

  • (Just opinion) Custom handshaking on page 113. I didn’t get what are advantages of custom handshaking over mentioned 503 Http response code, possible with standard Retry-After header RFC 7231: Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content
    Custom handshake, and I understand it as permission for making HTTP request, adds another Round Trip Time to whole operation latency and gives nothing back. If advantage is because of not sending huge, useless request then HTTP also allows to optimize that by Expect Header RFC 7231: Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content. Seems like more universal approach than custom stuff.

  • (Minor mistake) On page 119 you wrote „When the queue is full, new connection attempts are rejected with an ICMP RST (reset) packet” RST is flag part of TCP message format. It is not related to ICMP Transmission Control Protocol (TCP) Specification.

  • (Just opinion) Page 174 You wrote „Anything using Java’s built-in classes will cache the first IP address it receives from DNS, guaranteeing that every future connection targets the same instance and completely defeating load balancing” Although DNS allow you to configure TTL RFC 1035: Domain names - implementation and specification TTL I was surprised that you are right - Java ignores it. I found that you can disable caching or set it’s time manually jdk11/InetAddress.java at 37115c8ea4aff13a8148ee2b8832b20888a5d880 · openjdk/jdk11 · GitHub. This is more Java bug than issue of relying on DNS, of course very important one but it’s not DNS round robin that fails here.

  • Page 185 TIME_WAIT and the Bogons: „Services that only deal with work inside a data center can set a very low TIME_WAIT to free up those ephemeral sockets. Just be sure to reduce the machine’s TCP setting for the default „time to live” on packets accordingly. On Linux, take a look at the tcp_tw_reuse kernel setting” As far as I know linux kernel don’t allow to set this value manually. You can IP Sysctl — The Linux Kernel documentation disable it, enable for all or for loopback only. I don’t get „time to live” change mention. Its IP job unrelated to TIME_WAIT. Reducing it make sense only if connections to your systems are terminated on Edge (which opens new “internal” connection) if not, there is possibility that your answer won’t reach recipient.

  • Page 218 „At one time, it was common to use query parameters on URLs and hyperlinks to carry session IDs. Not only are those session IDs visible to every switch, router, and proxy server, they are also visible to humans”. Although there is good point about copying and pasting link after, this one is not precise. When traffic is encrypted (almost all now is) all devices in the middle see only IP and TCP headers. URL as part of HTTP data is encrypted. And if traffic is not encrypted then it doesn’t matter where you place session id - it will be visible.

Popular Prag Prog topics Top

jimmykiang
This test is broken right out of the box… — FAIL: TestAgent (7.82s) agent_test.go:77: Error Trace: agent_test.go:77 agent_test.go:...
New
iPaul
page 37 ANTLRInputStream input = new ANTLRInputStream(is); as of ANTLR 4 .8 should be: CharStream stream = CharStreams.fromStream(i...
New
simonpeter
When I try the command to create a pair of migration files I get an error. user=> (create-migration "guestbook") Execution error (Ill...
New
edruder
I thought that there might be interest in using the book with Rails 6.1 and Ruby 2.7.2. I’ll note what I needed to do differently here. ...
New
AleksandrKudashkin
On the page xv there is an instruction to run bin/setup from the main folder. I downloaded the source code today (12/03/21) and can’t see...
New
jskubick
I’m under the impression that when the reader gets to page 136 (“View Data with the Database Inspector”), the code SHOULD be able to buil...
New
brunogirin
When trying to run tox in parallel as explained on page 151, I got the following error: tox: error: argument -p/–parallel: expected one...
New
dtonhofer
@parrt In the context of Chapter 4.3, the grammar Java.g4, meant to parse Java 6 compilation units, no longer passes ANTLR (currently 4....
New
ggerico
I got this error when executing the plot files on macOS Ventura 13.0.1 with Python 3.10.8 and matplotlib 3.6.1: programming_ML/code/03_...
New
mcpierce
@mfazio23 I’ve applied the changes from Chapter 5 of the book and everything builds correctly and runs. But, when I try to start a game,...
New

Other popular topics Top

AstonJ
What chair do you have while working… and why? Is there a ‘best’ type of chair or working position for developers?
New
siddhant3030
I’m thinking of buying a monitor that I can rotate to use as a vertical monitor? Also, I want to know if someone is using it for program...
New
AstonJ
Curious to know which languages and frameworks you’re all thinking about learning next :upside_down_face: Perhaps if there’s enough peop...
New
Exadra37
Oh just spent so much time on this to discover now that RancherOS is in end of life but Rancher is refusing to mark the Github repo as su...
New
OvermindDL1
Woooooooo! This is such a huge release for it, and 2 years incoming! In short, the library is now using an updated hyper backend (not j...
New
rustkas
Intensively researching Erlang books and additional resources on it, I have found that the topic of using Regular Expressions is either c...
New
PragmaticBookshelf
Author Spotlight James Stanier @jstanier James Stanier, author of Effective Remote Work , discusses how to rethink the office as we e...
New
PragmaticBookshelf
Build efficient applications that exploit the unique benefits of a pure functional language, learning from an engineer who uses Haskell t...
New
Help
I am trying to crate a game for the Nintendo switch, I wanted to use Java as I am comfortable with that programming language. Can you use...
New
PragmaticBookshelf
Author Spotlight Rebecca Skinner @RebeccaSkinner Welcome to our latest author spotlight, where we sit down with Rebecca Skinner, auth...
New

Latest in PragProg

View all threads ❯