Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

29
Miguel Balparda Magento 2: Premium Performance with PHP 7 and Varnish

Transcript of Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

Page 1: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

Miguel Balparda

Magento 2: Premium Performance with PHP 7 and Varnish

Page 2: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

•Full time traveler •Magento Master 2016•Meet Magento speaker•Magento Certified Solution Specialist•BBQ Certified Solution Specialist

Miguel Balparda

@mbalparda

Page 3: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

Test overview

1. Magento 2 using PHP 5.6 vs Magento 2 using PHP 5.6 and Varnish

2. Magento 2 using PHP 7 vs Magento 2 using PHP 7 and Varnish

3. Magento 2 using PHP 5.6 vs Magento 2 using PHP 7

Page 4: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

Hardware

Page 5: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

Software● Apache 2.2● Redis 2.8.4● PHP-FPM 5.6.15 (latest versions available at testing time)● PHP-FPM 7.0.2 (latest versions available at testing time)● Percona 5.6● Varnish 4.0.1● Centos 6.7 x86_64● Siege 3.0.5● Magento 2.0.2 with sample data and sample theme

Page 6: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

Varnish

Page 7: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

Varnish + Magento

Page 8: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

Magento + Varnish

Replace your default VCL and restart the service

service varnish restart

Page 9: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

Magento env.php (redis)

'cache' =>array( 'frontend' => array( 'default' => array( 'backend' => 'Cm_Cache_Backend_Redis', 'backend_options' => array( 'server' => '127.0.0.1', 'port' => '6379' ), ),

Page 10: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

Magento env.php (redis)

'page_cache' => array( 'backend' => 'Cm_Cache_Backend_Redis', 'backend_options' => array( 'server' => '127.0.0.1', 'port' => '6379', 'database' => '1', 'compress_data' => '0' ) ) ))

Page 11: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

Magento env.php (memcache)

(PHP memcache extension)

'session' => array ( 'save' => 'memcache', 'save_path' => 'tcp://<memcache ip or host>:<memcache port>'),

(PHP memcached extension)

'session' => array ( 'save' => 'memcached’, 'save_path' => '<memcache ip or host>:<memcache port>'),

Page 12: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

Magento CLI

We enabled production mode by running:

magento deploy:mode:set production

Page 13: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

Siege automation#!/bin/shecho "Creating sitemap:"curl $4 | sed 's/\<url\>/\<url\>\n/g' | grep 0.5 | sed 's/.*loc>\(.*\)<\/loc.*/\1/g' > urls.txtcurl $4 | sed 's/\<url\>/\<url\>\n/g' | grep 1.0 | sed 's/.*loc>\(.*\)<\/loc.*/\1/g' >>urls.txtecho "Warming cache:"siege -i -c50 -t60s -f urls.txt

echo "Waiting 1 minute for the first test."sleep 1mecho "Starting tests:"for i in `seq 1 $5`;do

echo "Running test # $i / $5:"Siege -i -c$1 -t$2s -f urls.txtecho "Waiting 1 minute for the next test."sleep 1m

doneecho "Removing urls.txt:"rm urls.txt

Page 14: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

Siege output ** Siege 2.60

** Preparing 100 concurrent users for battle.The server is now under Siege...doneTransactions: 339 hitsAvaility: 93.39 %Elapsed time: 67.47 secsData transferred: 4273708 bytesResponse time: 8.25 secsTransaction rate: 5.02 trans/secThroughput: 63342.34 bytes/secConcurrency: 41.47Successful transactions: 337Failed transactions: 26Longest transaction: 17.77 secsShortest transaction: 0.37 secs

Page 15: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

PHP 5.6 transaction rate

Page 16: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

PHP 5.6 transactions

Page 17: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

PHP 5.6 response time

Page 18: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

PHP 5.6 vs PHP 5.6 Varnish transaction rate

8x2.3x2x

Page 19: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

PHP 5.6 vs PHP 5.6 Varnish transactions

9x5x2x

Page 20: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

PHP 5.6 vs PHP 5.6 Varnish response time

377x90x50x

Page 21: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

PHP 7 transaction rate

Page 22: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

PHP 7 vs PHP 7 Varnish transaction rate

4.7x1.6x1-7x

Page 23: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

PHP 7 vs PHP 7 Varnish transactions

5x1.5x1.6x

Page 24: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

PHP 7 vs PHP 7 Varnish response time

187x31x51x

Page 25: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

PHP 5.6 vs PHP 7 transaction rate

Page 26: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

PHP 5.6 vs PHP 7 transactions

Page 27: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

PHP 5.6 vs PHP 7 response time

Page 28: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

Conclusion

Page 29: Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish

Thank you for coming!