I have tested the performance of the P4 VM provided in the GitHub tutorial. I find that the testing result is way too much from expectation. For instance, the bandwidth of P4 network is 40MB/s, while the VM without P4 is 33.9 GB/s. That is 3 orders of difference. The delay of P4 switch is 2.3 sec, while it is 0.09 sec without P4. Does anyone have any ideas? Thank you.
The idea is very simple: read the documentation, such as the README file that comes with the model.
It says it in the very beginning (in the third paragraph to be exact), that I am quoting for your convenience:
bmv2 is not meant to be a production-grade software switch . It is meant to be used as a tool for developing, testing and debugging P4 data planes and control plane software written for them. As such, the performance of bmv2 - in terms of throughput and latency - is significantly less than that of a production-grade software switch like Open vSwitch. For more information about the performance of bmv2, refer to this document.
If you have not already read it, the linked document mentioned in Vlad’s quote of the README is especially relevant, and has details on how to get the best performance possible out of the BMv2 software switch. Even in that situation, BMv2 is really intended for development and testing.
I have not personally done performance testing with the p4c DPDK back end, but it has definitely been developed with performance on a general purpose CPU in mind, much more so than BMv2 has been.