PHP Benchmark LXC vs VM: VM is 20% faster

drigolin

New Member
Mar 28, 2023
6
3
3
I did some PHP Benchmark following this online post Post linkl I created inside my Proxmox 7.4 server one VM (Qemu) and one LXC Container with same HW specification: same linux distribution, same PHP version and php config. Phoronix PHP Benchmark suite avalilable here
http://phoronix-test-suite.com/benchmark-files/phpbench-081-patched2.zip
Run with
php -n phpbench.php

Doing simple phpbench I see that LXC has 20-25% penalty in pure speed. It's a pure CPU bound benchmark and it seems that QEmu is more efficient compared to LXC in pure CPU workload.

I would like to know if anybody has a similar experience of there are any LXC settings to have better results.
 
What kind of CPU are you running?

I've seen similar issues on systems with AMD CPUs. There were some performance regressions introduced in newer kernel versions because of mitigations for the Retbleed exploit. They had quite the performance impact on containers running on AMD CPUs.

As a test, can you try booting with mitigations=off and check if the performance improves? Although we do not recommend turning mitigations off on production systems unless you exactly know what you are doing, since this can have quite the heavy security implications.
 
  • Like
Reactions: Chris and drigolin
Hi Stefan yes I'm using AMD Ryzen 9 5950X CPUs.
I didn't check the bare metal performance difference, I expect some of that differce. I can have a look at what's happen on Intel Xeon CPUs to see if this difference is lower. I will let you know.
 
  • Like
Reactions: hiepvq
Hi Stefan I did test on Intel CPU Intel(R) Xeon(R) CPU E5-2667 v2 @ 3.30GHz and here I have the same difference on PHP performances where VM (QEmu) is 20% faster than an LXC Container on the same node. The benchmark is a single thread test.
I will start to use VM for my PHP frontend node instead of LXC.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!