A method performed by a network device, the method comprising: at the network device, the network device being a switch or a router and having multiple ports configured to receive/send data packets from/to a network, receiving data packets of multiple traffic flows (T1, T2, T3) and populating a queue in a memory of the network switch or router with the data packets; periodically updating a fair rate to be applied to ones of the multiple traffic flows to converge a length of the queue to a reference length over time, the updating including: measuring a length of the queue, computing a change in the length from a previous length, and computing a deviation of the length from the reference length; detecting an increase in the change in length above at least one threshold that is based on the reference length; and if the increase is not above the at least one threshold, deriving the fair rate from a previous fair rate based on tunable control parameters by increasing or decreasing the previous fair rate by an amount that is a function of (i) a product of a first tunable control parameter and the change in length, and (ii) a product of a second tunable control parameter and the deviation of the length, to produce the fair rate; periodically identifying elephant flows among the multiple traffic flows; and periodically sending the fair rate to a source of each elephant flow; wherein deriving the fair rate further includes tuning the first tunable control parameter and the second tunable control parameter as a function of a known link speed at which data packets stored to the queue are drained from the queue via one or more of the multiple ports. at the network device, the network device being a switch or a router and having multiple ports configured to receive/send data packets from/to a network, receiving data packets of multiple traffic flows (T1, T2, T3) and populating a queue in a memory of the network switch or router with the data packets; periodically updating a fair rate to be applied to ones of the multiple traffic flows to converge a length of the queue to a reference length over time, the updating including: measuring a length of the queue, computing a change in the length from a previous length, and computing a deviation of the length from the reference length; detecting an increase in the change in length above at least one threshold that is based on the reference length; and if the increase is not above the at least one threshold, deriving the fair rate from a previous fair rate based on tunable control parameters by increasing or decreasing the previous fair rate by an amount that is a function of (i) a product of a first tunable control parameter and the change in length, and (ii) a product of a second tunable control parameter and the deviation of the length, to produce the fair rate; periodically identifying elephant flows among the multiple traffic flows; and periodically sending the fair rate to a source of each elephant flow; measuring a length of the queue, computing a change in the length from a previous length, and computing a deviation of the length from the reference length; detecting an increase in the change in length above at least one threshold that is based on the reference length; and if the increase is not above the at least one threshold, deriving the fair rate from a previous fair rate based on tunable control parameters by increasing or decreasing the previous fair rate by an amount that is a function of (i) a product of a first tunable control parameter and the change in length, and (ii) a product of a second tunable control parameter and the deviation of the length, to produce the fair rate; periodically identifying elephant flows among the multiple traffic flows; and periodically sending the fair rate to a source of each elephant flow; wherein deriving the fair rate further includes tuning the first tunable control parameter and the second tunable control parameter as a function of a known link speed at which data packets stored to the queue are drained from the queue via one or more of the multiple ports.