Download - Methods and Best Practices for High Performance eCommerce

Transcript
Page 1: Methods and Best Practices for High Performance eCommerce

Apr 10, 2023 | 1 |

Magento HQ Developers Meet up

Methods and Best Practices for High Performance eCommerce.

By Dmitriy SorokaSystem Architect at Magento, Inc

Page 2: Methods and Best Practices for High Performance eCommerce

Performance Improvement Techniques

• Environment– Web Server

Configuration– Data Base Configuration– Accelerating PHP– Additional HTTP

Requests

• Application– Caching– Session Handling– More options

• Scaling– Backend Server– Multiple Frontend

Servers– Multiple Databases

• 3rd party integrations– Integration with Solr

Page 3: Methods and Best Practices for High Performance eCommerce

Benchmarks Methodology

• Siege with different concurrencies– 10, 20, 50, 100

• Database Size– Sample data, 10K products, 80K products

• URLs– CMS Page (home page)– URLs List– Checkout

• Results– Requests per second– Orders per hour

Page 4: Methods and Best Practices for High Performance eCommerce

ENVIRONMENT OPTIMIZATION

Apache, MySQL, PHP

Page 5: Methods and Best Practices for High Performance eCommerce

Apache Configuration

• Apache modules – use just necessary modules• KeepAlive directive• mod_deflate - compress content before

sending it to the browser• Eliminating directory structure scans for

the .htaccess

Page 6: Methods and Best Practices for High Performance eCommerce

MySQL Configuration

• innodb_buffer_pool_size– Combined web and db server, 6 GB RAM – 2-3 GB– Dedicated database server, 6 GB RAM – 5 GB– Dedicated database server, 12 GB RAM – 10 GB

• innodb_thread_concurrency– 2 * [numberofCPUs] + 2

• table_cache is the number of tables that can be simultaneously opened by MySQL

• query_cache_size (64 Mb)• query_cache_limit (2 Mb)

Page 7: Methods and Best Practices for High Performance eCommerce

Optimization Results

Page 8: Methods and Best Practices for High Performance eCommerce

Accelerating PHP

• File system structure optimization• APC• eAccelerator• Zend Optimize• Xcache

Page 9: Methods and Best Practices for High Performance eCommerce

Magento Compiler

Page 10: Methods and Best Practices for High Performance eCommerce

PHP Accelerators

Page 11: Methods and Best Practices for High Performance eCommerce

Additional HTTP Requests

• CSS• Java Script• Images

Page 12: Methods and Best Practices for High Performance eCommerce

APPLICATION OPTIMIZATION

Cache, Sessions

Page 13: Methods and Best Practices for High Performance eCommerce

Cache Types

Page 14: Methods and Best Practices for High Performance eCommerce

Cache Enables vs. Cache disabled

Page 15: Methods and Best Practices for High Performance eCommerce

Cache Storages

Memory Based File System Based

APC

Memcached

xCache

eAccelerator

ZendServer Memory

File

Sqlite

Database (MySQL)

ZendServer disk

Page 16: Methods and Best Practices for High Performance eCommerce

Two Levels Backend

Slow level

Fast level

Two Levels Backend

Page 17: Methods and Best Practices for High Performance eCommerce

Cache Configuration<config> <global> <cache> <!-- apc / memcached / xcache / empty=file --> <backend></backend> <prefix|id_prefix></prefix|id_prefix> <backend_options> <option_code1>option_value1</option_code1> </backend_options> <frontend_options> <option_code1>option_value1</option_code1> </frontend_options>

<memcached> <servers>....</servers> <memcached> </cache> </global></config>

Page 18: Methods and Best Practices for High Performance eCommerce

Slow Backend

<config> <global> <cache> <slow_backend>database</slow_backend> <slow_backend_options> <option_code1>option_value1</option_code1> </slow_backend_options> </cache> </global></config>

Page 19: Methods and Best Practices for High Performance eCommerce

Storages Benchmark

Page 20: Methods and Best Practices for High Performance eCommerce

Full Page Cache (CMS page)

Page 21: Methods and Best Practices for High Performance eCommerce

Full Page Cache (urls list)

Page 22: Methods and Best Practices for High Performance eCommerce

Session Storage

Files Memcached Data Base

Page 23: Methods and Best Practices for High Performance eCommerce

More…

• Flat Catalog• Sales Archive• Backend processes (cron, indexes)• Theme complexity

Page 24: Methods and Best Practices for High Performance eCommerce

SCALINGHardware, Web Nodes, Data Base

Page 25: Methods and Best Practices for High Performance eCommerce

Hardware

Page 26: Methods and Best Practices for High Performance eCommerce

Separate Backend Server

• Data Base• Handle admin users• Process backend activity (cron)• Pre generate Full Page Cache• Handle media queries

Page 27: Methods and Best Practices for High Performance eCommerce

Multiple Web Nodes (browsing)

Page 28: Methods and Best Practices for High Performance eCommerce

Multiple Web Nodes (checkout)

Page 29: Methods and Best Practices for High Performance eCommerce

Data Base

config/global/resources

<default_setup> <connection> <host><![CDATA[master]]></host> <username><![CDATA[writeuser]]></username> <password><![CDATA[writeuserpwd]]></password> <dbname><![CDATA[magento]]></dbname> <active>1</active> </connection> </default_setup> <default_read> <connection> <use></use> <host><![CDATA[slave]]></host> <username><![CDATA[readuser]]></username> <password><![CDATA[readuserpwd]]></password> <dbname><![CDATA[magento]]></dbname> <model>mysql4</model> <initStatements>SET NAMES utf8</initStatements> <type>pdo_mysql</type> <active>1</active> </connection> </default_read>

Page 30: Methods and Best Practices for High Performance eCommerce

3RD PARTY INTEGRATIONSSolr

Page 31: Methods and Best Practices for High Performance eCommerce

Using solr

• Spell checking• Search suggestions• Morphology• Category navigation• Facet navigation

Page 32: Methods and Best Practices for High Performance eCommerce

Benchmark Results

Page 33: Methods and Best Practices for High Performance eCommerce

Magento HQ Developers Meet up

Thank YouEmail: [email protected]

Page 34: Methods and Best Practices for High Performance eCommerce

Q&A