Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

52

description

http://www.zerolag.com/magento-hosting/ | Learn how to optimize Magento to increase online profits

Transcript of Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Page 1: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales
Page 2: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

How to Optimize Magento Hosting

to Increase Online Sales

The Devil is in the Details

Page 3: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Introduction

Will Bernstein

Executive Vice President,

Sales and Marketing

Page 4: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Outline

1. Case study: Zarpo.com solution engineering

2. Load testing results: lab vs. real-world testing

3. Best practices for Magento-optimized development

4. The link between performance and conversion

Page 5: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Case Study: Mystery of the Locked DB

• Zarpo.com is the first and largest flash sale travel

website in Latin America

• Based in

o Paulo Brazil

• Zarpo’s objective is to provide the best online user

experience to demanding Latin American travelers

• Running a highly customized deployment of Magento

Enterprise Edition

Page 6: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Case Study: Mystery of the Locked DB

Monday, January 13, 2014 – Catastrophic Event

• 12:37 PM: Critical ticket opened with ZeroLag Support –

“Zarpo is badly down”

• 12:48 PM: Initial trouble analysis complete – MySQL crash

– Extremely high volume of queries locked up the DB

• 1:04 PM: ZeroLag engineer kills queries and restarts SQL –

site back online

• 1:22 PM: Queries continue to pound SQL for reasons

unknown. ZeroLag staff keeps SQL online

Page 7: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Case Study: Mystery of the Locked DB

Monday, January 13, 2014

• 4:27 PM: Root cause deep dive begins

– Team is assembled: DBA and senior Magento / Linux engineers

Page 8: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Case Study: Mystery of the Locked DB

Monday, January 13, 2014

• 5:00 PM: DB diagnostics and configuration analysis begins

• 6:18 PM: Test environment is set up to focus on DB cache

under load

Page 9: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Case Study: Mystery of the Locked DB

Tuesday, January 14, 2014

• 8:15 AM: Root cause identified

– An AJAX call checks a custom cache

– When a travel deal gets sold or updated the cache is cleared

and the next AJAX call kicks off a recache

– If a cache has not been built by the time next AJAX call

happens, another cache rebuild gets launched

– Zarpo had recently released its mobile application and usage

increased 800% causing a massive log jam of cache rebuilds

Page 10: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Case Study: Mystery of the Locked DB

Tuesday, January 14, 2014

• 9:18 AM: Solution engineering begins

Page 11: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Case Study: Mystery of the Locked DB

Tuesday, January 14, 2014

• Developer briefing: ZeroLag recommends solution

– Add Ajax code that blocks all rebuilds if a rebuild is already in progress

• The Ajax call puts up a “loading new deals” clock for users during cache rebuilds

• As an added benefit, the clock contributes to the user experience by helping build

customer anticipation for deals, consistent with the flash sale business model

Page 12: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Case Study: Mystery of the Locked DB

Tuesday, January 14, 2014

Zarpo names the successful solution “The McManus Magic Shield”

Page 13: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Case Study: Mystery of the Locked DB

Skype Room Chat Report from Zarpo

[1/24/14, 9:41:45 AM] Alexis Manach: excellent

news

[1/24/14, 9:41:56 AM] Alexis Manach: the

McManus magic shield is on..

[1/24/14, 9:42:09 AM] Alexis Manach: and

working beautifully..

[1/24/14, 9:42:43 AM] Alexis Manach: this

morning i triggered this big event recache with

over 550 concurrent users online and site did

not even move a little bit.

Page 14: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

About ZeroLag

Get the power of 1:1

• Magento Platinum Hosting Partner

• Founded April 1999

• Founder, CEO Greg Strelzoff

• 80 Employees

• We never throw developers

under the bus!

Page 15: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Load Testing Results 02

Cameron King

Linux Manager

Page 16: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Purpose

• To observe Magento performance under varying store

sizes, cache configurations, and traffic levels

– Directly relates to questions we get asked on a weekly basis

during the pre-sale process

Page 17: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Lab and store test setup

• Environment: single load test server – Tool: Gatling

– Method: Blind test (unbiased)

– Tiers: Single web & DB, Dual web & DB

– Code: stock Magento EE 1.13, no plugins

• Test grid: – Cache: Memcached, Redis

– Store sizes: 1K, 100K, 500K products

– Traffic: 100, 200, 300, 400, 500 concurrent browsers

• Success rate: 99% to consider valid test

Page 18: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Environment Response Time vs. Traffic

www

db

www

db

www

Page 19: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

At 100 concurrent browsers, the “smaller” environment

performed best…

Environment Response Time vs. Traffic

It depends on where the bottlenecks are!

• At low levels, CPU is not strained

• No benefit of extra CPU power from

two web servers

• 50ms overhead due to shared PHP

sessions (Memcached) and file

system (NFS)

Page 20: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Cache Response Time vs. Traffic

Redis Memcached

Page 21: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Lab Load Test Recap

• Environment sizing is important to performance

• Stock Magento is fast and scalable when deployed with

best practices

• Memcached and Redis have similar performance

profiles when under load

• This establishes a baseline on which we can compare

some real-world sites

Page 22: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Real-World Testing

• Selected 5 representative Magento sites

• Tested during off-peak hours

• Abort testing at >1% failure rate

• Generate Gatling install script for each site

• Same testing procedure as Lab tests

Page 23: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Client Response Time vs. Traffic

Page 24: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Client Response Time vs. Traffic

• Performs worse than the baseline

• Enabled Enterprise Edition Full Page

Cache, but not fully utilized

• Replaced stock Magento frontend with

Expression Engine

www www

db

Page 25: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Client Response Time vs. Traffic

• Performs better than the baseline

• Enabled a number of custom plugins

• Using Varnish and third-party plugin

www

Page 26: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Client Response Time vs. Traffic

• Performs better than the baseline

• Front-end designed for Magento

• Using Enterprise Edition FPC

• Using local HTTP Accelerator

www www www

db

Page 27: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Client Response Time vs. Traffic

• Best scalability of all tested sites

• Most consistent performance

• Front-end designed for Magento

• Using Enterprise Edition FPC

• Using cloud-based HTTP accelerator

www www

db

Page 28: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Client Response Time vs. Traffic

Page 29: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Client Response Time vs. Traffic

www

db

• Great single-user experience

• Very poor scalability

• A large number of complex plugins

• Significant development issues

• Multiple developers working on the site

• File-based Magento fast cache

• DB-based PHP sessions

• FPC incompatible with plugins/code

• CPU intensive site

Page 30: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Real-World Load Test Recap

• Code quality is the single greatest factor in determining

performance of a Magento site

– Frontend

– Plugins

– Custom Code

• FPC, HTTP accelerators, clustering, and in-memory

fast cache are excellent ways to improve scalability

Page 31: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Best Practices in

Magento Development 03

Doug Goldberg

Vice President,

Magento Solutions

Page 32: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Common Bottlenecks

Poorly Optimized Frontend

– Making performance-impacting changes

– Very large images

– Hundreds of very small images

– Uncombined JavaScript/CSS

– JavaScript/CSS out of order

– No browser caching

– Performance-intensive uncached page elements

Page 33: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Best Practices

• Reduce the number of HTTP requests, limit external requests

– Base install of Magento has < 40 calls

– Most Magento sites I have seen: 100+ calls

• Compress files

– JavaScript, images, HTML, CSS, etc.

– Images should not be over 50KB

• Minify JS

– Removes unnecessary spaces, tabs, and other

selected characters

– Reduces overall size of the file

• Combine or merge JS and CSS

Page 34: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Best Practices, cont.

• Load CSS first, JavaScript last

– Page appears to be loaded on the user’s machine while JavaScript is catching

up and loading in the background

• Add expiration headers for static graphic files (Browser cache)

– 80% of page load time is downloading scripts, images, and CSS, which

normally don’t change very often

• Use CSS sprites

– Can cut page load time by reducing the amount of HTTP requests your page

makes to the server, through the consolidation of your CSS background

images

Page 35: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Best Practices, cont.

• Avoid redirects

– Site loads a header with a blank page, then loads

new page

– Increases the time it takes to get the user to the

page they actually want

• Use cache very aggressively

– Including Magento FPC if on Enterprise Edition

• Use CDN

– And even multiple zones for parallel downloads

Page 36: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

A Glimpse into the Future 04

Page 37: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

HipHop Virtual Machine

• HipHop for PHP: a series of execution engines

and improvements created by Facebook

– Original motivation: save server resources

given large PHP codebase of facebook.com

– As development progressed: realization that

HipHop could substantially increase the speed

of PHP applications in general

• Current version open-sourced in late 2011

– Known as HHVM (HipHop Virtual Machine)

Page 38: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Case Study – Magento and HHVM

• Car Part Kings

• Wanted to run HHVM and fpm on the

same production site to compare

performance

• How do you do that?

– Query parameter strings (?h=1)

Page 39: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

What does that look like?

• fpm

– carpartkings.com/mann-cabin-air-filter-cu-2949-2.html

• HHVM

– carpartkings.com/mann-cabin-air-filter-cu-2949-2.html?h=1

Page 40: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

How did it perform?

• fpm page load time = 2.16 seconds

• HHVM page load time = 1.14 seconds

• On the first day, conversion increased by

500% over the similar fpm pages

• Facebook has seen increases in web

page generation throughput by factors of

up to 6x vs. Zend PHP

Page 41: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Is HHVM ready for primetime?

• Not quite yet – Car Part Kings, ZeroLag and the HHVM consultant got it working

– But it needed to be restarted 4 to 5 times a day

• Currently deactivated – HHVM consultant working on a solution to eliminate crashes

Page 42: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

The Link Between

Performance and Conversion 05

Aaron Koch

Vice President,

Direct Sales

Page 43: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

How performance impacts your business

Why is performance critical?

Studies show users are more likely to convert on a faster site

− Slow sites subconsciously erode user confidence

− User Experience is everything and there are two components:

• Visible user experience - look and feel of the site along with

information architecture

• Invisible user experience - the passage of time itself

• Front-end innovation combined with back-end performance

optimization delivers the best User Experience possible

Page 44: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

How performance impacts your business

Magento performance can set your revenue on fire…

Page 45: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

How performance impacts your business

But slowing down suddenly can cost you dearly!

Page 46: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

How performance impacts your business

• Consciously or not, visitors expect pages to load in two

seconds or less

• A one-second delay reduces conversions by 7%*

• Even seemingly tolerable delays can add up to substantial

lost revenue

– For example, a site which sells $100,000 per day can lose as much as

$2.5 million annually for every extra second of page load delay*

• Small changes in site speed can have a huge impact on

e-commerce sales

*According to research conducted by Akamai and Gomez Advisors (now Compuware)

Page 47: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Relationship of load time and bounce rate

Lost Opportunity

Page 48: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Evaluating your site

Use free tools to analyze your Magento sites

• Knowing is half the battle

WebPagetest (webpagetest.org)

• TTFB, image compression,

caching, CDN

• Compare web sites’ page load

times

Page 49: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Evaluating your site

Use free tools to analyze your Magento sites

• Knowing is half the battle

Gtmetrix (gtmetrix.com)

• Breakdown 25+ page speed

components

• Provides performance

improvement recommendations

• Also, Magento-specific

recommendations

Page 50: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Evaluating your site

Use free tools to analyze your Magento sites

• Knowing is half the battle

YSlow (yslow.org)

• Waterfall chart shows each call

to build the page, with

associated load time

• Open Source; also available as

browser plugin for Chrome,

Firefox, more

Page 51: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Leave this room with a plan

• Choose a hosting company that you think will best

support your business

• Implement a multi-layered strategy for

optimization and caching

• Communicate with your hosting company

and your solution partner; work together

to improve performance

• Remember that your website is a tool, not a canvas

Page 52: Imagine 2014: The Devil is in the Details How to Optimize Magento Hosting to Increase Online Sales

Thank you!

ZeroLag.com | 877-ZERO-LAG