SlideShare a Scribd company logo
Introduction
to Magento
Optimization
Because sometimes “Copy&Paste” isn’t enough
Fabio Daniele
@fabx2dan
@synesthesiait
Why are
we here?
This is a set of slides which will introduce you to the
magical, overflowed, strenuous world of Magento
optimization.
It won't be problem-centric, but a quick tour on the
whole ensemble of Mage's good practices to achieve
excellent performance and understand why this
platform has such a moody character.
Ok then:
what
makes it
so slow?
Magento, in fact, isn’t that slow.
The problem basically resides in its fragile
scalability, due to very low tolerance for bad code,
the EAV model which generates performance-killer
queries, an excessive dependence on media
resources and a dispersive class structure.
Ok then:
what
makes it
so slow?
Descending more into details, we can split the area
of operation into five sections:
➢ HTTP Transactions
➢ Database
➢ Media
➢ Source code
➢ Tweaking
Each one of them has its own peculiarity, with
specific "dos" and "don'ts". Let’s take a look.

Recommended for you

Oracle Service Bus & Coherence Caching Strategies
Oracle Service Bus & Coherence Caching StrategiesOracle Service Bus & Coherence Caching Strategies
Oracle Service Bus & Coherence Caching Strategies

This document describes how to use Oracle Service Bus and Oracle Coherence caching capabilities to improve performance of a slow web service. It shows how to create a sample web service that takes 9 seconds to respond using Java and deploy it to WebLogic Server. Then it imports the web service into an Oracle Service Bus project and enables caching for the business service. With caching enabled, subsequent requests return immediately from the cache instead of calling the backend web service. It also describes how to use an external Coherence server for out-of-process caching and monitoring the cache using the Coherence console.

cachingintegrationjvm
Search engine optimization (seo) from Endeca & ATG
Search engine optimization (seo) from Endeca & ATGSearch engine optimization (seo) from Endeca & ATG
Search engine optimization (seo) from Endeca & ATG

Search Engine optimization overview, techniques and features provided by Oracle products - Endeca search engine and ATG commerce platform.

endecaatgseo
Solving the C20K problem: Raising the bar in PHP Performance and Scalability
Solving the C20K problem: Raising the bar in PHP Performance and ScalabilitySolving the C20K problem: Raising the bar in PHP Performance and Scalability
Solving the C20K problem: Raising the bar in PHP Performance and Scalability

This document summarizes a presentation given by Luxi Chidambaran of Oracle on solving the C20K problem of scaling PHP applications. It discusses how the Oracle 11g Database Resident Connection Pool (DRCP) allows PHP applications to connect to the database in a way that supports tens of thousands of concurrent connections using minimal system resources. It provides an overview of DRCP and how the enhanced OCI8 PHP extension connects to leverage DRCP. Performance benchmarks are presented showing significant increases in throughput and reductions in memory usage compared to non-DRCP connections.

zendcon08zendcon08
HTTP
Transactions
The main responsible for client-server
communication, its performance greatly impacts the
user experience on the website.
The best optimization available can be made using a
caching system. There are different kind of them, the
choice will be influenced by the load of the website
and the scope of the cache. We will discuss this
further.
But to rely only on cache for optimization is a bad
mistake. Caching is useful to push optimization over
the boundaries only when there's no other option
left.
Database The major drawback of the EAV model it's the
extremely dispersive structure, which generates
queries with lots of JOINs.
Besides, the excessive amount of transparency of the
Model to the eyes of the developer, and its
counterintuitive nature, may lead to bad code
application, affecting performance while interacting
with the database.
Database Other than best practices, we can achieve major
advantages through replication since the structure
generated by the EAV suffers from really bad
concurrency illness.
Replication is most effective on tables with an high
access rate, typically the FLAT ones. This form of
optimization can be implemented manually or
through 3rd party services, like the ones offered by
AWS.
Media With the term media we are mainly referring to
images. Those are often managed by the customer
itself, leading to possible inefficiencies in size and
quality of the images.
Without the proper compression, a single image may
take up to 80% more bandwidth than an optimized
one! Even when Magento responds quickly, if the
browser needs to download lots of MBs of images the
user will still get a sensation of slowness.

Recommended for you

20jsp
20jsp20jsp
20jsp

This code is not thread-safe because the idNum field is being incremented without synchronization. If this JSP page was accessed concurrently by multiple requests, it could generate non-unique IDs by incrementing idNum multiple times between requests. To make it thread-safe, the idNum field would need to be declared as volatile or access to it would need to be synchronized.

ASP.NET 12 - State Management
ASP.NET 12 - State ManagementASP.NET 12 - State Management
ASP.NET 12 - State Management

This document provides an overview of state management in ASP.NET, including client-based state using view state, cookies, and query strings, as well as server-based state using application state, session state, and profile properties. It discusses when each state management technique is appropriate and how to implement them in ASP.NET applications.

aspnetteachingweb
Caching & Performance In Cold Fusion
Caching & Performance In Cold FusionCaching & Performance In Cold Fusion
Caching & Performance In Cold Fusion

This document provides tips for improving the performance of ColdFusion applications, including writing code in an object-oriented style, checking for errors first and planning fast exits, limiting nested loops, knowing which ColdFusion functions to avoid, testing execution speed, using stored procedures, caching pages, queries and ORM data, and flushing caches when needed. Additional resources are provided on optimizing ColdFusion applications and performance tuning servers.

Media There are services and plugins for dealing with the
optimization without having to check manually
every image uploaded to the platform.
The most famous are Kraken.io and Apptrian Image
Optimizer, which intercept the images being
requested, call a webservice for optimizing size (with
both lossy or lossless algorithms) and then return it,
properly cached.
Assets Just like the media, assets have great impact on the
loading time of the client. The best option here is to
relocate and minify the code.
To relocate all the js and css source in the same host
is useful for reducing network time over the
resolution of DNS and routing to the server, while the
minification reduces the size of the single files and
the number of requests needed to download them all.
One of the most used extension is Apptrian Minify
HTML CSS JS.
Source code The possibilities to extend Magento functionalities
are nearly limitless, but this flexibility costs much.
Given the chance to use Models for interacting with
database, it's essential to know exactly how code
operates, in order to prevent improper use of objects
and classes which may lead to overheads of JOINs or
unwanted big queries for just small chunks of
information.
Source code
Iteration $p = Mage::getModel('catalog/product')
->getCollection();
foreach ($p as $item) {
// Doin’ stuff...
}
This is a don’t, as Magento uses a lazy loading
approach while dealing with collections, thus loading
the entire PHP object at every cycle of the for. It is
utterly expensive.

Recommended for you

Jsp slides
Jsp slidesJsp slides
Jsp slides

Servers - Apache Tomcat Server Server-side scripts - Java Server Pages The document discusses request/response protocols for client-side scripts versus server-side scripts like Java Server Pages. It explains how a server can interact with multiple concurrent clients through multi-threaded responses. HTML meta-tags can control the request/response interaction, and the file extension (.html vs .jsp) affects how the page is processed.

Mashup
MashupMashup
Mashup

The document discusses various techniques for building mashups including AJAX. It defines mashups as lightweight web applications that combine content from existing sources via public APIs. It describes how AJAX uses XMLHttpRequest to asynchronously retrieve data from servers in the background without page refreshes. This improves responsiveness. JSON is also discussed as a data format used for mashups. Challenges with mashups include lack of APIs and difficulties accessing unstructured internal data.

mashup
Tuning Web Performance
Tuning Web PerformanceTuning Web Performance
Tuning Web Performance

This document discusses tuning web performance from a frontend perspective. It covers the impact of performance on user experience, development tools for optimization like Firebug and Chrome DevTools, and various techniques for website optimization including reducing requests, optimizing images, leveraging caching, minimizing JavaScript, and improving loading efficiency. The goal is to provide an overview of concepts and tools for optimizing frontend performance.

javascriptwebfrontend
Source code
Iteration $p = Mage::getModel('catalog/product')
->getCollection();
foreach ($p->getData() as $data) {
// Doin’ stuff
}
This is the proper way, because it loads only the
informations we really need.
Source code
Iteration $p = Mage::getModel('catalog/product')
->getCollection();
while ($item = $p->fetchItem()) {
// Doin’ stuff
}
This is totally analogue to the previous solution, with
just some saving in the amount of memory stored for
each item of the collection.
Source code
Iteration
Benchmark made on a Magento 1.9 installation
with official sample data (~580 products)
Vagrant - OS Ubuntu 14.04 - PHP 5.6.12 with APC - MySQL 5.6.24
Time Memory
wrong way ~ 0.0366 sec ~ 3.14 MB
getData() ~ 0.0052 sec ~ 1.16 MB
fetchItem() ~ 0.0211 sec ~ 0.30 MB
Source code
Scaling $p = Mage::getModel('catalog/product')
->getCollection();
foreach ($p as $item) {
$item->load($item->getId());
echo $item->getDescription();
}
This is a don’t, as at every cycle we are loading
the entire product object just for a single information.

Recommended for you

M Ramya
M RamyaM Ramya
M Ramya

This document provides a history of AJAX and an overview of how it works. It discusses how AJAX enables asynchronous data retrieval, allowing parts of web pages to update without reloading the entire page. It then provides examples of using the XMLHttpRequest object to make requests to a server and retrieve data to dynamically update a web page. The document also covers browser support for AJAX and examples of server-side scripts to handle AJAX requests.

mcaiiiyrseminar
Developing High Performance Web Apps
Developing High Performance Web AppsDeveloping High Performance Web Apps
Developing High Performance Web Apps

The document provides an overview of developing high performance web applications, focusing on optimizing front-end performance. It discusses why front-end performance matters, and provides best practices for optimizing page load time, developing responsive interfaces, and efficiently loading and executing JavaScript. The document also covers DOM scripting techniques, tools for profiling and analyzing performance, and how the performance monitoring service Gomez can be extended to better measure client-side metrics.

developercompuwaregomez
Endeca - Promoting Content & Configuration from Staging to Production
Endeca - Promoting Content & Configuration from Staging to ProductionEndeca - Promoting Content & Configuration from Staging to Production
Endeca - Promoting Content & Configuration from Staging to Production

This diagram / mind map was created using MindJet application and covers the steps/guidelines on exactly what it takes to promote the Content & Search configuration from Staging to Production environment.

commerceendecapipeline
Source code
Scaling
$p = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSelect(
array('description')
);
foreach ($p as $item) {
echo $item->getDescription();
}
Here we are correctly specifying which information
we are going to need later, lightening the execution of
the cycle.
Source code
Scaling
Benchmark made on a Magento 1.9 installation
with official sample data (~580 products)
Vagrant - OS Ubuntu 14.04 - PHP 5.6.12 with APC - MySQL 5.6.24
Time Memory
without attribute ~ 17.07 sec ~ 25.83 MB
with attribute ~ 0.0435 sec ~ 3.45 MB
Source code
Saving $p = Mage::getModel('catalog/product')
->load($id);
$p->setDescription('New Test')
->save();
Another don’t. This way of saving forces Magento to
store the entire object, not just the attribute we’ve
modified.
Source code
Saving $p = Mage::getModel('catalog/product')
->load($id);
$p->setDescription('New Test')
->getResource()
->saveAttribute($p, 'description');
Instead of storing the entire object, we specify exactly
the attribute to be saved, thus sparing us time and
memory.

Recommended for you

QSpiders - Installation and Brief Dose of Load Runner
QSpiders - Installation and Brief Dose of Load RunnerQSpiders - Installation and Brief Dose of Load Runner
QSpiders - Installation and Brief Dose of Load Runner

The document provides information on performance testing processes and tools. It outlines 8 key steps: 1) create scripts, 2) create test scenarios, 3) execute load testing, 4) analyze results, 5) test reporting, 6) performance tuning, 7) communication planning, and 8) troubleshooting. It also discusses tools like LoadRunner, Controller, and Analysis for executing and analyzing tests. The document emphasizes having a thorough test process and communication plan to ensure performance testing is done correctly.

qspiders
ASP.NET 02 - How ASP.NET Works
ASP.NET 02 - How ASP.NET WorksASP.NET 02 - How ASP.NET Works
ASP.NET 02 - How ASP.NET Works

ASP.NET uses an event-based programming model where event handlers are executed in response to events. Events can be page events, which always occur, or control events associated with specific controls. When a browser requests an ASP.NET page, the page class is dynamically compiled and executed on the server to produce the HTML and JavaScript sent to the browser.

webteachingaspnet
jsp tutorial
jsp tutorialjsp tutorial
jsp tutorial

This document provides an introduction and tutorial for JavaServer Pages (JSP) technology. It explains how to create simple JSP applications that handle HTML forms and pass data between the client and a JavaBeans component on the server. Examples are provided to demonstrate creating a basic "Hello World" application, handling form submission and passing user-entered data to a bean using JSP tags, and writing the corresponding JavaBeans component. The tutorial also explains how to install and run the example applications using Tomcat.

javajsptutorial
Source code
Saving
Benchmark made on a Magento 1.9 installation
with official sample data (~580 products)
Vagrant - OS Ubuntu 14.04 - PHP 5.6.12 with APC - MySQL 5.6.24
Time Memory
save() ~ 0.336 sec ~ 5.99 MB
saveAttribute() ~ 0.0432 sec ~ 2.47 MB
Source code
Reuse & Recycle
# Multiple static call
$nam = Mage::getModel('catalog/product' )->load($id)->getName();
$sku = Mage::getModel('catalog/product' )->load($id)->getSku();
$des = Mage::getModel('catalog/product' )->load($id)->getDescription ();
/******** VERSUS ********/
# Single static call
$p = Mage::getModel('catalog/product' )->load($id);
$nam = $p->getName();
$sku = $p->getSku();
$des = $p->getDescription ();
It may seems obvious, but attention to details is
needed when working with big amount of data.
Source code
Reuse & Recycle
Benchmark made on a Magento 1.9 installation
with official sample data (~580 products)
Vagrant - OS Ubuntu 14.04 - PHP 5.6.12 with APC - MySQL 5.6.24
Time Memory
multiple ~ 0.0823 sec ~ 2.54 MB
single ~ 0.0376 sec ~ 2.54 MB
Thinking of a store with about 10.000 products,
performance would be impacted greatly.
Source code
Native funcs
Benchmark made on a Magento 1.9 installation
with official sample data (~580 products)
Vagrant - OS Ubuntu 14.04 - PHP 5.6.12 with APC - MySQL 5.6.24
Time Memory
count() ~ 0.0363 sec ~ 3.14 MB
getSize() ~ 0.0019 sec ~ 0.0016 MB
Sometimes we found ourselves thinking that
native PHP functions should work better than the
ones offered by a framework. This is true in some
cases, but not with Magento. Here’s an example:
counting elements in a collection.

Recommended for you

2017 Baltimore Business Review
2017 Baltimore Business Review2017 Baltimore Business Review
2017 Baltimore Business Review

The document discusses the implications of overfishing in oceans and the Chesapeake Bay. It notes that overfishing is threatening marine life by taking fish out of bodies of water faster than populations can be replenished. This can disrupt food chains and ecosystems. In oceans, overfishing endangers species like sharks that regulate other marine populations. In the Chesapeake Bay, overfishing has reduced the oyster population to 0.3% of historic levels, worsening water quality since oysters filter contaminants. Overall, overfishing in oceans and the Bay poses serious threats to marine life, ecosystems, and ultimately humans who rely on healthy waterways.

Editing log
Editing logEditing log
Editing log

Shafia Begum and Mia worked on completing the sound for a film trailer over several sessions from March 16th to March 16th. They used GarageBand to add background music and sound effects. Mia recorded additional voiceover and they edited the narration to fit each scene. Their final session involved some additional editing touches and adding a "Double Take" sound effect to a shot at the end of the trailer. Through this process, they learned how to structure voiceovers and adjust audio levels to balance music and dialogue.

BiernbaumSummerSchoolL
BiernbaumSummerSchoolLBiernbaumSummerSchoolL
BiernbaumSummerSchoolL

This document discusses the history and research on summer school programs in the United States. It notes that summer school was originally used for recreation but began focusing on remediation in the 1950s. Research shows disadvantaged students experience greater learning loss over the summer. Recent increased emphasis on standardized testing and promotion standards has led more districts to use mandated summer school, but research on its effectiveness has been limited until a 2000 meta-analysis of 93 program evaluations.

Cache The temptation of using a cache system to speed up
our website is very strong, but we shall not fall for
the Dark Side.
Instead, caching is effective only after all the other
optimizations have been applied.
Moreover, regardless of the cache system that one
will choose for its website, it's very important to plan
accurately and think over the pros and the cons of
using the proper system, if you are going to need it at
all.
Cache
In Mage World, we can distinguish two major cache
family:
➢ Infrastructure, server-level
➢ Application, managed by Magento itself
Cache
Infrastructure
This type of cache uses services implemented
outside the basecode, typically reverse proxies,
which take place between the client and the
Magento application entry point.
It greatly reduces the response time, because when a
request hits the cache Magento hasn’t been
instanced yet and all the callback effort is handled
by the proxy service itself.
Besides, reducing the number of hit to Magento will
also reduce the amount of load on the server.
Cache
Infrastructure
The most famous reverse proxy is Varnish, widely
used for eCommerce sites with high traffic levels.
It also provides support for a specific hypertext
syntax called ESI: it’s used to specify, through proper
tags, which content of the page needs to be reloaded
every time, committing the job to Varnish.
When the proxy encounters an ESI tag, it will send a
request to the application to obtain the resource,
merge the result with the cached response and then
return it to the client.

Recommended for you

Mechanical Engineer-Mohammed Omer
Mechanical Engineer-Mohammed OmerMechanical Engineer-Mohammed Omer
Mechanical Engineer-Mohammed Omer

Mohammed Omer is a mechanical engineer seeking a position in HVAC projects and customer service. He has over 10 years of experience in HVAC design and project management. Some of the key projects he has worked on include a 500 million AED residential and commercial development with 11 towers, and a 1.6 billion AED expansion of Dubai International Airport. Currently he is working on infrastructure projects at Dubai International Airport. He holds a Bachelor's degree in Mechanical Engineering and is pursuing an MBA in Operations Management.

Kiara Bass_Writing Sample 2
Kiara Bass_Writing Sample 2Kiara Bass_Writing Sample 2
Kiara Bass_Writing Sample 2
Modelos de reglamento para centros de cómputos
Modelos de reglamento para centros de cómputosModelos de reglamento para centros de cómputos
Modelos de reglamento para centros de cómputos

Este documento presenta dos modelos de reglamento para centros de cómputo en una universidad. Define usuarios y encargados, e incluye normas sobre el uso de computadoras, redes e internet, así como sanciones. El Modelo 1 contiene 19 artículos sobre normas generales, uso de computadoras, red y sanciones. El Modelo 2 contiene 13 artículos sobre acceso, comportamiento y uso apropiado de equipos. Ambos modelos buscan regular el uso de los centros de cómputo con fines académicos y proteger los equipos.

una puno
Cache
Application
The second cache family has a more diversificated
situation. Many different extensions have been
implemented from time to time, all of which
different from the others by the way the cache is
implemented (before or after Mage instance) or the
the kind of storage being made (full, partial).
So, for the sake of orderliness, we will split up this
types in three:
❖ Full Page Cache
❖ Static Cache
❖ Hybrid Cache
Cache
Full Page Cache
Full Page Cache (FPC for friends) is intended for
caching the most out of a page, while reloading the
resource just for specific chunks of page that are
requested as fresh every time.
The advantage of this extension is that it kicks in
before all the Mage app object is instanced, thus
saving lots of resources.
The drawback, however, resides in the necessity to
parse the response, which can be enormous, and to
retrieve the dynamic content to replace in the
cached response for every request.
Cache
Static Cache
This kind of cache is the most effective, but its range
of use is very limited. Like FPC, it is placed before the
instance of Mage app and it caches all the content of
the request, regardless of the content.
The cons, here, are clear: it can't be used in any page
that provides dynamic objects, like a cart, or session-
related informations.
However it is very useful with static pages like 404
(which are very expensive in Magento!), external
widgets or other static contents (like a 'Contact us'
block).
Cache
Hybrid Cache
The Hybrid tries to take the pros of both types,
reducing the cons.
The content is returned through Static Cache, so it's
faster and the user will be served asap, while to the
response we will attach javascript algorithm to
create asynchronous calls towards the server and
retrieve the dynamic content after the page has been
loaded.
This approach will return only the information
needed, while the async calls may be cached again
as they are fully compatible with any other cache
system, both Application and Infrastructure.

Recommended for you

Survey monkey answers
Survey monkey answersSurvey monkey answers
Survey monkey answers

Media

Innovation: The Top Five Things Project Managers Need to Know
Innovation: The Top Five Things Project Managers Need to KnowInnovation: The Top Five Things Project Managers Need to Know
Innovation: The Top Five Things Project Managers Need to Know

In this highly informative session, Tony will leverage PMI research findings to explore the primary issues and opportunities in innovation project management. Innovation is a critical element in helping product-oriented companies achieve their market objectives and projects in these environments are development are complex, long, resource-intensive, and risky. Therefore, it is important to detect problems early to avoid waste of time and resources. Because that is often easier said than done, Tony will couple PMI’s research with observations from his company’s client interactions in the field to help session attendees fully comprehend each of the top five innovation project management issues. By the end of the presentation, participants will have a very clear understanding of the specific challenges that plague low-performing organizations and the best practice activities that characterize their high-performing counterparts. The costs and benefits of employing these best practices in organizations where they do not yet exist will also be provided, as will be lessons learned from performance improvement efforts in innovation environments. If you want to understand how to assist an organization with improving time-to-market success rates, increase the value of product development efforts, and maximize opportunity in the world of innovation, this session is for you.

projectprojectsinnovation
Пушкинское
ПушкинскоеПушкинское
Пушкинское
Tweaking Usually snobbed by developers for small or mid-
sized application, a proper LAMP/LNMP
configuration setup becomes mandatory working
with Magento.
In this presentation we will list only the most
important tweaks, but for a complete list I suggest to
follow this link.
Tweaking
Server
1. Turn on the Gzip compression: it reduces output
size, speeding up the download for clients.
2. Turn on the option "KeepAlives" of Apache: this
option enables the server to channel multiple
HTTP request through a single TCP connection,
improving response time. Be careful, though,
because setting a wrong time for this parameter
may lead to an excess of open TCP connections,
which will increase considerably the load on the
server.
Tweaking
Server
3. Use a RAM filesystem for storing files with an
high rate of I/O operation, usually var/cache and
var/session.
4. Reduce logging operation when not needed: it's
an I/O that may slow down HTTP requests;
alternatively, think of an async write or the use
of a memory based filesystem.
Tweaking
PHP
1. Use an accelerator like APC, Zend Opcache or
XCache.
2. Increase the memory_limit to at least 128M
3. Check the real amount of realpath cache used by
PHP and set the correct amount in the
realpath_cache_size option. You can verify it
using the realpath_cache_size() function.

Recommended for you

Création d'un sentiment de présence par la supervision à distance de stagiair...
Création d'un sentiment de présence par la supervision à distance de stagiair...Création d'un sentiment de présence par la supervision à distance de stagiair...
Création d'un sentiment de présence par la supervision à distance de stagiair...

...

enseignementdistancestage
Biography chinua achebe
Biography chinua achebeBiography chinua achebe
Biography chinua achebe

Chinua Achebe was a Nigerian novelist, poet, professor, and critic best known for his novel Things Fall Apart. He was born in 1930 in Ogidi, Nigeria and excelled at school, winning a scholarship to university. After graduating, he worked for Nigerian broadcasting and supported Biafran independence. Since 2009, he has been a professor at Brown University. Achebe was highly educated and published several influential works exploring Igbo culture and the collision with European values.

IGCSE Literature
IGCSE LiteratureIGCSE Literature
IGCSE Literature

Tubal brings Shylock news from Genoa. He has been unable to find Shylock's daughter. Shylock is distraught over the loss of precious jewels and money spent searching for his daughter. Tubal then shares more positive news - one of Antonio's ships has been wrecked. He further shares that Antonio's creditors say he will not be able to pay his debts. Shylock is pleased by this, saying he will plague and torture Antonio. However, he is upset again upon learning his daughter spent a large sum of money and traded one of his turquoise rings for a monkey.

Tweaking
PHP
4. Turn off open_basedir, as it prevents realpath
cache use.
5. Use an Autoloader, which will reduce I/O
operation while scavenging for classes during
Mage execution.
Another ally in the parse of the base code may
be the AOE_ClassPathCache extension, which
does not create an Autoload file but registers all
the filepaths for resolving classes requests into a
single file, thus saving time for scanning all the
dirs searching for the proper file.
Tweaking
Database
1. Disable log writing to database if not needed.
Magento does not offer this option by default, it
can be achieved through the use of an extension
called Yireo DisableLog.
2. Increase the query_cache_size amount, useful
when server comes with loads of RAM. MySQL
packages tend to be resource conservative by
default. It can be increased to 64MB if the server
has at least 1GB of RAM.
3. Increase the query_cache_limit, bringing it to at
least 2MB.
Tweaking
Database
4. MySQL uses a buffer to store information on data
and indexes, to speed up queries execution.
The buffer size can be monitored with the
innodb_buffer_pool_size option, which value
depends on the database server specs.
Database server RAM Size
Shared with HTTP server 6 GB 2/3 GB
Dedicated 6 GB 5 GB
Dedicated 12 GB 10 GB
Tweaking
Database
5. Increase the innodb_thread_concurrency
attribute, which defines the maximum number
of concurrency threads inside InnoDB. By
default this option is set to 0. It's useful for
websites with at least 60 active user at the same
time.
A good way to guess the correct amount of
concurrency threads is to apply this formula:
(2 * [n° of CPU])+ 2

Recommended for you

Item analysis for new format 2016
Item analysis for new format 2016Item analysis for new format 2016
Item analysis for new format 2016

This document contains 3 sections summarizing an English language assessment of students. Section 1 lists 20 multiple choice comprehension questions assessing various topics. Section 2 lists 5 short answer questions with subparts on comprehension. Section 3 contains analysis of students' writing scores, dividing the assessment into sections on format, content, and overall performance. The document aims to analyze student weaknesses by question topic for both reading and writing.

new format upsr 2016item analysissisc perlis
Question 2
Question 2Question 2
Question 2

This document summarizes the key linking features between the filmmaker's main ancillary tasks - a film magazine called The Reel, and a film poster and trailer called Double Take. The features discussed include using red text and fonts to link the pieces, representing the film's theme of love through affectionate imagery and symbols, maintaining continuity between costumes in the poster and trailer, and focusing on the female lead character in all pieces to make her relatable to the target female audience. The filmmaker plans to further explain these linking features in an upcoming presentation.

Magento performancenbs
Magento performancenbsMagento performancenbs
Magento performancenbs

Magento sites need optimization to load fast and provide a good user experience. Speeding up a site increases sales and improves SEO. Factors that impact load time include network transfers and the resource-intensive nature of Magento. Benchmarking tools like APDEX, Funkload, Yslow and Pagespeed help measure performance and set goals, such as loading the homepage in under 1.5 seconds. Architectures must be sized properly and include techniques like splitting front and back ends, enabling caching, and using a CDN. The Nitrogento extension automates optimizations like blocking caching, sprite generation, and asset minification to significantly improve performance.

Platform This is not proper optimization, but it’s a good point
to consider when talking about performance.
The platform over which Magento runs can greatly
improve speed, stability and scalability.
One of the best booster for a Magento 1.9 installation
would be a setup composed by PHP 7 FPM and
MySQL Percona 5.6. Advantages are tremendous, and
will be shown in comparison with past benchmarks.
Platform Let’s take the code of page #16, which is the heaviest
of all in this presentation.
Time Memory
PHP 5.6* ~ 17.07 sec ~ 25.83 MB
PHP 7** ~ 6.28 sec ~ 13.12 MB
Benchmark made on a Magento 1.9 installation
with official sample data (~580 products)
*Vagrant - OS Ubuntu 14.04 - PHP 5.6.12 with APC - MySQL 5.6.24
vs.
**Vagrant - OS Ubuntu 14.04 - PHP 7.0.0 FPM - MySQL Percona 5.6.27
Platform We can achieve interesting results also with code
from #19, during the save operation of a product. In
this case, Mage cache was not taken in account.
Time Memory
PHP 5.6* ~ 0.643 sec ~ 7.576 MB
PHP 7** ~ 0.310 sec ~ 3.465 MB
Benchmark made on a Magento 1.9 installation
with official sample data (~580 products)
*Vagrant - OS Ubuntu 14.04 - PHP 5.6.12 with APC - MySQL 5.6.24
vs.
**Vagrant - OS Ubuntu 14.04 - PHP 7.0.0 FPM - MySQL Percona 5.6.27
Platform While officially Magento 1.9 does not support PHP 7,
there are simple fixes that needs to be made in the
Core in order to get it up and running.
The real problem is, no one can assure backward
compatibility for Magento 1.x modules, thus
potentially transforming a simple platform migration
into your worst nightmare.
This kind of change should not be done on running
and stable projects, but it’s a really good (and brave)
start for new ones. Even starting from fresh, though,
we need to be careful about code written for PHP 5 in
3rd party extensions.

Recommended for you

How to Improve Magento Performance | Tips to Speed up Magento eCommerce Site/...
How to Improve Magento Performance | Tips to Speed up Magento eCommerce Site/...How to Improve Magento Performance | Tips to Speed up Magento eCommerce Site/...
How to Improve Magento Performance | Tips to Speed up Magento eCommerce Site/...

Do you want to improve Magento performance Follow these effective ways to optimize Magento performance and it will help you speed up Magento eCommerce site and improve pageload time This Magento optimization guide is extremely helpful for owners and developers alike

magento speed otimization htaccessmagento speed optimization extensionmagento performance optimization tips
Magento for-performance- v01
Magento for-performance- v01Magento for-performance- v01
Magento for-performance- v01

Magento, a ready to fly ecommerce plateform, for those who really wanted to crack and enter the ecommerce market. Most of the time we found that Magento is good to start with but as business grows, it seems like Magento become a bottleneck itself in terms of performance, stability and then there is a big time question how to scale it up... here is a solution to start thinking...

ecommerceperformancescalability
Optimizing CakePHP 2.x Apps
Optimizing CakePHP 2.x AppsOptimizing CakePHP 2.x Apps
Optimizing CakePHP 2.x Apps

The document discusses various techniques for optimizing CakePHP 2.x applications. It covers optimizations that can be made at the browser level, environment level, and application level. Specific optimizations discussed include improving caching strategies, lazy loading elements, reducing bootstrapping overhead, optimizing routing and URL generation, and using containable instead of recursive model associations. Testing optimizations with tools like siege and ab is also recommended.

cakefestcakephpoptimization
At last...
Released under Creative Commons by-nc-nd
...thanks
for watching!
Synesthesia srl
HQ: Via Amedeo Peyron 29, 10143 Torino
Tel: +39 011 0437401 - info@synesthesia.it - www.synesthesia.it - www.droidcon.it
Reg. Office: C.so Galileo Ferraris 110, 10129 Torino - VAT N° IT10502360018
Mobile Apps // Web Development // Ecommerce & Magento // UX&UI Design

More Related Content

What's hot

Jsp Slides
Jsp SlidesJsp Slides
Jsp Slides
DSKUMAR G
 
Ror caching
Ror cachingRor caching
Ror caching
Kashyap Parmar
 
Csajsp Chapter15
Csajsp Chapter15Csajsp Chapter15
Csajsp Chapter15
Adil Jafri
 
Oracle Service Bus & Coherence Caching Strategies
Oracle Service Bus & Coherence Caching StrategiesOracle Service Bus & Coherence Caching Strategies
Oracle Service Bus & Coherence Caching Strategies
William Markito Oliveira
 
Search engine optimization (seo) from Endeca & ATG
Search engine optimization (seo) from Endeca & ATGSearch engine optimization (seo) from Endeca & ATG
Search engine optimization (seo) from Endeca & ATG
Vignesh sitaraman
 
Solving the C20K problem: Raising the bar in PHP Performance and Scalability
Solving the C20K problem: Raising the bar in PHP Performance and ScalabilitySolving the C20K problem: Raising the bar in PHP Performance and Scalability
Solving the C20K problem: Raising the bar in PHP Performance and Scalability
ZendCon
 
20jsp
20jsp20jsp
20jsp
Adil Jafri
 
ASP.NET 12 - State Management
ASP.NET 12 - State ManagementASP.NET 12 - State Management
ASP.NET 12 - State Management
Randy Connolly
 
Caching & Performance In Cold Fusion
Caching & Performance In Cold FusionCaching & Performance In Cold Fusion
Caching & Performance In Cold Fusion
Denard Springle IV
 
Jsp slides
Jsp slidesJsp slides
Jsp slides
Kumaran K
 
Mashup
MashupMashup
Mashup
Naveen P.N
 
Tuning Web Performance
Tuning Web PerformanceTuning Web Performance
Tuning Web Performance
Eric ShangKuan
 
M Ramya
M RamyaM Ramya
Developing High Performance Web Apps
Developing High Performance Web AppsDeveloping High Performance Web Apps
Developing High Performance Web Apps
Timothy Fisher
 
Endeca - Promoting Content & Configuration from Staging to Production
Endeca - Promoting Content & Configuration from Staging to ProductionEndeca - Promoting Content & Configuration from Staging to Production
Endeca - Promoting Content & Configuration from Staging to Production
Keyur Shah
 
QSpiders - Installation and Brief Dose of Load Runner
QSpiders - Installation and Brief Dose of Load RunnerQSpiders - Installation and Brief Dose of Load Runner
QSpiders - Installation and Brief Dose of Load Runner
Qspiders - Software Testing Training Institute
 
ASP.NET 02 - How ASP.NET Works
ASP.NET 02 - How ASP.NET WorksASP.NET 02 - How ASP.NET Works
ASP.NET 02 - How ASP.NET Works
Randy Connolly
 
jsp tutorial
jsp tutorialjsp tutorial
jsp tutorial
Janwen Lou
 

What's hot (18)

Jsp Slides
Jsp SlidesJsp Slides
Jsp Slides
 
Ror caching
Ror cachingRor caching
Ror caching
 
Csajsp Chapter15
Csajsp Chapter15Csajsp Chapter15
Csajsp Chapter15
 
Oracle Service Bus & Coherence Caching Strategies
Oracle Service Bus & Coherence Caching StrategiesOracle Service Bus & Coherence Caching Strategies
Oracle Service Bus & Coherence Caching Strategies
 
Search engine optimization (seo) from Endeca & ATG
Search engine optimization (seo) from Endeca & ATGSearch engine optimization (seo) from Endeca & ATG
Search engine optimization (seo) from Endeca & ATG
 
Solving the C20K problem: Raising the bar in PHP Performance and Scalability
Solving the C20K problem: Raising the bar in PHP Performance and ScalabilitySolving the C20K problem: Raising the bar in PHP Performance and Scalability
Solving the C20K problem: Raising the bar in PHP Performance and Scalability
 
20jsp
20jsp20jsp
20jsp
 
ASP.NET 12 - State Management
ASP.NET 12 - State ManagementASP.NET 12 - State Management
ASP.NET 12 - State Management
 
Caching & Performance In Cold Fusion
Caching & Performance In Cold FusionCaching & Performance In Cold Fusion
Caching & Performance In Cold Fusion
 
Jsp slides
Jsp slidesJsp slides
Jsp slides
 
Mashup
MashupMashup
Mashup
 
Tuning Web Performance
Tuning Web PerformanceTuning Web Performance
Tuning Web Performance
 
M Ramya
M RamyaM Ramya
M Ramya
 
Developing High Performance Web Apps
Developing High Performance Web AppsDeveloping High Performance Web Apps
Developing High Performance Web Apps
 
Endeca - Promoting Content & Configuration from Staging to Production
Endeca - Promoting Content & Configuration from Staging to ProductionEndeca - Promoting Content & Configuration from Staging to Production
Endeca - Promoting Content & Configuration from Staging to Production
 
QSpiders - Installation and Brief Dose of Load Runner
QSpiders - Installation and Brief Dose of Load RunnerQSpiders - Installation and Brief Dose of Load Runner
QSpiders - Installation and Brief Dose of Load Runner
 
ASP.NET 02 - How ASP.NET Works
ASP.NET 02 - How ASP.NET WorksASP.NET 02 - How ASP.NET Works
ASP.NET 02 - How ASP.NET Works
 
jsp tutorial
jsp tutorialjsp tutorial
jsp tutorial
 

Viewers also liked

2017 Baltimore Business Review
2017 Baltimore Business Review2017 Baltimore Business Review
2017 Baltimore Business Review
Niall H. O'Malley
 
Editing log
Editing logEditing log
Editing log
sbegum8321
 
BiernbaumSummerSchoolL
BiernbaumSummerSchoolLBiernbaumSummerSchoolL
BiernbaumSummerSchoolL
Mark Nevelson Khan PhD
 
Mechanical Engineer-Mohammed Omer
Mechanical Engineer-Mohammed OmerMechanical Engineer-Mohammed Omer
Mechanical Engineer-Mohammed Omer
Omer Mohammed
 
Kiara Bass_Writing Sample 2
Kiara Bass_Writing Sample 2Kiara Bass_Writing Sample 2
Kiara Bass_Writing Sample 2
Kiara Y. Bass
 
Modelos de reglamento para centros de cómputos
Modelos de reglamento para centros de cómputosModelos de reglamento para centros de cómputos
Modelos de reglamento para centros de cómputos
Aldo Hernán Zanabria Gálvez
 
Survey monkey answers
Survey monkey answersSurvey monkey answers
Survey monkey answers
googlefff
 
Innovation: The Top Five Things Project Managers Need to Know
Innovation: The Top Five Things Project Managers Need to KnowInnovation: The Top Five Things Project Managers Need to Know
Innovation: The Top Five Things Project Managers Need to Know
The Project Strategy Consulting Group
 
Пушкинское
ПушкинскоеПушкинское
Пушкинское
senyadevochka
 
Création d'un sentiment de présence par la supervision à distance de stagiair...
Création d'un sentiment de présence par la supervision à distance de stagiair...Création d'un sentiment de présence par la supervision à distance de stagiair...
Création d'un sentiment de présence par la supervision à distance de stagiair...
Matthieu Petit
 
Biography chinua achebe
Biography chinua achebeBiography chinua achebe
Biography chinua achebe
Triana Dewi
 
IGCSE Literature
IGCSE LiteratureIGCSE Literature
IGCSE Literature
Pato_Ch
 
Item analysis for new format 2016
Item analysis for new format 2016Item analysis for new format 2016
Item analysis for new format 2016
Asniem CA
 
Question 2
Question 2Question 2
Question 2
miajones98
 

Viewers also liked (14)

2017 Baltimore Business Review
2017 Baltimore Business Review2017 Baltimore Business Review
2017 Baltimore Business Review
 
Editing log
Editing logEditing log
Editing log
 
BiernbaumSummerSchoolL
BiernbaumSummerSchoolLBiernbaumSummerSchoolL
BiernbaumSummerSchoolL
 
Mechanical Engineer-Mohammed Omer
Mechanical Engineer-Mohammed OmerMechanical Engineer-Mohammed Omer
Mechanical Engineer-Mohammed Omer
 
Kiara Bass_Writing Sample 2
Kiara Bass_Writing Sample 2Kiara Bass_Writing Sample 2
Kiara Bass_Writing Sample 2
 
Modelos de reglamento para centros de cómputos
Modelos de reglamento para centros de cómputosModelos de reglamento para centros de cómputos
Modelos de reglamento para centros de cómputos
 
Survey monkey answers
Survey monkey answersSurvey monkey answers
Survey monkey answers
 
Innovation: The Top Five Things Project Managers Need to Know
Innovation: The Top Five Things Project Managers Need to KnowInnovation: The Top Five Things Project Managers Need to Know
Innovation: The Top Five Things Project Managers Need to Know
 
Пушкинское
ПушкинскоеПушкинское
Пушкинское
 
Création d'un sentiment de présence par la supervision à distance de stagiair...
Création d'un sentiment de présence par la supervision à distance de stagiair...Création d'un sentiment de présence par la supervision à distance de stagiair...
Création d'un sentiment de présence par la supervision à distance de stagiair...
 
Biography chinua achebe
Biography chinua achebeBiography chinua achebe
Biography chinua achebe
 
IGCSE Literature
IGCSE LiteratureIGCSE Literature
IGCSE Literature
 
Item analysis for new format 2016
Item analysis for new format 2016Item analysis for new format 2016
Item analysis for new format 2016
 
Question 2
Question 2Question 2
Question 2
 

Similar to Introduction to Magento Optimization

Magento performancenbs
Magento performancenbsMagento performancenbs
Magento performancenbs
varien
 
How to Improve Magento Performance | Tips to Speed up Magento eCommerce Site/...
How to Improve Magento Performance | Tips to Speed up Magento eCommerce Site/...How to Improve Magento Performance | Tips to Speed up Magento eCommerce Site/...
How to Improve Magento Performance | Tips to Speed up Magento eCommerce Site/...
I-Verve Inc
 
Magento for-performance- v01
Magento for-performance- v01Magento for-performance- v01
Magento for-performance- v01
Rajneesh Maurya
 
Optimizing CakePHP 2.x Apps
Optimizing CakePHP 2.x AppsOptimizing CakePHP 2.x Apps
Optimizing CakePHP 2.x Apps
Juan Basso
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / WebgrindProfiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / Webgrind
Sam Keen
 
Web Speed And Scalability
Web Speed And ScalabilityWeb Speed And Scalability
Web Speed And Scalability
Jason Ragsdale
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for Java
Lars Vogel
 
How to optimize your Magento store
How to optimize your Magento store How to optimize your Magento store
How to optimize your Magento store
Rasbor.com
 
Presemtation Tier Optimizations
Presemtation Tier OptimizationsPresemtation Tier Optimizations
Presemtation Tier Optimizations
Anup Hariharan Nair
 
Server side programming bt0083
Server side programming bt0083Server side programming bt0083
Server side programming bt0083
Divyam Pateriya
 
Magento e commerce performance optimization
Magento e commerce performance optimizationMagento e commerce performance optimization
Magento e commerce performance optimization
Ranosys Technologies Pte Ltd
 
Why use .net by naveen kumar veligeti
Why use .net by naveen kumar veligetiWhy use .net by naveen kumar veligeti
Why use .net by naveen kumar veligeti
Naveen Kumar Veligeti
 
Joomla! Performance on Steroids
Joomla! Performance on SteroidsJoomla! Performance on Steroids
Joomla! Performance on Steroids
SiteGround.com
 
Real-World Pulsar Architectural Patterns
Real-World Pulsar Architectural PatternsReal-World Pulsar Architectural Patterns
Real-World Pulsar Architectural Patterns
Devin Bost
 
Crunch Your Data in the Cloud with Elastic Map Reduce - Amazon EMR Hadoop
Crunch Your Data in the Cloud with Elastic Map Reduce - Amazon EMR HadoopCrunch Your Data in the Cloud with Elastic Map Reduce - Amazon EMR Hadoop
Crunch Your Data in the Cloud with Elastic Map Reduce - Amazon EMR Hadoop
Adrian Cockcroft
 
Sherlock Homepage - A detective story about running large web services - WebN...
Sherlock Homepage - A detective story about running large web services - WebN...Sherlock Homepage - A detective story about running large web services - WebN...
Sherlock Homepage - A detective story about running large web services - WebN...
Maarten Balliauw
 
Drupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp NorthDrupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp North
Philip Norton
 
Unit 1st and 3rd notes of java
Unit 1st and 3rd notes of javaUnit 1st and 3rd notes of java
Unit 1st and 3rd notes of java
Niraj Bharambe
 
The 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaThe 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for Java
David Chandler
 
Porting Rails Apps to High Availability Systems
Porting Rails Apps to High Availability SystemsPorting Rails Apps to High Availability Systems
Porting Rails Apps to High Availability Systems
Marcelo Pinheiro
 

Similar to Introduction to Magento Optimization (20)

Magento performancenbs
Magento performancenbsMagento performancenbs
Magento performancenbs
 
How to Improve Magento Performance | Tips to Speed up Magento eCommerce Site/...
How to Improve Magento Performance | Tips to Speed up Magento eCommerce Site/...How to Improve Magento Performance | Tips to Speed up Magento eCommerce Site/...
How to Improve Magento Performance | Tips to Speed up Magento eCommerce Site/...
 
Magento for-performance- v01
Magento for-performance- v01Magento for-performance- v01
Magento for-performance- v01
 
Optimizing CakePHP 2.x Apps
Optimizing CakePHP 2.x AppsOptimizing CakePHP 2.x Apps
Optimizing CakePHP 2.x Apps
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / WebgrindProfiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / Webgrind
 
Web Speed And Scalability
Web Speed And ScalabilityWeb Speed And Scalability
Web Speed And Scalability
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for Java
 
How to optimize your Magento store
How to optimize your Magento store How to optimize your Magento store
How to optimize your Magento store
 
Presemtation Tier Optimizations
Presemtation Tier OptimizationsPresemtation Tier Optimizations
Presemtation Tier Optimizations
 
Server side programming bt0083
Server side programming bt0083Server side programming bt0083
Server side programming bt0083
 
Magento e commerce performance optimization
Magento e commerce performance optimizationMagento e commerce performance optimization
Magento e commerce performance optimization
 
Why use .net by naveen kumar veligeti
Why use .net by naveen kumar veligetiWhy use .net by naveen kumar veligeti
Why use .net by naveen kumar veligeti
 
Joomla! Performance on Steroids
Joomla! Performance on SteroidsJoomla! Performance on Steroids
Joomla! Performance on Steroids
 
Real-World Pulsar Architectural Patterns
Real-World Pulsar Architectural PatternsReal-World Pulsar Architectural Patterns
Real-World Pulsar Architectural Patterns
 
Crunch Your Data in the Cloud with Elastic Map Reduce - Amazon EMR Hadoop
Crunch Your Data in the Cloud with Elastic Map Reduce - Amazon EMR HadoopCrunch Your Data in the Cloud with Elastic Map Reduce - Amazon EMR Hadoop
Crunch Your Data in the Cloud with Elastic Map Reduce - Amazon EMR Hadoop
 
Sherlock Homepage - A detective story about running large web services - WebN...
Sherlock Homepage - A detective story about running large web services - WebN...Sherlock Homepage - A detective story about running large web services - WebN...
Sherlock Homepage - A detective story about running large web services - WebN...
 
Drupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp NorthDrupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp North
 
Unit 1st and 3rd notes of java
Unit 1st and 3rd notes of javaUnit 1st and 3rd notes of java
Unit 1st and 3rd notes of java
 
The 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaThe 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for Java
 
Porting Rails Apps to High Availability Systems
Porting Rails Apps to High Availability SystemsPorting Rails Apps to High Availability Systems
Porting Rails Apps to High Availability Systems
 

Recently uploaded

How we built TryBoxLang in under 48 hours
How we built TryBoxLang in under 48 hoursHow we built TryBoxLang in under 48 hours
How we built TryBoxLang in under 48 hours
Ortus Solutions, Corp
 
Cultural Shifts: Embracing DevOps for Organizational Transformation
Cultural Shifts: Embracing DevOps for Organizational TransformationCultural Shifts: Embracing DevOps for Organizational Transformation
Cultural Shifts: Embracing DevOps for Organizational Transformation
Mindfire Solution
 
Google ML-Kit - Understanding on-device machine learning
Google ML-Kit - Understanding on-device machine learningGoogle ML-Kit - Understanding on-device machine learning
Google ML-Kit - Understanding on-device machine learning
VishrutGoyani1
 
Software development... for all? (keynote at ICSOFT'2024)
Software development... for all? (keynote at ICSOFT'2024)Software development... for all? (keynote at ICSOFT'2024)
Software development... for all? (keynote at ICSOFT'2024)
miso_uam
 
ANSYS Mechanical APDL Introductory Tutorials.pdf
ANSYS Mechanical APDL Introductory Tutorials.pdfANSYS Mechanical APDL Introductory Tutorials.pdf
ANSYS Mechanical APDL Introductory Tutorials.pdf
sachin chaurasia
 
A Comparative Analysis of Functional and Non-Functional Testing.pdf
A Comparative Analysis of Functional and Non-Functional Testing.pdfA Comparative Analysis of Functional and Non-Functional Testing.pdf
A Comparative Analysis of Functional and Non-Functional Testing.pdf
kalichargn70th171
 
Overview of ERP - Mechlin Technologies.pptx
Overview of ERP - Mechlin Technologies.pptxOverview of ERP - Mechlin Technologies.pptx
Overview of ERP - Mechlin Technologies.pptx
Mitchell Marsh
 
Intro to Amazon Web Services (AWS) and Gen AI
Intro to Amazon Web Services (AWS) and Gen AIIntro to Amazon Web Services (AWS) and Gen AI
Intro to Amazon Web Services (AWS) and Gen AI
Ortus Solutions, Corp
 
一比一原版英国牛津大学毕业证(oxon毕业证书)如何办理
一比一原版英国牛津大学毕业证(oxon毕业证书)如何办理一比一原版英国牛津大学毕业证(oxon毕业证书)如何办理
一比一原版英国牛津大学毕业证(oxon毕业证书)如何办理
avufu
 
Migrate your Infrastructure to the AWS Cloud
Migrate your Infrastructure to the AWS CloudMigrate your Infrastructure to the AWS Cloud
Migrate your Infrastructure to the AWS Cloud
Ortus Solutions, Corp
 
Shivam Pandit working on Php Web Developer.
Shivam Pandit working on Php Web Developer.Shivam Pandit working on Php Web Developer.
Shivam Pandit working on Php Web Developer.
shivamt017
 
Seamless PostgreSQL to Snowflake Data Transfer in 8 Simple Steps
Seamless PostgreSQL to Snowflake Data Transfer in 8 Simple StepsSeamless PostgreSQL to Snowflake Data Transfer in 8 Simple Steps
Seamless PostgreSQL to Snowflake Data Transfer in 8 Simple Steps
Estuary Flow
 
ENISA Threat Landscape 2023 documentation
ENISA Threat Landscape 2023 documentationENISA Threat Landscape 2023 documentation
ENISA Threat Landscape 2023 documentation
sofiafernandezon
 
FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)
FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)
FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)
Roshan Dwivedi
 
NYC 26-Jun-2024 Combined Presentations.pdf
NYC 26-Jun-2024 Combined Presentations.pdfNYC 26-Jun-2024 Combined Presentations.pdf
NYC 26-Jun-2024 Combined Presentations.pdf
AUGNYC
 
MVP Mobile Application - Codearrest.pptx
MVP Mobile Application - Codearrest.pptxMVP Mobile Application - Codearrest.pptx
MVP Mobile Application - Codearrest.pptx
Mitchell Marsh
 
Safe Work Permit Management Software for Hot Work Permits
Safe Work Permit Management Software for Hot Work PermitsSafe Work Permit Management Software for Hot Work Permits
Safe Work Permit Management Software for Hot Work Permits
sheqnetworkmarketing
 
Addressing the Top 9 User Pain Points with Visual Design Elements.pptx
Addressing the Top 9 User Pain Points with Visual Design Elements.pptxAddressing the Top 9 User Pain Points with Visual Design Elements.pptx
Addressing the Top 9 User Pain Points with Visual Design Elements.pptx
Sparity1
 
React vs Next js: Which is Better for Web Development? - Semiosis Software Pr...
React vs Next js: Which is Better for Web Development? - Semiosis Software Pr...React vs Next js: Which is Better for Web Development? - Semiosis Software Pr...
React vs Next js: Which is Better for Web Development? - Semiosis Software Pr...
Semiosis Software Private Limited
 
React Native vs Flutter - SSTech System
React Native vs Flutter  - SSTech SystemReact Native vs Flutter  - SSTech System
React Native vs Flutter - SSTech System
SSTech System
 

Recently uploaded (20)

How we built TryBoxLang in under 48 hours
How we built TryBoxLang in under 48 hoursHow we built TryBoxLang in under 48 hours
How we built TryBoxLang in under 48 hours
 
Cultural Shifts: Embracing DevOps for Organizational Transformation
Cultural Shifts: Embracing DevOps for Organizational TransformationCultural Shifts: Embracing DevOps for Organizational Transformation
Cultural Shifts: Embracing DevOps for Organizational Transformation
 
Google ML-Kit - Understanding on-device machine learning
Google ML-Kit - Understanding on-device machine learningGoogle ML-Kit - Understanding on-device machine learning
Google ML-Kit - Understanding on-device machine learning
 
Software development... for all? (keynote at ICSOFT'2024)
Software development... for all? (keynote at ICSOFT'2024)Software development... for all? (keynote at ICSOFT'2024)
Software development... for all? (keynote at ICSOFT'2024)
 
ANSYS Mechanical APDL Introductory Tutorials.pdf
ANSYS Mechanical APDL Introductory Tutorials.pdfANSYS Mechanical APDL Introductory Tutorials.pdf
ANSYS Mechanical APDL Introductory Tutorials.pdf
 
A Comparative Analysis of Functional and Non-Functional Testing.pdf
A Comparative Analysis of Functional and Non-Functional Testing.pdfA Comparative Analysis of Functional and Non-Functional Testing.pdf
A Comparative Analysis of Functional and Non-Functional Testing.pdf
 
Overview of ERP - Mechlin Technologies.pptx
Overview of ERP - Mechlin Technologies.pptxOverview of ERP - Mechlin Technologies.pptx
Overview of ERP - Mechlin Technologies.pptx
 
Intro to Amazon Web Services (AWS) and Gen AI
Intro to Amazon Web Services (AWS) and Gen AIIntro to Amazon Web Services (AWS) and Gen AI
Intro to Amazon Web Services (AWS) and Gen AI
 
一比一原版英国牛津大学毕业证(oxon毕业证书)如何办理
一比一原版英国牛津大学毕业证(oxon毕业证书)如何办理一比一原版英国牛津大学毕业证(oxon毕业证书)如何办理
一比一原版英国牛津大学毕业证(oxon毕业证书)如何办理
 
Migrate your Infrastructure to the AWS Cloud
Migrate your Infrastructure to the AWS CloudMigrate your Infrastructure to the AWS Cloud
Migrate your Infrastructure to the AWS Cloud
 
Shivam Pandit working on Php Web Developer.
Shivam Pandit working on Php Web Developer.Shivam Pandit working on Php Web Developer.
Shivam Pandit working on Php Web Developer.
 
Seamless PostgreSQL to Snowflake Data Transfer in 8 Simple Steps
Seamless PostgreSQL to Snowflake Data Transfer in 8 Simple StepsSeamless PostgreSQL to Snowflake Data Transfer in 8 Simple Steps
Seamless PostgreSQL to Snowflake Data Transfer in 8 Simple Steps
 
ENISA Threat Landscape 2023 documentation
ENISA Threat Landscape 2023 documentationENISA Threat Landscape 2023 documentation
ENISA Threat Landscape 2023 documentation
 
FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)
FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)
FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)
 
NYC 26-Jun-2024 Combined Presentations.pdf
NYC 26-Jun-2024 Combined Presentations.pdfNYC 26-Jun-2024 Combined Presentations.pdf
NYC 26-Jun-2024 Combined Presentations.pdf
 
MVP Mobile Application - Codearrest.pptx
MVP Mobile Application - Codearrest.pptxMVP Mobile Application - Codearrest.pptx
MVP Mobile Application - Codearrest.pptx
 
Safe Work Permit Management Software for Hot Work Permits
Safe Work Permit Management Software for Hot Work PermitsSafe Work Permit Management Software for Hot Work Permits
Safe Work Permit Management Software for Hot Work Permits
 
Addressing the Top 9 User Pain Points with Visual Design Elements.pptx
Addressing the Top 9 User Pain Points with Visual Design Elements.pptxAddressing the Top 9 User Pain Points with Visual Design Elements.pptx
Addressing the Top 9 User Pain Points with Visual Design Elements.pptx
 
React vs Next js: Which is Better for Web Development? - Semiosis Software Pr...
React vs Next js: Which is Better for Web Development? - Semiosis Software Pr...React vs Next js: Which is Better for Web Development? - Semiosis Software Pr...
React vs Next js: Which is Better for Web Development? - Semiosis Software Pr...
 
React Native vs Flutter - SSTech System
React Native vs Flutter  - SSTech SystemReact Native vs Flutter  - SSTech System
React Native vs Flutter - SSTech System
 

Introduction to Magento Optimization

  • 1. Introduction to Magento Optimization Because sometimes “Copy&Paste” isn’t enough Fabio Daniele @fabx2dan @synesthesiait
  • 2. Why are we here? This is a set of slides which will introduce you to the magical, overflowed, strenuous world of Magento optimization. It won't be problem-centric, but a quick tour on the whole ensemble of Mage's good practices to achieve excellent performance and understand why this platform has such a moody character.
  • 3. Ok then: what makes it so slow? Magento, in fact, isn’t that slow. The problem basically resides in its fragile scalability, due to very low tolerance for bad code, the EAV model which generates performance-killer queries, an excessive dependence on media resources and a dispersive class structure.
  • 4. Ok then: what makes it so slow? Descending more into details, we can split the area of operation into five sections: ➢ HTTP Transactions ➢ Database ➢ Media ➢ Source code ➢ Tweaking Each one of them has its own peculiarity, with specific "dos" and "don'ts". Let’s take a look.
  • 5. HTTP Transactions The main responsible for client-server communication, its performance greatly impacts the user experience on the website. The best optimization available can be made using a caching system. There are different kind of them, the choice will be influenced by the load of the website and the scope of the cache. We will discuss this further. But to rely only on cache for optimization is a bad mistake. Caching is useful to push optimization over the boundaries only when there's no other option left.
  • 6. Database The major drawback of the EAV model it's the extremely dispersive structure, which generates queries with lots of JOINs. Besides, the excessive amount of transparency of the Model to the eyes of the developer, and its counterintuitive nature, may lead to bad code application, affecting performance while interacting with the database.
  • 7. Database Other than best practices, we can achieve major advantages through replication since the structure generated by the EAV suffers from really bad concurrency illness. Replication is most effective on tables with an high access rate, typically the FLAT ones. This form of optimization can be implemented manually or through 3rd party services, like the ones offered by AWS.
  • 8. Media With the term media we are mainly referring to images. Those are often managed by the customer itself, leading to possible inefficiencies in size and quality of the images. Without the proper compression, a single image may take up to 80% more bandwidth than an optimized one! Even when Magento responds quickly, if the browser needs to download lots of MBs of images the user will still get a sensation of slowness.
  • 9. Media There are services and plugins for dealing with the optimization without having to check manually every image uploaded to the platform. The most famous are Kraken.io and Apptrian Image Optimizer, which intercept the images being requested, call a webservice for optimizing size (with both lossy or lossless algorithms) and then return it, properly cached.
  • 10. Assets Just like the media, assets have great impact on the loading time of the client. The best option here is to relocate and minify the code. To relocate all the js and css source in the same host is useful for reducing network time over the resolution of DNS and routing to the server, while the minification reduces the size of the single files and the number of requests needed to download them all. One of the most used extension is Apptrian Minify HTML CSS JS.
  • 11. Source code The possibilities to extend Magento functionalities are nearly limitless, but this flexibility costs much. Given the chance to use Models for interacting with database, it's essential to know exactly how code operates, in order to prevent improper use of objects and classes which may lead to overheads of JOINs or unwanted big queries for just small chunks of information.
  • 12. Source code Iteration $p = Mage::getModel('catalog/product') ->getCollection(); foreach ($p as $item) { // Doin’ stuff... } This is a don’t, as Magento uses a lazy loading approach while dealing with collections, thus loading the entire PHP object at every cycle of the for. It is utterly expensive.
  • 13. Source code Iteration $p = Mage::getModel('catalog/product') ->getCollection(); foreach ($p->getData() as $data) { // Doin’ stuff } This is the proper way, because it loads only the informations we really need.
  • 14. Source code Iteration $p = Mage::getModel('catalog/product') ->getCollection(); while ($item = $p->fetchItem()) { // Doin’ stuff } This is totally analogue to the previous solution, with just some saving in the amount of memory stored for each item of the collection.
  • 15. Source code Iteration Benchmark made on a Magento 1.9 installation with official sample data (~580 products) Vagrant - OS Ubuntu 14.04 - PHP 5.6.12 with APC - MySQL 5.6.24 Time Memory wrong way ~ 0.0366 sec ~ 3.14 MB getData() ~ 0.0052 sec ~ 1.16 MB fetchItem() ~ 0.0211 sec ~ 0.30 MB
  • 16. Source code Scaling $p = Mage::getModel('catalog/product') ->getCollection(); foreach ($p as $item) { $item->load($item->getId()); echo $item->getDescription(); } This is a don’t, as at every cycle we are loading the entire product object just for a single information.
  • 17. Source code Scaling $p = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSelect( array('description') ); foreach ($p as $item) { echo $item->getDescription(); } Here we are correctly specifying which information we are going to need later, lightening the execution of the cycle.
  • 18. Source code Scaling Benchmark made on a Magento 1.9 installation with official sample data (~580 products) Vagrant - OS Ubuntu 14.04 - PHP 5.6.12 with APC - MySQL 5.6.24 Time Memory without attribute ~ 17.07 sec ~ 25.83 MB with attribute ~ 0.0435 sec ~ 3.45 MB
  • 19. Source code Saving $p = Mage::getModel('catalog/product') ->load($id); $p->setDescription('New Test') ->save(); Another don’t. This way of saving forces Magento to store the entire object, not just the attribute we’ve modified.
  • 20. Source code Saving $p = Mage::getModel('catalog/product') ->load($id); $p->setDescription('New Test') ->getResource() ->saveAttribute($p, 'description'); Instead of storing the entire object, we specify exactly the attribute to be saved, thus sparing us time and memory.
  • 21. Source code Saving Benchmark made on a Magento 1.9 installation with official sample data (~580 products) Vagrant - OS Ubuntu 14.04 - PHP 5.6.12 with APC - MySQL 5.6.24 Time Memory save() ~ 0.336 sec ~ 5.99 MB saveAttribute() ~ 0.0432 sec ~ 2.47 MB
  • 22. Source code Reuse & Recycle # Multiple static call $nam = Mage::getModel('catalog/product' )->load($id)->getName(); $sku = Mage::getModel('catalog/product' )->load($id)->getSku(); $des = Mage::getModel('catalog/product' )->load($id)->getDescription (); /******** VERSUS ********/ # Single static call $p = Mage::getModel('catalog/product' )->load($id); $nam = $p->getName(); $sku = $p->getSku(); $des = $p->getDescription (); It may seems obvious, but attention to details is needed when working with big amount of data.
  • 23. Source code Reuse & Recycle Benchmark made on a Magento 1.9 installation with official sample data (~580 products) Vagrant - OS Ubuntu 14.04 - PHP 5.6.12 with APC - MySQL 5.6.24 Time Memory multiple ~ 0.0823 sec ~ 2.54 MB single ~ 0.0376 sec ~ 2.54 MB Thinking of a store with about 10.000 products, performance would be impacted greatly.
  • 24. Source code Native funcs Benchmark made on a Magento 1.9 installation with official sample data (~580 products) Vagrant - OS Ubuntu 14.04 - PHP 5.6.12 with APC - MySQL 5.6.24 Time Memory count() ~ 0.0363 sec ~ 3.14 MB getSize() ~ 0.0019 sec ~ 0.0016 MB Sometimes we found ourselves thinking that native PHP functions should work better than the ones offered by a framework. This is true in some cases, but not with Magento. Here’s an example: counting elements in a collection.
  • 25. Cache The temptation of using a cache system to speed up our website is very strong, but we shall not fall for the Dark Side. Instead, caching is effective only after all the other optimizations have been applied. Moreover, regardless of the cache system that one will choose for its website, it's very important to plan accurately and think over the pros and the cons of using the proper system, if you are going to need it at all.
  • 26. Cache In Mage World, we can distinguish two major cache family: ➢ Infrastructure, server-level ➢ Application, managed by Magento itself
  • 27. Cache Infrastructure This type of cache uses services implemented outside the basecode, typically reverse proxies, which take place between the client and the Magento application entry point. It greatly reduces the response time, because when a request hits the cache Magento hasn’t been instanced yet and all the callback effort is handled by the proxy service itself. Besides, reducing the number of hit to Magento will also reduce the amount of load on the server.
  • 28. Cache Infrastructure The most famous reverse proxy is Varnish, widely used for eCommerce sites with high traffic levels. It also provides support for a specific hypertext syntax called ESI: it’s used to specify, through proper tags, which content of the page needs to be reloaded every time, committing the job to Varnish. When the proxy encounters an ESI tag, it will send a request to the application to obtain the resource, merge the result with the cached response and then return it to the client.
  • 29. Cache Application The second cache family has a more diversificated situation. Many different extensions have been implemented from time to time, all of which different from the others by the way the cache is implemented (before or after Mage instance) or the the kind of storage being made (full, partial). So, for the sake of orderliness, we will split up this types in three: ❖ Full Page Cache ❖ Static Cache ❖ Hybrid Cache
  • 30. Cache Full Page Cache Full Page Cache (FPC for friends) is intended for caching the most out of a page, while reloading the resource just for specific chunks of page that are requested as fresh every time. The advantage of this extension is that it kicks in before all the Mage app object is instanced, thus saving lots of resources. The drawback, however, resides in the necessity to parse the response, which can be enormous, and to retrieve the dynamic content to replace in the cached response for every request.
  • 31. Cache Static Cache This kind of cache is the most effective, but its range of use is very limited. Like FPC, it is placed before the instance of Mage app and it caches all the content of the request, regardless of the content. The cons, here, are clear: it can't be used in any page that provides dynamic objects, like a cart, or session- related informations. However it is very useful with static pages like 404 (which are very expensive in Magento!), external widgets or other static contents (like a 'Contact us' block).
  • 32. Cache Hybrid Cache The Hybrid tries to take the pros of both types, reducing the cons. The content is returned through Static Cache, so it's faster and the user will be served asap, while to the response we will attach javascript algorithm to create asynchronous calls towards the server and retrieve the dynamic content after the page has been loaded. This approach will return only the information needed, while the async calls may be cached again as they are fully compatible with any other cache system, both Application and Infrastructure.
  • 33. Tweaking Usually snobbed by developers for small or mid- sized application, a proper LAMP/LNMP configuration setup becomes mandatory working with Magento. In this presentation we will list only the most important tweaks, but for a complete list I suggest to follow this link.
  • 34. Tweaking Server 1. Turn on the Gzip compression: it reduces output size, speeding up the download for clients. 2. Turn on the option "KeepAlives" of Apache: this option enables the server to channel multiple HTTP request through a single TCP connection, improving response time. Be careful, though, because setting a wrong time for this parameter may lead to an excess of open TCP connections, which will increase considerably the load on the server.
  • 35. Tweaking Server 3. Use a RAM filesystem for storing files with an high rate of I/O operation, usually var/cache and var/session. 4. Reduce logging operation when not needed: it's an I/O that may slow down HTTP requests; alternatively, think of an async write or the use of a memory based filesystem.
  • 36. Tweaking PHP 1. Use an accelerator like APC, Zend Opcache or XCache. 2. Increase the memory_limit to at least 128M 3. Check the real amount of realpath cache used by PHP and set the correct amount in the realpath_cache_size option. You can verify it using the realpath_cache_size() function.
  • 37. Tweaking PHP 4. Turn off open_basedir, as it prevents realpath cache use. 5. Use an Autoloader, which will reduce I/O operation while scavenging for classes during Mage execution. Another ally in the parse of the base code may be the AOE_ClassPathCache extension, which does not create an Autoload file but registers all the filepaths for resolving classes requests into a single file, thus saving time for scanning all the dirs searching for the proper file.
  • 38. Tweaking Database 1. Disable log writing to database if not needed. Magento does not offer this option by default, it can be achieved through the use of an extension called Yireo DisableLog. 2. Increase the query_cache_size amount, useful when server comes with loads of RAM. MySQL packages tend to be resource conservative by default. It can be increased to 64MB if the server has at least 1GB of RAM. 3. Increase the query_cache_limit, bringing it to at least 2MB.
  • 39. Tweaking Database 4. MySQL uses a buffer to store information on data and indexes, to speed up queries execution. The buffer size can be monitored with the innodb_buffer_pool_size option, which value depends on the database server specs. Database server RAM Size Shared with HTTP server 6 GB 2/3 GB Dedicated 6 GB 5 GB Dedicated 12 GB 10 GB
  • 40. Tweaking Database 5. Increase the innodb_thread_concurrency attribute, which defines the maximum number of concurrency threads inside InnoDB. By default this option is set to 0. It's useful for websites with at least 60 active user at the same time. A good way to guess the correct amount of concurrency threads is to apply this formula: (2 * [n° of CPU])+ 2
  • 41. Platform This is not proper optimization, but it’s a good point to consider when talking about performance. The platform over which Magento runs can greatly improve speed, stability and scalability. One of the best booster for a Magento 1.9 installation would be a setup composed by PHP 7 FPM and MySQL Percona 5.6. Advantages are tremendous, and will be shown in comparison with past benchmarks.
  • 42. Platform Let’s take the code of page #16, which is the heaviest of all in this presentation. Time Memory PHP 5.6* ~ 17.07 sec ~ 25.83 MB PHP 7** ~ 6.28 sec ~ 13.12 MB Benchmark made on a Magento 1.9 installation with official sample data (~580 products) *Vagrant - OS Ubuntu 14.04 - PHP 5.6.12 with APC - MySQL 5.6.24 vs. **Vagrant - OS Ubuntu 14.04 - PHP 7.0.0 FPM - MySQL Percona 5.6.27
  • 43. Platform We can achieve interesting results also with code from #19, during the save operation of a product. In this case, Mage cache was not taken in account. Time Memory PHP 5.6* ~ 0.643 sec ~ 7.576 MB PHP 7** ~ 0.310 sec ~ 3.465 MB Benchmark made on a Magento 1.9 installation with official sample data (~580 products) *Vagrant - OS Ubuntu 14.04 - PHP 5.6.12 with APC - MySQL 5.6.24 vs. **Vagrant - OS Ubuntu 14.04 - PHP 7.0.0 FPM - MySQL Percona 5.6.27
  • 44. Platform While officially Magento 1.9 does not support PHP 7, there are simple fixes that needs to be made in the Core in order to get it up and running. The real problem is, no one can assure backward compatibility for Magento 1.x modules, thus potentially transforming a simple platform migration into your worst nightmare. This kind of change should not be done on running and stable projects, but it’s a really good (and brave) start for new ones. Even starting from fresh, though, we need to be careful about code written for PHP 5 in 3rd party extensions.
  • 45. At last... Released under Creative Commons by-nc-nd ...thanks for watching! Synesthesia srl HQ: Via Amedeo Peyron 29, 10143 Torino Tel: +39 011 0437401 - info@synesthesia.it - www.synesthesia.it - www.droidcon.it Reg. Office: C.so Galileo Ferraris 110, 10129 Torino - VAT N° IT10502360018 Mobile Apps // Web Development // Ecommerce & Magento // UX&UI Design