D
D
De YURII2018-07-31 21:20:16
PHP
De YURII, 2018-07-31 21:20:16

Why is PHP7 slower?

Prod server
OS : CentOS Linux release 7.5.1804 (Core)
Processor : Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz / 32GB RAM (Average CPU Mark 9296 ) https://www.cpubenchmark.net/cpu .php?cpu=Intel+Cor...

cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 58
model name : Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
stepping : 9
microcode : 0x1f
cpu MHz : 1599.975
cache size : 8192 KB
physical id : 0
siblings : 8
core id : 0
cpu cores : 4
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm epb ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms xsaveopt dtherm ida arat pln pts spec_ctrl intel_stibp
bogomips : 6784.60
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
PHP 7.2.8 (cli) (built: Jul 17 2018 09:50:46) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.8, Copyright (c) 1999-2018, by Zend Technologies
php -m
[PHP Modules]
apcu
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
imap
intl
json
ldap
libxml
mbstring
mcrypt
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
pspell
readline
recode
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache
benchmark
--------------------------------------
| PHP BENCHMARK SCRIPT |
--------------------------------------
Start : 2018-07-31 18:13:12
Server : @
PHP version : 7.2.8
Platform : Linux
--------------------------------------
test_math : 0.272 sec.
test_stringmanipulation : 0.304 sec.
test_loops : 0.198 sec.
test_ifelse : 0.141 sec.
--------------------------------------
Total time: : 0.915 sec.
Dev server
OS : CentOS Linux release 7.5.1804 (Core)
Processor : Intel(R) Xeon(R) CPU E3-1225 v5 @ 3.30GHz / 8GB RAM (Average CPU Mark 7807 )
https://www.cpubenchmark.net/ cpu.php?cpu=Intel+Xeo...
cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 94
model name : Intel(R) Xeon(R) CPU E3-1225 v5 @ 3.30GHz
stepping : 3
microcode : 0xc2
cpu MHz : 912.213
cache size : 8192 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 4
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 22
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 ibpb ibrs stibp dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp spec_ctrl intel_stibp
bogomips : 6624.00
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management:
PHP 7.2.8 (cli) (built: Jul 17 2018 09:50:46) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.8, Copyright (c) 1999-2018, by Zend Technologies
php -m
[PHP Modules]
apcu
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
imap
intl
json
ldap
libxml
mbstring
mcrypt
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
pspell
readline
recode
redis
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache
benchmark
--------------------------------------
| PHP BENCHMARK SCRIPT |
--------------------------------------
Start : 2018-07-31 18:12:29
Server : @
PHP version : 7.2.8
Platform : Linux
--------------------------------------
test_math : 0.188 sec.
test_stringmanipulation : 0.254 sec.
test_loops : 0.155 sec.
test_ifelse : 0.121 sec.
--------------------------------------
Total time: : 0.718 sec.

Benchmark produced from under CLI.
Both servers are not loaded with external influences. Those. at the time of the test, no one except me affected them (I apologize for the tautology).
It would seem that the answer is obvious, but no... Dev server is ahead of production.
Question : why and where to dig?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
M
Melkij, 2018-07-31
@Dejurin

It would seem that the answer is obvious

No, it's not obvious. See related Single Thread parrots.
The E3-1225 v5 has slightly lower frequencies, but the architecture is 3 years newer. With the classic 5% per year from Intel, there is still a difference.
Plus, most likely, memory latency has more influence here.

L
latteo, 2018-07-31
@latteo

Try running 100 times to warm up, and then measure at least 10 times and take the average.
This will eliminate errors.

N
neol, 2018-07-31
@neol

Look at the processor power saving settings. man tuned-adm
PS Obviously this benchmark is shit. You can't test anything in a second.

Z
Zettabyte, 2018-08-01
@Zettabyte

The PHP benchmark script by Alessandro Torrisi that you are using does not work very well for today's realities and fast hardware.
Try this one, it is better suited both for the current software and for comparing different hardware platforms: https://github.com/odan/benchmark-php

X
xmoonlight, 2018-07-31
@xmoonlight

cpu family : 6
model : 58
stepping : 9
vs
cpu family : 6
model : 94
stepping : 3
The last (which is faster) is the newer model. And there must have been something wrong.

D
De YURII, 2018-07-31
@Dejurin

Yes, most likely this test is some kind of game. Here's what happened on DO drop tests - 64 GB 32 vCPUs $640/mo

spoiler
--------------------------------------
| PHP BENCHMARK SCRIPT |
--------------------------------------
Start : 2018-07-31 19:27:13
Server : @
PHP version : 7.2.8
Platform : Linux
--------------------------------------
test_math : 0.211 sec.
test_stringmanipulation : 0.282 sec.
test_loops : 0.171 sec.
test_ifelse : 0.143 sec.
--------------------------------------
Total time: : 0.807 sec.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question