Welcome back!
Tomorrow, I give a lecture on switch architecture. Coincidence, it should be — I have been drafting a post on the same topic, albeit intended for a more diverse set of audience (readers). So, here it goes.
The Internet we use is connected using nodes, called switches and routers. Switches are common — you might have seen it in your labs and/or hostels, or offices etc. Routers form the core of the Internet, connecting many networks. Both devices, switch and router, perform the basic function of transferring packets from incoming line to another outgoing line — called switching. With reference to the layered architecture, it comes in the layer two. So, every interconnecting node (be it a switch or a router) does the basic functionality of switching packets.
Now, how challenging is this?
Before answering this, a few bits of information. Each line brings in packets, and each line sends out packets, at a rate, say R. We call a line as input line, when it has incoming packet(s). A port is where a line and the switch interconnects. For every line, there is a corresponding port.
Consider the scenario of a switch that has just two lines. Then, the fabric inside the switch has very simple job to do — using some internal wires, keep the input and output ports connected forever!
Now consider another scenario. There are 100 lines connected to the switch. Since arrival of packets at ports are not deterministic, but random, there can be packets at some input lines, and none at others. In addition, the destination output port for each packet is also not deterministic. Input-output ports cannot be connected forever; but the connections should be made and torn down at the speed of packet arrivals. Therefore, to utilize the output line rate to the maximum, the switch has a complicated job to do: switch packets from input ports to output ports, such that maximum number of input-output pairs are selected. Given the input rate is fixed, we can be sure that not more than one packet can arrive at an input port in a time-slot (defined by packet_size/R). So, in one time-slot 100 packets can arrive at a switch; and each of them arrives at rate R. For maximum utilization, all these packets have to be switched within the same time-slot, yes, within the same time-slot; otherwise, packets will have be queued. More importantly, if the switching speed is slower than arrival rate, the packet queues will grow to infinite size! Therefore, a switch has to take the decision of which packets to transfer from which input ports and to which output ports, in one time-slot. If the number of ports (lines) is N, and the line capacity (rate) R, then the switch has to operate at a speed not less than R, using a matching algorithm which usually has its complexity a function of N. This is precisely the challenge faced by switches. This matching algorithm (in fact, this comes from graph theory) is equivalent to deciding where to put `0’s in an NxN matrix, such that, there is only one ‘0′ in each row and each column. The speed of electronics used in the switch fabrics is slow in the sense that, matching algorithms in the order of N are not scalable.
The above said story is the beginning of evolution of switch architecture. Now, we have switches that are scalable, thanks to the development of technology that has made distributed decision making within a switch a reality.