A buffer allocation method, comprising: determining, by a device, a first output rate of a first queue on the device and a second output rate of a second queue on the device; and separately allocating, by the device, a buffer to the first queue and a buffer to the second queue based on a first ratio of the first output rate to the second output rate, wherein the separately allocating, by the device, of the buffer to the first queue and of the buffer to the second queue based on the first ratio of the first output rate to the second output rate comprises: determining, by the device, that a sum of buffers occupied, on the device, by a plurality of queues is greater than or equal to a threshold, wherein the threshold is determined based on a size of a buffer of the device, and the plurality of queues comprises the first queue and the second queue; and separately allocating by the device the buffer to the first queue and the buffer to the second queue based on the first ratio of the first output rate to the second output rate, in response to determining by the device that the sum of buffers occupied on the device is greater than or equal to the threshold, wherein the buffer of the device comprises the buffer allocated to the first queue and the buffer allocated to the second queue. determining, by a device, a first output rate of a first queue on the device and a second output rate of a second queue on the device; and separately allocating, by the device, a buffer to the first queue and a buffer to the second queue based on a first ratio of the first output rate to the second output rate, wherein the separately allocating, by the device, of the buffer to the first queue and of the buffer to the second queue based on the first ratio of the first output rate to the second output rate comprises: determining, by the device, that a sum of buffers occupied, on the device, by a plurality of queues is greater than or equal to a threshold, wherein the threshold is determined based on a size of a buffer of the device, and the plurality of queues comprises the first queue and the second queue; and separately allocating by the device the buffer to the first queue and the buffer to the second queue based on the first ratio of the first output rate to the second output rate, in response to determining by the device that the sum of buffers occupied on the device is greater than or equal to the threshold, wherein the buffer of the device comprises the buffer allocated to the first queue and the buffer allocated to the second queue. determining, by the device, that a sum of buffers occupied, on the device, by a plurality of queues is greater than or equal to a threshold, wherein the threshold is determined based on a size of a buffer of the device, and the plurality of queues comprises the first queue and the second queue; and separately allocating by the device the buffer to the first queue and the buffer to the second queue based on the first ratio of the first output rate to the second output rate, in response to determining by the device that the sum of buffers occupied on the device is greater than or equal to the threshold, wherein the buffer of the device comprises the buffer allocated to the first queue and the buffer allocated to the second queue.