Methods and Best Practices for High Performance eCommerce
-
Upload
dmitriysoroka -
Category
Technology
-
view
14.348 -
download
2
description
Transcript of 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
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
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
ENVIRONMENT OPTIMIZATION
Apache, MySQL, PHP
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
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)
Optimization Results
Accelerating PHP
• File system structure optimization• APC• eAccelerator• Zend Optimize• Xcache
Magento Compiler
PHP Accelerators
Additional HTTP Requests
• CSS• Java Script• Images
APPLICATION OPTIMIZATION
Cache, Sessions
Cache Types
Cache Enables vs. Cache disabled
Cache Storages
Memory Based File System Based
APC
Memcached
xCache
eAccelerator
ZendServer Memory
File
Sqlite
Database (MySQL)
ZendServer disk
Two Levels Backend
Slow level
Fast level
Two Levels Backend
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>
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>
Storages Benchmark
Full Page Cache (CMS page)
Full Page Cache (urls list)
Session Storage
Files Memcached Data Base
More…
• Flat Catalog• Sales Archive• Backend processes (cron, indexes)• Theme complexity
SCALINGHardware, Web Nodes, Data Base
Hardware
Separate Backend Server
• Data Base• Handle admin users• Process backend activity (cron)• Pre generate Full Page Cache• Handle media queries
Multiple Web Nodes (browsing)
Multiple Web Nodes (checkout)
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>
3RD PARTY INTEGRATIONSSolr
Using solr
• Spell checking• Search suggestions• Morphology• Category navigation• Facet navigation
Benchmark Results
Magento HQ Developers Meet up
Thank YouEmail: [email protected]
Q&A