Congestion occurs when a network has more traffic than it can handle. Without proper congestion control, the network can become oversaturated and cease to function because nodes can overwhelm their neighbors with more messages than can be handled by an individual node. By deciding which messages to forward, a congestion control algorithm is utilized to prevent this oversaturation. Therefore, the total throughput of the network (informally known as transactions per second) is ultimately limited by the available resources such as internet connectivity, device processing, and storage capabilities.
Since a congestion control algorithm decides what messages are gossiped, it essentially determines who has access to the network; the congestion control algorithm has a profound effect on the user experience. Unlike most networks, DLTs have very strict requirements which make congestion control a particularly difficult problem to tackle. In particular, the following requirements must be satisfied:
- Fair access: network access must be granted proportionally to some “scarce resource”.
- Attack resistance: malicious nodes cannot disrupt the network.
- Consistency: all nodes need to write the same messages to their local ledger.
Blockchains solve congestion control by using some mechanisms to elect leaders to mine blocks. Since IOTA is feeless and does not have miners, we have to find an alternative solution. Our congestion control is made up of the following two main components:
- Scheduler: it selects which messages are ready to be written to the local tangle and forwarded on to the node’s neighbors. Messages are scheduled at a constant rate, proportionally to the mana of the issuing node. This mechanism ensures that none of the nodes are overwhelmed.
Rate setter: each node employs specific rules (AIMD, inspired by TCP) to update their issuance rate in response to congestion events. Since in DLTs traffic passes through all nodes, local congestion at a node is all that is required to indicate congestion elsewhere in the network. This observation is crucial, as it presents an opportunity for a congestion control algorithm based entirely on local traffic.
What happens if an attacker tries to attack the network by issuing transactions at a high rate? Locally, nodes will not process the attacker’s messages faster than their allowed rate. So the attacker’s messages will pile up and their queue will grow. A queue getting too large indicates that the attacker is bypassing the rate setter: consequently, nodes will detect this and banish the attacker from the network.
The animation below shows how mana affects a message’s ability to be issued into the tangle.