# Poor P4 VM Performance

**URL:** https://forum.p4.org/t/poor-p4-vm-performance/731
**Category:** Uncategorized
**Created:** [April 11, 2023, 12:39pm UTC](https://forum.p4.org/t/poor-p4-vm-performance/731 "2023-04-11T12:39:53Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jvm](https://avatars.discourse-cdn.com/v4/letter/j/958977/32.png) [@jvm](https://forum.p4.org/u/jvm)
#### Post date: [April 11, 2023, 12:39pm UTC](https://forum.p4.org/t/poor-p4-vm-performance/731/1 "2023-04-11T12:39:53Z")

</div>

Hello,

I have a virtualized scenario with three virtual machines. Two of them act as hosts sending and receiving packets. The remaining in between has the image provided in [https://github.com/jafingerhut/p4-guide/blob/master/bin/README-install-troubleshooting.md](https://github.com/jafingerhut/p4-guide/blob/master/bin/README-install-troubleshooting.md). The scenario is | Host 1 \<—\> P4 Node \<----\> Host 2 |  
I have tested performance by running the basic forwarding P4 program in the virtual machine and doing iperf tests between hosts. Throughput roughly achieves 1 Mbps. I understand that bmv2 is not intended to be a production software switch but I expected higher throughput. Is this usual behavior?

Moreover, I installed a new virtual machine to run the tests included in p4c, following the instructions you provide in the link I posted before:

```auto
$ cd p4c/build
$ make -j2 check |& tee make-check-out.txt

```

The results were that most of the tests failed.

Any suggestion is appreciated.  
Thanks in advance

---

<div class="post-metadata">

### Author: ![andyfingerhut](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.p4.org/andyfingerhut/32/17_2.png) [@andyfingerhut](https://forum.p4.org/u/andyfingerhut)
#### Post date: [April 11, 2023, 1:54pm UTC](https://forum.p4.org/t/poor-p4-vm-performance/731/2 "2023-04-11T13:54:20Z")

</div>

There are different command line options that can be used:

- when compiling the simple\_switch\_grpc process, and
- when running the simple\_switch\_grpc process

that can affect how quickly it can process packets. If you have not read this article before, and you are trying to get the best performance out of simple\_switch\_grpc possible (without changing its source code), I recommend reading it: [behavioral-model/performance.md at main · p4lang/behavioral-model · GitHub](https://github.com/p4lang/behavioral-model/blob/main/docs/performance.md)

Regarding most of the p4c tests failing, that should not affect the performance of the simple\_switch\_grpc process, but it doesn’t sound good for your ability to use the P4 compiler. I test the install-p4dev-v5.sh and install-p4dev-v6.sh scripts mentioned at the link you gave in your message every month, and late last month all of the tests except about 70 of them passed (about 2500 passed, with only ebpf and ubpf tests failing, which is normal because my scripts do not install the necessary software for ebpf and ubpf-specific tests to pass).
