Ho cercato di riprodurre questo benchmark che paragona PHP 7 con le versioni precedenti su un server di Wordpress: http://talks.php.net/oz15#/wpbenchPHP 7 Prestazioni
La mia configurazione è quasi la stessa, il server ha un i7, SSD, 16 GB di RAM e debian . Il software server è nginx. Sorprendentemente i miei risultati si differenziano molto da quelli che ho collegato sopra.
Nel mio test Siege (https://www.joedog.org/siege-home/) emette il seguente:
Per PHP 7.0.0RC1:
siege -c100 -r100 http://10.22.255.133/wordpress/
** SIEGE 3.0.8
** Preparing 100 concurrent users for battle.
The server is now under siege.. done.
Transactions: 10000 hits
Availability: 100.00 %
Elapsed time: 131.61 secs
Data transferred: 95.77 MB
Response time: 0.75 secs
Transaction rate: 75.98 trans/sec
Throughput: 0.73 MB/sec
Concurrency: 56.98
Successful transactions: 10000
Failed transactions: 0
Longest transaction: 1.01
Shortest transaction: 0.04
Per PHP 5.6.12:
siege -c100 -r100 http://10.22.255.133/wordpress/
** SIEGE 3.0.8
** Preparing 100 concurrent users for battle.
The server is now under siege.. done.
Transactions: 10000 hits
Availability: 100.00 %
Elapsed time: 63.41 secs
Data transferred: 95.77 MB
Response time: 0.03 secs
Transaction rate: 157.70 trans/sec
Throughput: 1.51 MB/sec
Concurrency: 4.45
Successful transactions: 10000
Failed transactions: 0
Longest transaction: 0.63
Shortest transaction: 0.01
Quando osservando il tasso di transazione che puoi vedere, PHP 5 è circa due volte più veloce di PHP 7. Non posso credici.
Un altro fatto interessante è che l'esecuzione di questo benchmark (http://www.php-benchmark-script.com/) comporta che PHP 7 sia circa 3 volte più veloce di PHP 5 (ovviamente sullo stesso server in cui ho anche testato Wordpress). I risultati misurati sono stati:
- PHP 7.0.0RC1 | PHP 5.5.28
- Matematica: 0.201 | 0.683
- Manipolazione stringa: 0,271 | 0.77
- Loop: 0.166 | 0.486
- Se diverso: 0.12 | 0,295
Ho caricato sia phpinfo() i file in caso che aiuta:
- Versione PHP 7.0.0RC1: http://simsso.de/downloads/stackoverflow/php7.html
- PHP versione 5.6.12-0 + deb8u1: http://simsso.de/downloads/stackoverflow/php5.html
Avete idea del perché PHP 7 sia molto più lento nei miei test con Wordpress?
Con opcache abilitato PHP 7 è in realtà due volte più veloce di PHP 5. Grazie mjh per il suggerimento!
Ho effettuato le seguenti misurazioni su un server WordPress pieno a caso.
Assedio ora emette il seguente per PHP 7.0.0RC1:
Transactions: 10000 hits
Availability: 100.00 %
Elapsed time: 62.14 secs
Data transferred: 604.20 MB
Response time: 0.02 secs
Transaction rate: 160.93 trans/sec
Throughput: 9.72 MB/sec
Concurrency: 3.77
Successful transactions: 10000
Failed transactions: 0
Longest transaction: 0.41
Shortest transaction: 0.01
E PHP 5.6.12:
siege -c100 -r100 http://10.22.255.133/wordpress/
** SIEGE 3.0.8
** Preparing 100 concurrent users for battle.
The server is now under siege.. done.
Transactions: 10000 hits
Availability: 100.00 %
Elapsed time: 119.98 secs
Data transferred: 604.20 MB
Response time: 0.60 secs
Transaction rate: 83.35 trans/sec
Throughput: 5.04 MB/sec
Concurrency: 49.86
Successful transactions: 10000
Failed transactions: 0
Longest transaction: 4.06
Shortest transaction: 0.04
È stato disattivato il supporto sessione per il test? Inoltre, hai eseguito 'siege' sulla stessa macchina in cui sono installati nginx e php-fpm? – Mjh
Grazie per la tua risposta! Il supporto alla sessione è disabilitato e Siege è in esecuzione su un'altra macchina nella rete locale. Mi sono anche assicurato che la rete non fosse un fattore limitante. –
La configurazione di 'php-fpm' è la stessa per entrambe le versioni di php? Inoltre, sembra che opcache non è abilitato per il tuo php 7, mentre è per php 5. Questo da solo può ammontare per enorme differenza .. – Mjh