|
|
Until Kea 1.5, kea-dhcp4 and kea-dhcp4 read inbound packets directly from the interface sockets in the main application thread. This their packet buffers were the FIFO socket buffers themselves. Once full any new packets are lost. Under swamped conditions the servers end up processing client packets that are may no longer be relevant or worse are redundant. In other words, the packets queued become stale.
|
|
|
|
|
|
Kea 1.5 introduces a new feature referred to as Congestion Handling. There are two primary aspects to this feature. The first involves some restructuring to the servers. Rather than the main application thread reading directly from the interface socket buffers, inbound packets are now taken from those buffers and added to a "packet queue" by a separate thread. The main application thread process packets from the queue. Doing so introduced a configurable layer which can make decisions based on which packets to process, how to store them, and the order in which they are processed by the server.
|
|
|
|
|
|
As there is no one algorithm that will best handle all sites, and because over time new approaches will evolve, the packet queue is implemented as dynamic plug-in, which can replaced by a custom plug-in via a hook library. This should make easy for anyone to experiment with various solutions. (Developers may refer to isc::dhcp::PacketQueue and isc::dhcp::PacketQueueMgr, in our developer's guide).
|
|
|
|
|
|
Packet queue behavior can be configured in both kea-dhcp4 and kea-dhcp6 servers through a top level configuration element, 'dhcp-queue-control' as shown below:
|
|
|
|
|
|
```
|
|
|
"dhcp-queue-control": {
|
|
|
"queue-type": "<queue type>",
|
|
|
"capacity" : <n>
|
|
|
}
|
|
|
```
|
|
|
|
|
|
1. queue-type - the name under which queue plug-in was registered
|
|
|
2. capacity - the maximum number of packets that the queue can hold
|
|
|
|
|
|
Currently there are two pre-registered plug-ins, "kea-ring4" and "kea-ring6". These implement basic FIFO ring buffers, both with a default capacity of 500 packets. Example configuration excerpts for both kea-dhcp4 and kea-dhcp6 are shown below:
|
|
|
|
|
|
```json
|
|
|
"Dhcp4":
|
|
|
{
|
|
|
|
|
|
"dhcp-queue-control": {
|
|
|
"queue-type": "kea-ring4",
|
|
|
"capacity" : 100
|
|
|
},
|
|
|
...
|
|
|
}
|
|
|
```
|
|
|
|
|
|
```json
|
|
|
"Dhcp6":
|
|
|
{
|
|
|
|
|
|
"dhcp-queue-control": {
|
|
|
"queue-type": "kea-ring6",
|
|
|
"capacity" : 750
|
|
|
},
|
|
|
...
|
|
|
}
|
|
|
```
|
|
|
The number of parameters and plug-ins are expected to grow over time. In addition, it should be possible to enable or disable packet queuing as whole. When disabled the servers would revert to the original, single-threaded direct approach used before Kea 1.5.
|
|
|
|
|
|
## Disabling congestion control
|
|
|
|
|
|
You can disable congestion control by using the following directive:
|
|
|
|
|
|
```json
|
|
|
"Dhcp4": {
|
|
|
"dhcp-queue-control": {
|
|
|
"enable-queue": false
|
|
|
},
|
|
|
...
|
|
|
}
|
|
|
```
|
|
|
|
|
|
Reference: https://gitlab.isc.org/isc-projects/kea/wikis/high-level-view-of-congestion-control |