r/PHPhelp • • 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.

7 Upvotes

16 comments sorted by

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.

1

u/Demon-Souls Jan 21 '23

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.

My website have very few visitor ~20/day, and I use WP-SQLite plugin, so I don't use MySQL server. While nginx/php-fpm running, the server uses ~200MB of ram.

BTW I installed PHP 8.2 and the performance improvement were noticeable, pages loading time decreased.

2

u/steven447 Jan 21 '23

I use WP-SQLite plugin, so I don't use MySQL server

And this is why your website is so slow. When using SQLite the DB has to be read from disk and parsed again with every request.

1

u/Demon-Souls Jan 21 '23

When using SQLite the DB has to be read from disk and parsed again with every request.

Linux had the ability to cache frequently request files into the RAM, I never worried about that, + SQLite are faster @ reading data than MySQL.

1

u/HolyGonzo Jan 21 '23

Yes if you have just one website and 20 visitors a day and you don't want to grow beyond that, your setup sounds fine.

With SQLite, you just have to be aware that because it's single-user, any parallel connections will end up bottlenecking things. Higher volume will make performance drop faster, especially since SQLite locks the entire table to do data updates and deletes. Depending on what plugins and custom functionality you have, this can hinder performance quite a bit. If you're using basic WP, it's probably not an issue.

Disk IO is still often your next big issue with VPS.

1

u/Demon-Souls Jan 21 '23

especially since SQLite locks the entire table to do data updates and deletes

I'm aware of that, but on my website rarely there is any write/delete process being done, and for disk IO as I said before Linux doing that job for me, since it caches files that requested by nginx multiple times.

          total        used        free      shared  buff/cache   available
Mem:            772         223         103          53         445         379

1

u/HolyGonzo Jan 21 '23

Yep, like I said, it all depends on what customizations you have. Base WP is mostly read activity.

Okay so do you have a performance problem at the moment? Or a goal you're trying to reach? In your original post you said you were worried about the performance.

1

u/Demon-Souls Jan 21 '23

Okay so do you have a performance problem at the moment

I did, in fact I faced other problem with bots tried to log in with multiple attempts, I lucked ssh login into my IP region, and use only ssh key login.

And for PHP, thing improved more, after I enable JIT and opcache.

Anyway, the VPS I'm using are very low end ( 1$/month ) , so I'm satisfied with the results.

1

u/dabenu Jan 21 '23 edited Jan 21 '23

90% of load time is usually determined by disk I/O anyway. Unless cpu is a bottleneck, a faster runtime environment is not going to do too much indeed.

Look into slower queries, increase system memory, etc.

1

u/Demon-Souls Jan 21 '23

Look into slower queries, increase system memory, etc.

Alright I recheck it the CPU vCore are crap I got 171 MIPS 7zip bench result, looks like the server I'm in are oversold like hell, since they use OpenVZ the vCore are shared with other clients

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 =    171

this is my previous VPS ( I could not renew it now )

7za b -mmt1 -    MIPS   22: MIPS =    4366

1

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

u/[deleted] Jan 21 '23

[deleted]

1

u/32gbsd Jan 21 '23

This is like a meme at this point isnt it? EOL and security updates.