简体   繁体   中英

PHP Performance poor on CentOS

I've got a question about the performance of PHP (any version) on CentOS vs Ubuntu 16.04

When i call a simple textfile with wrk, i get about 30k requests/s on both OS'es, which is perfectly fine.

But when i call a simple echo command in an PHP file, the performance drop slightly on Ubuntu which makes sense.

But on CentOS it drops to 12/13k request/s which is unacceptable.

I've tested this on the most basic setup but i can't seem to find any logical explanation for this. My thought was that SELinux could have anything to do with this, but setting SELinux to permissive or disabling it doesn't affect the performance at all.

There is also no difference in using PHP-FPM or mod PHP.

Did anyone else ever experienced this or could point me in the right direction?

This could be issue of PHP version. CentOS 7 has PHP5.6 by default and Ubuntu have PHP7 .

PHP7 is more speed then older versions. You can google for PHP 5.6 vs PHP 7 Performance Comparison .

You can upgrade php on CentOS and test again by using following commands on Terminal.

See currently installed php version

php --version

Download Remi and EPEL Repository packages

wget -q http://rpms.remirepo.net/enterprise/remi-release-7.rpm
wget -q https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Enable Remi and EPEL Repository

rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm

// FOR PHP 7.0 EXECUTE:
yum-config-manager --enable remi-php70

// FOR PHP 7.1 EXECUTE:
yum-config-manager --enable remi-php71

Install or Upgrade to PHP 7

yum install php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM