SlideShare a Scribd company logo
Best Practices For
Magento Hosting
Chris Wells – Nexcess
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
●
A note on permissions
●
LAMP LAMP LAMP
• PHP basics & the PHP handoff
• Apache vs. Nginx
• MySQL vs. Percona
• Caching best practices
• Using Varnish with Magento
• Final notes
• Questions etc.
Today's Topics
Permissions Matter

chmod 666 / 777 = “make it work good”

Fix it (relative to your web root)
1. Own your files / directories

find -exec chown magento.magento {} ;
2. Make sure the webserver can read it all

find -type f -exec chmod 644 {} ;
3. PHP is for your eyes only

find -type f -name “*.php” -exec chmod 600 {} ;
4. So are config files!

chmod 600 app/etc/*.xml
PHP Basics
• Use APC (as an opcode cache only)
●
apc.shm_size = 256M (at least)
●
apc.num_files_hint = 10000 (at least)
●
apc_stat = 0 (for production)
• Bump memory_limit (512M works well)
• Turn OFF open_basedir
• Leaving it ON kills the realpath cache
• Use a recent version of PHP
• 5.4.x may be too recent
The PHP Hand-off
• Apache + mod_php
• Runs as webserver user
• Unified mega-process
• Apache + suPHP / phpSuEXEC
• Runs as you
• Expensive to create
• Apache/Nginx + PHP-FPM
• Runs as you
• Cheap to use (processes are waiting)
• Scales more efficiently than all of the above
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
VS.
The Webserver Showdown
So … Apache vs. Nginx?
• The answer is …

YES!
• Apache comes bloated – remove needless modules!
• Magento supports Apache out-of-the-box
• Rewrites work as expected
• Extensions may assume Apache-like features exist
• PHP-FPM levels the performance / scalability field
• Varnish helps as well (we’re getting ahead of ourselves)
• Go with what you know!!
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
VS.
The DB Showdown
Percona wins ... no need to use fade-ins ... next slide
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Percona's Benefits / Tweaks
• Percona’s Xtra DB is fast – especially under load
• Percona is a simple replacement
• My.cnf tweaks:
• innodb_thread_concurrency = 24 (1 – 2x # of cores)
• innodb_buffer_pool_size = 16G (at least)
• innodb_flush_log_at_trx_commit = 1
• innodb_io_capacity = 800
• innodb_flush_method = O_DIRECT
Time to Cache in
• Memcache:
• PRO: multi-threaded, socket/tcp based
• CON: no tagging
• Redis
• PRO: TAGGING, fast, socket/tcp based
• CON: single threaded
• APC:
• PRO: provides op-code cache
• CON: no CLI usage, can’t share, no tagging, restart
causes flush, we avoid for key/value pair caching
Caching Best Practices – Part 1
• Using Magento Enterprise?
• Turn on the Full Page Cache (FPC)
• Huge throughput gains
• Huge response time gains
●
Use a dedicated Redis instance!
• Quick, easy and it works
• Not Using Enterprise?
• No simple “light -switch” solution
• But … Varnish is a good option :)
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Caching Best Practices – Part 2
• Setup the Magento 2-level cache
• Fast cache = memcache
• Multi-threaded, responds better under heavy load
• Run multiple Redis if you like
• Slow cache = Redis
• Single-threaded
• Slow cache may not be used
• Setup a dedicated memcache for sessions
• Size the caches correctly! Fast cache should fit all data!
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Caching the Caches With Varnish
Caching the Caches With Varnish
• Caches entire pages (or parts of them)
●
Use an extension to integrate with Magento
●
Turpentine is ours
●
Free / open source for all Magento versions
• HUGE performance gains for visitors
• Requires more thought than FPC
• SSL requires further hoop-jumping
• ESI requires yet further hoop-jumping
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Final Thoughts
• 777 and 666 are both evil
• PHP-FPM is the way to go
• Apache and Nginx can be friends
• Percona
• FPC with Redis back-end
• Two-level caching
●
Fast cache = memcache
●
Slow cache = Redis
• Turpentine / Varnish if you can
More Information:
Turpentine is available at:
http://www.nexcess.net/turpentine or on Magento Connect
Our new performance whitepaper is available at:
http://www.nexcess.net/magento-best-practices-whitepaper
Thank You!
Questions?

More Related Content

PPTX
Nginx [engine x] and you (and WordPress)
PDF
WordPress Performance & Scalability
PDF
EasyEngine - Command-Line tool to manage WordPress Sites on Nginx
PDF
Scaling WordPress
PDF
WordCamp RVA
PDF
Setting up a local WordPress Environment
PPT
Roy foubister (hosting high traffic sites on a tight budget)
Nginx [engine x] and you (and WordPress)
WordPress Performance & Scalability
EasyEngine - Command-Line tool to manage WordPress Sites on Nginx
Scaling WordPress
WordCamp RVA
Setting up a local WordPress Environment
Roy foubister (hosting high traffic sites on a tight budget)

What's hot (18)

PDF
Wordpress -> Middleman: Lesson learned in the 2-years since migrating
ZIP
High Performance WordPress - WordCamp Jerusalem 2010
PDF
Debugging WordPress Performance using EasyEngine
PDF
Optimize drupal
PDF
Caching for Cash: Caching
PDF
WordCamp RVA 2011 - Performance & Tuning
PPT
WebSockets and Java
KEY
Tech4Africa - Tuning LAMP, and beyond LAMP
PDF
Caching for Cash: Benchmarking and Profiling
PPTX
Presentation1
PDF
Magento performance & optimisation best practices
PPT
High Performance WordPress
PPT
ServerBeach and WordPress BlogWorldExpo 2007
PPTX
Silverstripe at scale - design & architecture for silverstripe applications
PDF
Merb Presentation
PPTX
Magento performance
KEY
MySQL Performance - SydPHP October 2011
PPT
High Performance Wordpress: “Faster, Cheaper, Easier : Pick Three”
Wordpress -> Middleman: Lesson learned in the 2-years since migrating
High Performance WordPress - WordCamp Jerusalem 2010
Debugging WordPress Performance using EasyEngine
Optimize drupal
Caching for Cash: Caching
WordCamp RVA 2011 - Performance & Tuning
WebSockets and Java
Tech4Africa - Tuning LAMP, and beyond LAMP
Caching for Cash: Benchmarking and Profiling
Presentation1
Magento performance & optimisation best practices
High Performance WordPress
ServerBeach and WordPress BlogWorldExpo 2007
Silverstripe at scale - design & architecture for silverstripe applications
Merb Presentation
Magento performance
MySQL Performance - SydPHP October 2011
High Performance Wordpress: “Faster, Cheaper, Easier : Pick Three”
Ad

Viewers also liked (8)

PDF
Mobile First: Responsive Design for eCommerce | Imagine 2013 Technology | B…
PDF
Brands to Beat: Brand Building in an Omni Channel World | Imagine 2013 Strate...
PDF
Act Now: 10 Tips for Boosting your Business | Magento Imagine 2013 Marketing ...
PDF
Data Isolation and Merchandizing in a Single Magento Instance | Imagine 2013 ...
PDF
The Importance of Fully Managed Hosting for Magento Enterprise | Imagine 2013...
PDF
The Future of Magento Extensibility | Imagine 2013 Technology | Christopher O...
PDF
Learning to Fly: How Angry Birds Reached the Heights of Store Performance |…
PDF
Happy Together: Creating Successful Magento ERP Integrations | Imagine 2013…
Mobile First: Responsive Design for eCommerce | Imagine 2013 Technology | B…
Brands to Beat: Brand Building in an Omni Channel World | Imagine 2013 Strate...
Act Now: 10 Tips for Boosting your Business | Magento Imagine 2013 Marketing ...
Data Isolation and Merchandizing in a Single Magento Instance | Imagine 2013 ...
The Importance of Fully Managed Hosting for Magento Enterprise | Imagine 2013...
The Future of Magento Extensibility | Imagine 2013 Technology | Christopher O...
Learning to Fly: How Angry Birds Reached the Heights of Store Performance |…
Happy Together: Creating Successful Magento ERP Integrations | Imagine 2013…
Ad

Similar to Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog… (20)

PDF
Magento's Imagine eCommerce Conference 2011 - Hosting Magento: Performance an...
PDF
Magento Imagine eCommerce Conference February 2011: Optimizing Magento For Pe...
PPTX
Lonestar php scalingmagento
PPTX
Zendcon scaling magento
PPTX
Improving Performance on Magento 1*
PPTX
Phpworld.2015 scaling magento
PPTX
Midwest PHP - Scaling Magento
PDF
Optimizing Magento Performance with Zend Server
PPTX
Magento performances 2015 best practices
PPTX
Magento for-performance- v01
PPTX
Nexcess Magento Imagine 2014 Performance Breakout
PDF
Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to ...
PPTX
Tech4Africa 2014
PDF
Magento caching
PDF
Cache all the things - A guide to caching Drupal
PDF
Oleh Kobchenko - Configure Magento 2 to get maximum performance
PDF
Optimizing Magento for Peak Performance
PDF
Nginx pres
PDF
Magento Performance Optimization 101
PPTX
Boost your website by running PHP on Nginx
Magento's Imagine eCommerce Conference 2011 - Hosting Magento: Performance an...
Magento Imagine eCommerce Conference February 2011: Optimizing Magento For Pe...
Lonestar php scalingmagento
Zendcon scaling magento
Improving Performance on Magento 1*
Phpworld.2015 scaling magento
Midwest PHP - Scaling Magento
Optimizing Magento Performance with Zend Server
Magento performances 2015 best practices
Magento for-performance- v01
Nexcess Magento Imagine 2014 Performance Breakout
Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to ...
Tech4Africa 2014
Magento caching
Cache all the things - A guide to caching Drupal
Oleh Kobchenko - Configure Magento 2 to get maximum performance
Optimizing Magento for Peak Performance
Nginx pres
Magento Performance Optimization 101
Boost your website by running PHP on Nginx

More from Atwix (20)

PPTX
Igor Miniailo - Magento 2 API Design Best Practices
PPTX
Valeriy Nayda - Best Practices in Magento 2. Based on Multi Source Inventory ...
PDF
Yaroslav Rogoza - Development Environment: Local or Remote?
PDF
Magento 2 performance comparison in different environments by Yaroslav Rogoza...
PPTX
Viacheslav Kravchuk. Working as a distributed company. Our journey. Meet Mage...
PPTX
Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2
PDF
Александр Смага, Юрий Муратов - Meet Magento Ukraine - Технический обзор OroCRM
PPTX
Иван Чепурный - Meet Magento Ukraine - Varnish Cache and its usage in the rea...
PDF
Владимир Дубина - Meet Magento Ukraine - Data consistency
PDF
Андрей Самиляк - Meet Magento Ukraine - Как мы играли в DevOps и как получилс...
PPTX
Сергей Кибиткин - Meet Magento Ukraine - Что вы никогда не сделаете в Magento
PDF
Макс Екатериненко - Meet Magento Ukraine - Magento 2 Overview
PPTX
Александр Каранда - Meet Magento Ukraine - Реальность нереальных вещей
PPTX
Антон Капля - Meet Magento Ukraine - Кодогенератор в Magento
PDF
Анатолій Денис - Meet Magento Ukraine - Migration to Magento - mission possible
PDF
Артем Кузнецов - Meet Magento Ukraine - инструменты для отдела поддержки, опы...
PDF
Александр Стельмах - Meet Magento Ukraine - Прибыльная e-mail рассылка за 5 ш...
PDF
Владимир Галика - Meet Magento Ukraine - Чудесный Новый Мир – почему продвиже...
PPTX
Александр Колб - Meet Magento Ukraine - психология потребления онлайн
PPTX
Елена Леонова - Meet Magento Ukraine - Трасформация в e-commerce с Magento
Igor Miniailo - Magento 2 API Design Best Practices
Valeriy Nayda - Best Practices in Magento 2. Based on Multi Source Inventory ...
Yaroslav Rogoza - Development Environment: Local or Remote?
Magento 2 performance comparison in different environments by Yaroslav Rogoza...
Viacheslav Kravchuk. Working as a distributed company. Our journey. Meet Mage...
Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2
Александр Смага, Юрий Муратов - Meet Magento Ukraine - Технический обзор OroCRM
Иван Чепурный - Meet Magento Ukraine - Varnish Cache and its usage in the rea...
Владимир Дубина - Meet Magento Ukraine - Data consistency
Андрей Самиляк - Meet Magento Ukraine - Как мы играли в DevOps и как получилс...
Сергей Кибиткин - Meet Magento Ukraine - Что вы никогда не сделаете в Magento
Макс Екатериненко - Meet Magento Ukraine - Magento 2 Overview
Александр Каранда - Meet Magento Ukraine - Реальность нереальных вещей
Антон Капля - Meet Magento Ukraine - Кодогенератор в Magento
Анатолій Денис - Meet Magento Ukraine - Migration to Magento - mission possible
Артем Кузнецов - Meet Magento Ukraine - инструменты для отдела поддержки, опы...
Александр Стельмах - Meet Magento Ukraine - Прибыльная e-mail рассылка за 5 ш...
Владимир Галика - Meet Magento Ukraine - Чудесный Новый Мир – почему продвиже...
Александр Колб - Meet Magento Ukraine - психология потребления онлайн
Елена Леонова - Meet Magento Ukraine - Трасформация в e-commerce с Magento

Recently uploaded (20)

PDF
KodekX | Application Modernization Development
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Big Data Technologies - Introduction.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Electronic commerce courselecture one. Pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
Cloud computing and distributed systems.
PPTX
A Presentation on Artificial Intelligence
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
KodekX | Application Modernization Development
Per capita expenditure prediction using model stacking based on satellite ima...
Big Data Technologies - Introduction.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
“AI and Expert System Decision Support & Business Intelligence Systems”
Electronic commerce courselecture one. Pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
The AUB Centre for AI in Media Proposal.docx
Review of recent advances in non-invasive hemoglobin estimation
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Unlocking AI with Model Context Protocol (MCP)
Reach Out and Touch Someone: Haptics and Empathic Computing
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
NewMind AI Monthly Chronicles - July 2025
Cloud computing and distributed systems.
A Presentation on Artificial Intelligence
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx

Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…

  • 1. Best Practices For Magento Hosting Chris Wells – Nexcess
  • 3. ● A note on permissions ● LAMP LAMP LAMP • PHP basics & the PHP handoff • Apache vs. Nginx • MySQL vs. Percona • Caching best practices • Using Varnish with Magento • Final notes • Questions etc. Today's Topics
  • 4. Permissions Matter  chmod 666 / 777 = “make it work good”  Fix it (relative to your web root) 1. Own your files / directories  find -exec chown magento.magento {} ; 2. Make sure the webserver can read it all  find -type f -exec chmod 644 {} ; 3. PHP is for your eyes only  find -type f -name “*.php” -exec chmod 600 {} ; 4. So are config files!  chmod 600 app/etc/*.xml
  • 5. PHP Basics • Use APC (as an opcode cache only) ● apc.shm_size = 256M (at least) ● apc.num_files_hint = 10000 (at least) ● apc_stat = 0 (for production) • Bump memory_limit (512M works well) • Turn OFF open_basedir • Leaving it ON kills the realpath cache • Use a recent version of PHP • 5.4.x may be too recent
  • 6. The PHP Hand-off • Apache + mod_php • Runs as webserver user • Unified mega-process • Apache + suPHP / phpSuEXEC • Runs as you • Expensive to create • Apache/Nginx + PHP-FPM • Runs as you • Cheap to use (processes are waiting) • Scales more efficiently than all of the above
  • 9. So … Apache vs. Nginx? • The answer is …  YES! • Apache comes bloated – remove needless modules! • Magento supports Apache out-of-the-box • Rewrites work as expected • Extensions may assume Apache-like features exist • PHP-FPM levels the performance / scalability field • Varnish helps as well (we’re getting ahead of ourselves) • Go with what you know!!
  • 14. Percona wins ... no need to use fade-ins ... next slide
  • 17. Percona's Benefits / Tweaks • Percona’s Xtra DB is fast – especially under load • Percona is a simple replacement • My.cnf tweaks: • innodb_thread_concurrency = 24 (1 – 2x # of cores) • innodb_buffer_pool_size = 16G (at least) • innodb_flush_log_at_trx_commit = 1 • innodb_io_capacity = 800 • innodb_flush_method = O_DIRECT
  • 18. Time to Cache in • Memcache: • PRO: multi-threaded, socket/tcp based • CON: no tagging • Redis • PRO: TAGGING, fast, socket/tcp based • CON: single threaded • APC: • PRO: provides op-code cache • CON: no CLI usage, can’t share, no tagging, restart causes flush, we avoid for key/value pair caching
  • 19. Caching Best Practices – Part 1 • Using Magento Enterprise? • Turn on the Full Page Cache (FPC) • Huge throughput gains • Huge response time gains ● Use a dedicated Redis instance! • Quick, easy and it works • Not Using Enterprise? • No simple “light -switch” solution • But … Varnish is a good option :)
  • 22. Caching Best Practices – Part 2 • Setup the Magento 2-level cache • Fast cache = memcache • Multi-threaded, responds better under heavy load • Run multiple Redis if you like • Slow cache = Redis • Single-threaded • Slow cache may not be used • Setup a dedicated memcache for sessions • Size the caches correctly! Fast cache should fit all data!
  • 25. Caching the Caches With Varnish
  • 26. Caching the Caches With Varnish • Caches entire pages (or parts of them) ● Use an extension to integrate with Magento ● Turpentine is ours ● Free / open source for all Magento versions • HUGE performance gains for visitors • Requires more thought than FPC • SSL requires further hoop-jumping • ESI requires yet further hoop-jumping
  • 30. Final Thoughts • 777 and 666 are both evil • PHP-FPM is the way to go • Apache and Nginx can be friends • Percona • FPC with Redis back-end • Two-level caching ● Fast cache = memcache ● Slow cache = Redis • Turpentine / Varnish if you can
  • 31. More Information: Turpentine is available at: http://www.nexcess.net/turpentine or on Magento Connect Our new performance whitepaper is available at: http://www.nexcess.net/magento-best-practices-whitepaper