In the last two weeks I was working on the performance test for the new FIFO system. I wrote a benchmark program to test FIFO throughput, and the details are as followes.
testing method
The benchmark program employes the producer/consumer model to test the throughput of the FIFO system. In this model, producer sends messages and consumer receives messages using FIFO. The elapsed time will be caculated. Less time we use, more throughput we have.
The test is executed 100 times for all combinations of the following parameters for message size and number of messages transmitted. The avarage time cost is caculated and then printed.
- Message size(bytes): 64, 128, 256, 512, 1024, 2048, 4096
- Number of messages : 100, 1000, 5000, 10000, 100000
results
The performance test was carried out on a Dell Optiplex 960 box with Intel Core 2 Quad 9400 processor, 4G RAM, and 320G hard disk. FreeBSD 7.0-RELEASE is installed on this machine but the kernel has been updated to 8.0-CURRENT.
Here is the result obtained under the new fifo implementation (pipe version):
100 1000 5000 10000 100000
64B 274us 148us 418us 753us 8909us
128B 89us 216us 769us 1545us 17729us
256B 106us 353us 1530us 3700us 35265us
512B 138us 595us 3709us 7310us 70396us
1024B 184us 1183us 7300us 14103us 141104us
2048B 295us 2696us 13929us 29296us 309294us
4096B 502us 5988us 29094us 58351us 583801us
Here is the reuslt obtained under the old fifo implementation (socket version):
100 1000 5000 10000 100000
64B 85us 175us 584us 1126us 11905us
128B 96us 280us 1128us 2171us 23427us
256B 119us 484us 2170us 4559us 53267us
512B 159us 891us 4645us 9276us 109152us
1024B 239us 1732us 9554us 18825us 222931us
2048B 403us 3552us 18939us 38081us 451727us
4096B 723us 7546us 39151us 83753us 905902us
From these results, we can see that the new fifo implementation gains little advantage over the old fifo implementation when transfering small amount of data. e.g. handling 100*128 bytes of data costs 89 microseconds under the new fifo code while it costs 96 microseconds under the old fifo code. But when transferring large amount of data, the new fifo implementation gains significant advantage over the old fifo implementation. e.g. it takes 1126 microseconds handling 10000*64 bytes of data under the old fifo implementation, but under the new fifo implementation, it takes 753 microseconds, saving 30% of time. That is to say, the new fifo system increases the throughput by 30% in this case.