SlideShare uma empresa Scribd logo
1 de 32
Baixar para ler offline
Best Practices For
Magento Hosting
Chris Wells – Nexcess
●
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
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!!
VS.
The DB Showdown
Percona wins ... no need to use fade-ins ... next slide
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 :)
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!
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
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?

Mais conteúdo relacionado

Mais procurados

High Performance WordPress - WordCamp Jerusalem 2010
High Performance WordPress - WordCamp Jerusalem 2010High Performance WordPress - WordCamp Jerusalem 2010
High Performance WordPress - WordCamp Jerusalem 2010
Barry Abrahamson
 
Caching for Cash: Caching
Caching for Cash: CachingCaching for Cash: Caching
Caching for Cash: Caching
Scott MacVicar
 
Caching for Cash: Benchmarking and Profiling
Caching for Cash: Benchmarking and ProfilingCaching for Cash: Benchmarking and Profiling
Caching for Cash: Benchmarking and Profiling
Scott MacVicar
 
ServerBeach and WordPress BlogWorldExpo 2007
ServerBeach and WordPress BlogWorldExpo 2007ServerBeach and WordPress BlogWorldExpo 2007
ServerBeach and WordPress BlogWorldExpo 2007
Barry Abrahamson
 
Merb Presentation
Merb PresentationMerb Presentation
Merb Presentation
gueste4d7fc
 

Mais procurados (18)

Wordpress -> Middleman: Lesson learned in the 2-years since migrating
Wordpress -> Middleman: Lesson learned in the 2-years since migratingWordpress -> Middleman: Lesson learned in the 2-years since migrating
Wordpress -> Middleman: Lesson learned in the 2-years since migrating
 
High Performance WordPress - WordCamp Jerusalem 2010
High Performance WordPress - WordCamp Jerusalem 2010High Performance WordPress - WordCamp Jerusalem 2010
High Performance WordPress - WordCamp Jerusalem 2010
 
Debugging WordPress Performance using EasyEngine
Debugging WordPress Performance using EasyEngineDebugging WordPress Performance using EasyEngine
Debugging WordPress Performance using EasyEngine
 
Optimize drupal
Optimize drupalOptimize drupal
Optimize drupal
 
Caching for Cash: Caching
Caching for Cash: CachingCaching for Cash: Caching
Caching for Cash: Caching
 
WordCamp RVA 2011 - Performance & Tuning
WordCamp RVA 2011 - Performance & TuningWordCamp RVA 2011 - Performance & Tuning
WordCamp RVA 2011 - Performance & Tuning
 
WebSockets and Java
WebSockets and JavaWebSockets and Java
WebSockets and Java
 
Tech4Africa - Tuning LAMP, and beyond LAMP
Tech4Africa - Tuning LAMP, and beyond LAMPTech4Africa - Tuning LAMP, and beyond LAMP
Tech4Africa - Tuning LAMP, and beyond LAMP
 
Caching for Cash: Benchmarking and Profiling
Caching for Cash: Benchmarking and ProfilingCaching for Cash: Benchmarking and Profiling
Caching for Cash: Benchmarking and Profiling
 
Presentation1
Presentation1Presentation1
Presentation1
 
Magento performance & optimisation best practices
Magento performance & optimisation best practicesMagento performance & optimisation best practices
Magento performance & optimisation best practices
 
High Performance WordPress
High Performance WordPressHigh Performance WordPress
High Performance WordPress
 
ServerBeach and WordPress BlogWorldExpo 2007
ServerBeach and WordPress BlogWorldExpo 2007ServerBeach and WordPress BlogWorldExpo 2007
ServerBeach and WordPress BlogWorldExpo 2007
 
Silverstripe at scale - design & architecture for silverstripe applications
Silverstripe at scale - design & architecture for silverstripe applicationsSilverstripe at scale - design & architecture for silverstripe applications
Silverstripe at scale - design & architecture for silverstripe applications
 
