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.

Where Next?

Popular Pragmatic Bookshelf topics Top

telemachus
Python Testing With Pytest - Chapter 2, warnings for “unregistered custom marks” While running the smoke tests in Chapter 2, I get these...
New
jamis
The following is cross-posted from the original Ray Tracer Challenge forum, from a post by garfieldnate. I’m cross-posting it so that the...
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
adamwoolhether
When trying to generate the protobuf .go file, I receive this error: Unknown flag: --go_opt libprotoc 3.12.3 MacOS 11.3.1 Googling ...
New
jskubick
I found an issue in Chapter 7 regarding android:backgroundTint vs app:backgroundTint. How to replicate: load chapter-7 from zipfile i...
New
hazardco
On page 78 the following code appears: <%= link_to ‘Destroy’, product, class: ‘hover:underline’, method: :delete, data: { confirm...
New
akraut
The markup used to display the uploaded image results in a Phoenix.LiveView.HTMLTokenizer.ParseError error. lib/pento_web/live/product_l...
New
jonmac
The allprojects block listed on page 245 produces the following error when syncing gradle: “org.gradle.api.GradleScriptException: A prob...
New
andreheijstek
After running /bin/setup, the first error was: The foreman' command exists in these Ruby versions: That was easy to fix: gem install fore...
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

Other popular topics Top

malloryerik
Any thoughts on Svelte? Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue...
New
Rainer
My first contact with Erlang was about 2 years ago when I used RabbitMQ, which is written in Erlang, for my job. This made me curious and...
New
AstonJ
We have a thread about the keyboards we have, but what about nice keyboards we come across that we want? If you have seen any that look n...
New
AstonJ
I ended up cancelling my Moonlander order as I think it’s just going to be a bit too bulky for me. I think the Planck and the Preonic (o...
New
AstonJ
I have seen the keycaps I want - they are due for a group-buy this week but won’t be delivered until October next year!!! :rofl: The Ser...
New
PragmaticBookshelf
Build highly interactive applications without ever leaving Elixir, the way the experts do. Let LiveView take care of performance, scalabi...
New
hilfordjames
There appears to have been an update that has changed the terminology for what has previously been known as the Taskbar Overflow - this h...
New
New
AstonJ
Curious what kind of results others are getting, I think actually prefer the 7B model to the 32B model, not only is it faster but the qua...
New
Fl4m3Ph03n1x
Background Lately I am in a quest to find a good quality TTS ai generation tool to run locally in order to create audio for some videos I...
New

Sub Categories: