how to speed up your magento site

24
© 2014 Netstarter

Upload: netstartersl

Post on 04-Jul-2015

206 views

Category:

Technology


1 download

DESCRIPTION

Dilhan Maduranga - Software Engineer (PHP) & Prasad Kodithuwakku - Tech Lead (Training & Consulting)

TRANSCRIPT

Page 1: How to speed up Your Magento Site

© 2014 Netstarter

Page 2: How to speed up Your Magento Site

● Many Features

● Complex Architecture

● Flexible Development

Performan

ce

© 2014 Netstarter

Page 3: How to speed up Your Magento Site

How to Speed up your Magento

Site

© 2014 Netstarter

Page 4: How to speed up Your Magento Site

Databas

e

© 2014 Netstarter

Page 5: How to speed up Your Magento Site

Case Study (3rd Party

Project)Product Listing Page Is REALLY Slow,

Client is Unhappy,

SEO issues

Default Magento Client’s Magento

System

response time

TTFB

(without FPC)

0.9 s 7 sec

© 2014 Netstarter

Page 6: How to speed up Your Magento Site

His Questions● Is it a problem of Magento ?

● 150,000 Products now, is it a problem ?

● Do we need additional CPU and RAM or

Bandwidth ?

● Any issue with the configuration ?

● Someone has Hacked our System ?

1

Query

© 2014 Netstarter

Page 7: How to speed up Your Magento Site

Data Types….

INT, TINYINT,VARCHAR etc….

INT column to store value from 1-10

VARCHAR to store Integers

What is the Rationale then ?

© 2014 Netstarter

Page 8: How to speed up Your Magento Site

Spaghetti Query

How can I do this with a single

query?It’s not always better,

Why?

• Difficult to do changes

• Cannot use Mysql cache

• Mysql poor performance with some

queries© 2014 Netstarter

Page 9: How to speed up Your Magento Site

Spaghetti Query (Contd.)• Hide dangerous issues - Better to Divide

and conquer

What is the Rationale then ?

© 2014 Netstarter

Page 10: How to speed up Your Magento Site

Use of IndexesUse Indexes with a plan, mistakes that we do..

● Define no indexes, or not enough indexes

● Defining too many indexes

● Running queries that no indexes can be used

○ SELECT * FROM table WHERE column LIKE

‘%test%’

What is the Rationale then ?

© 2014 Netstarter

Page 11: How to speed up Your Magento Site

Monitor Your Database

● Check the slow query log (in MySql)

● Use EXPLAIN in Mysql to Check the Query Execution

Path

● Rebuild Indexes : OPTIMIZE TABLE tbl_name

© 2014 Netstarter

Page 12: How to speed up Your Magento Site

Tools

● pt-index-usage

● pt-query-digest (Slow Query)

There are many other…..

© 2014 Netstarter

Page 13: How to speed up Your Magento Site

Achievement

• Listing page now loads within 1.5

seconds

• 85% Gain

© 2014 Netstarter

Page 14: How to speed up Your Magento Site

eCommerce Site

Performance• Site performance directly affects

conversion rate

• eCommerce sites has a lot of contents

and interactions

http://venturebeat.com/http://venturebeat.com/2013/03/26/speed-bump-load-times-at-top-2000-e-commerce-sites-down-22-in-one-year-infographic/http://www.yottaa.com/blog/bid/286821/eCommerce-and-Website-Performance-A-Look-Into-the-Industry

© 2014 Netstarter

Page 15: How to speed up Your Magento Site

Backend Caching ● Keeps prepared data

● Minimizes database queries (Reduce database

load)

What Default Magento Provides…

● Magento Cache

● Enterprise Edition comes with built in Full Page

Cache (FPC)

● Default caching engine is the SLOW File System

http://cdn.turnkeye.com/media/wysiwyg/services/performance/performance.png © 2014 Netstarter

Page 16: How to speed up Your Magento Site

Optimized Caching Alternative 01:

Memcached

http://memcached.org/

● Free & open source

● key-value based object caching

● Configured as 1st level fast cache for Magento

Limitations

● Doesn’t support tag based caching

● Database is used as the 2nd level cache

● No replication method implemented

© 2014 Netstarter

Page 17: How to speed up Your Magento Site

● Free & open source

● Magento officially recommend Redis

● For Enterprise 1.13.x and Community 1.8.x Redis is

built in.

Why it is so Good?

● Supports tag-based caching/cleanup

● Can work without DB (core_cache/core_cache_tag) tables

should stay empty

● Supports on-disk save and master/slave replication.

http://redis.io/images/redis-logo.svghttps://www.byte.nl/blog/wp-content/uploads/Redis-caching.jpg

Optimized Caching Alternative 02:

Redis

© 2014 Netstarter

Page 18: How to speed up Your Magento Site

Getting the Good of Both -

Netstarter Way● Cache and Full Page Cache - Redis

○ Supports Tag based caching

● User Session Storage - Memcached

○ Key/Value storage system fits sessions

○ Little bit faster than Redis

© 2014 Netstarter

Page 19: How to speed up Your Magento Site

Op-Code Caching

● Accelerates PHP execution

● No side effects other than extra memory usage

● Recommended for Production environment

Which Op-Code Cache?

● APC (Alternative PHP Cache)

● Xcache

● Zend OpCache Bundled with PHP 5.5.0 and later

© 2014 Netstarter

Page 20: How to speed up Your Magento Site

Content Delivery

Network (CDN) • A network of distributed servers deliver content

based on the geographic locations of the user

• Reduce the load on the main server

© 2014 Netstarter

Page 21: How to speed up Your Magento Site

General Tips

Further Quest for Performance● Proper Server settings

● Enable Magento Flat Catalog

● Varnish Cache - A Reputed Cache backend

● Host in the country where your customers are

● Minify and Merge Js and CSS

● Enable Gzip Compression in htaccess.

● Minimize redirects

● Have the site W3C compliant. Errors slow down the

browser

● Optimize images for web

● Use CSS Sprites

© 2014 Netstarter

Page 22: How to speed up Your Magento Site

Keep in Touch

● Check your page load with Magento

Profiler

● AOE Profiler will be a better option

● Use other web page optimization tools

● Use a server performance analyzer New

Relic

© 2014 Netstarter

Page 23: How to speed up Your Magento Site

Take Away

Design Develop Test

- for -

Performance

© 2014 Netstarter

Page 24: How to speed up Your Magento Site

Thank

You!

© 2014 Netstarter