Merb Presentation
Merb PresentationMerb Presentation
Merb Presentation
 
Magento performance
Magento performanceMagento performance
Magento performance
 
MySQL Performance - SydPHP October 2011
MySQL Performance - SydPHP October 2011MySQL Performance - SydPHP October 2011
MySQL Performance - SydPHP October 2011
 
High Performance Wordpress: “Faster, Cheaper, Easier : Pick Three”
High Performance Wordpress: “Faster, Cheaper, Easier : Pick Three”High Performance Wordpress: “Faster, Cheaper, Easier : Pick Three”
High Performance Wordpress: “Faster, Cheaper, Easier : Pick Three”
 

Destaque

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

Destaque (8)

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

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

Site Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariSite Performance - From Pinto to Ferrari
Site Performance - From Pinto to Ferrari
Joseph Scott
 

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

EECI 2013 - ExpressionEngine Performance & Optimization - Laying a Solid Foun...
EECI 2013 - ExpressionEngine Performance & Optimization - Laying a Solid Foun...EECI 2013 - ExpressionEngine Performance & Optimization - Laying a Solid Foun...
EECI 2013 - ExpressionEngine Performance & Optimization - Laying a Solid Foun...
 
Top ten-list
Top ten-listTop ten-list
Top ten-list
 
Drupal performance
Drupal performanceDrupal performance
Drupal performance
 
4Developers 2015: Scaling LAMP doesn't have to suck - Sebastian Grodzicki
4Developers 2015: Scaling LAMP doesn't have to suck - Sebastian Grodzicki4Developers 2015: Scaling LAMP doesn't have to suck - Sebastian Grodzicki
4Developers 2015: Scaling LAMP doesn't have to suck - Sebastian Grodzicki
 
Anthony Somerset - Site Speed = Success!
Anthony Somerset - Site Speed = Success!Anthony Somerset - Site Speed = Success!
Anthony Somerset - Site Speed = Success!
 
High Performance Drupal Sites
High Performance Drupal SitesHigh Performance Drupal Sites
High Performance Drupal Sites
 
Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i  Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i
 
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcached
 
Improve WordPress performance with caching and deferred execution of code
Improve WordPress performance with caching and deferred execution of codeImprove WordPress performance with caching and deferred execution of code
Improve WordPress performance with caching and deferred execution of code
 
Lonestar php scalingmagento
Lonestar php scalingmagentoLonestar php scalingmagento
Lonestar php scalingmagento
 
Northeast PHP - High Performance PHP
Northeast PHP - High Performance PHPNortheast PHP - High Performance PHP
Northeast PHP - High Performance PHP
 
Caching your rails application
Caching your rails applicationCaching your rails application
Caching your rails application
 
Zendcon scaling magento
Zendcon scaling magentoZendcon scaling magento
Zendcon scaling magento
 
Apache Performance Tuning: Scaling Out
Apache Performance Tuning: Scaling OutApache Performance Tuning: Scaling Out
Apache Performance Tuning: Scaling Out
 
Shootout at the PAAS Corral
Shootout at the PAAS CorralShootout at the PAAS Corral
Shootout at the PAAS Corral
 
Site Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariSite Performance - From Pinto to Ferrari
Site Performance - From Pinto to Ferrari
 
Nginx pres
Nginx presNginx pres
Nginx pres
 
Speeding Up The Snail
Speeding Up The SnailSpeeding Up The Snail
Speeding Up The Snail
 
Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011
 

Mais de Atwix

Mais de Atwix (20)

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

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

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

  • 1. Best Practices For Magento Hosting Chris Wells – Nexcess
  • 2.
  • 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
  • 7.
  • 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!!
  • 10.
  • 11.
  • 12.
  • 14. Percona wins ... no need to use fade-ins ... next slide
  • 15.
  • 16.
  • 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 :)
  • 20.
  • 21.
  • 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!
  • 23.
  • 24.
  • 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
  • 27.
  • 28.
  • 29.
  • 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