r/PHPhelp • u/Demon-Souls • Jan 20 '23
Any performance difference from upgrading from PHP 7.4 to PHP 8.2
Hi all, currently I have PHP 7.4.33 installed on my VPS server, and the server itself are very slow but had 1GB of RAM,
I'm kinda worried about the performance of my WP website on it, so I need performance improvement if possible on it.
3
u/nattaylor Jan 21 '23
Based on this benchmark you should see about 20% improvement in requests per second https://kinsta.com/blog/php-benchmarks/#wordpress-59rc2
Are you sure it's CPU time spent on PHP causing your site to be slow?
1
u/Demon-Souls Jan 21 '23 edited Jan 21 '23
Are you sure it's CPU time spent on PHP causing your site to be slow?
The network isn't that good, too, but this is the only available server for me now, and for the CPU it's actually slow, this is a small test I have done on VPS I used.
7za b -mmt1 - MIPS 22: MIPS = 171this is my previous VPS ( I could not renew it now )
7za b -mmt1 - MIPS 22: MIPS = 43661
u/ardicli2000 Jan 21 '23
Tests shoe that there is performance decrease for WP at PHP 8
2
u/Demon-Souls Jan 21 '23
Tests shoe that there is performance decrease for WP at PHP 8
^ That CPU test using 7-zip compression algorithm from command line, I test two VPSs, the first test for my current VPS and second one for my previous VPS, I did same test on 20 years old 800Mhz single core CPU and it scores better
22: MIPS = 400
2
u/baohx2000 Jan 21 '23
Stick a CDN in front of your site. May take a bit of configuration but guaranteed better perceived performance for all the static contents.
0
3
u/HolyGonzo Jan 21 '23
Yes, PHP 8 is faster than 7 but it's usually not that noticeable. Your bigger problem is your hardware.
1 GB of RAM is almost nothing. You have to divide that 1 GB up among the operating system services/ processes, the database server, then the web server, and the PHP. That leaves almost no capacity for multiple, parallel web server requests.
And when you start running out of RAM, you're probably going to end up using some swap / virtual memory, which is already slower than RAM but it also competes with the regular disk activity, and VPS disks are often shared and slow already.
A 1 GB RAM VPS probably also only gets allocated a small virtual CPU, so you likely have a lot of factors making things slow.
It is fine for personal sites that don't get a lot of traffic or sites that don't need great performance but if you want better performance, then you have to pay a little more for more resources.
FWIW, I pay about $25 a month for a VPS from Atlantic.net. I run about 6 sites on it, most of them are WP sites, and I get great performance. If I just had one site, I could probably get away with $15 a month.
If you can't pay any more, then you need to make the most of your resources. Run nginx, not Apache, and use PHP-FPM.