-
Notifications
You must be signed in to change notification settings - Fork 0
Automatic Port Mapping
In Infinite Ez, the automatic mapping to ports in the 22XXX and 33XXX ranges was designed to address inherent limitations in how TCP operates compared to higher-layer protocols like HTTP. Understanding this difference is crucial to grasp the port mapping strategy adopted by the software.
TCP is responsible for transporting data between devices, ensuring packet delivery and communication reliability. However, it operates in a "simple" manner regarding load balancing. This means that, when leveling traffic, TCP only knows that a specific port forwards to another specific port, without awareness of additional information like the hostname or packet content.
In contrast, HTTP operates at the application layer, where it's possible to handle more specific information, such as the hostname. This characteristic allows for more intelligent load balancing techniques, like directing traffic based on the host name (e.g., "if the hostname is X, go to container X"). Therefore, port 80 and 443 can be "shared" by multiple containers and this proxy process is handled automatically by Ez.
Due to TCP's limitation, where each port is associated with a single traffic flow (i.e., one port on the host forwards to a specific port in the container), it's unfeasible to use the same port for multiple containers simultaneously. If a container is using a particular port (say, 3306), another container cannot use that same port on the host without causing a conflict. Well, you can use the same port on the host, but you won't be able to differentiate which container the traffic is meant for. This restriction prevents us from using hostname-based logic to distribute traffic, as is possible with HTTP.
To circumvent this limitation, Infinite Ez adopts automatic port mapping to the 22XXX and 33XXX ranges. This strategy offers several benefits:
Each container receives a unique port within these ranges, avoiding conflicts and ensuring that once a port is mapped to a container, it cannot be reused by another container simultaneously unless the previous mapping is undone.
Although TCP only allows basic forms of balancing (like round robin or weight-based), mapping ports to specific ranges ensures that traffic is distributed clearly and unambiguously, maintaining consistency in communication.
By defining specific ranges for mapping, the system provides users with a predictable way to know which ports the containers will be accessible on, facilitating integration with other tools and infrastructure management.
In summary, Infinite Ez's use of the 22XXX and 33XXX ranges is a practical and efficient solution to overcome TCP's limitations, ensuring that each container has a unique communication channel and avoiding conflicts that could compromise system integrity.