Skip to main content
Share Your Experience: Take the 2024 Developer Survey
9 votes

Magento 2 How to do gzip compression and minify js, css files for optimization?

I'm not an expert in this field, but I will share my experiences: You need to have mod_deflate enabled in your Apache web server to utilize the compression declared in default Magento 2 .htaccess ...
Lez's user avatar
  • 2,917
8 votes

Magento2 : Manage and understand images of deleted products behavior?

After many hours of reading, digging and testing, I finally understood how Magento2 handle products images. catalog_product_entity_media_gallery table content records of all images uploaded for ...
cap340's user avatar
  • 711
6 votes
Accepted

How to add the MAGE_INDEXER_THREADS_COUNT environment variable to env.php?

You can try adding like 'MAGE_INDEXER_THREADS_COUNT'=>3 then the env.php will look something like following return [ 'backend' => [ 'frontName' => 'magento226administrator' ],...
Anshu Mishra's user avatar
  • 8,970
6 votes

Magento 2: I am not aware about Magento optimization. Can you please share the steps for this?

Switch your website to production mode Minify your HTML, CSS and js files. Merge your CSS and JS files. Optimize your images. Enable Gzip Compression. Ensure if Magento Full Page Cache is enabled....
Raj Mohan R's user avatar
  • 2,048
5 votes

Magento 2 How to do gzip compression and minify js, css files for optimization?

Compare your htaccess code it must contains. <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg "access plus 1 year" ExpiresByType image/jpeg "access plus 1 year" ...
Abhinav Singh's user avatar
5 votes

Reduce Number of Requests

what you can try: CSS sprites to merge many images into one. inline small CSS/JS files right into HTML. use base64 data for small images https://css-tricks.com/data-uris/ CDN or domain sharding https:...
Konstantin Gerasimov's user avatar
5 votes
Accepted

How to enable CSS Critical Path in Magento 2

This will probably be added in v2.3.3. This is the MR: https://github.com/magento/magento2/commit/fb9a02ae025d102744857f981b702c0fe32c23d2
Victor F's user avatar
4 votes
Accepted

What is faster - getting raw attribute value or use collection?

Well you can test is easily, create the following test.php file in your root folder: <?php //some settings error_reporting(E_ALL | E_STRICT); define('MAGENTO_ROOT', getcwd()); $mageFilename = ...
Raphael at Digital Pianism's user avatar
4 votes

Reduce Number of Requests

You have to use lazy load functionality for homepage, It is presumed there are number of products you showing on homepage and all product images have separate request. You have to go with this : ...
Ram Pratap Singh Gour's user avatar
4 votes

how to optimize magento 1.9.X website?

Follow these tips below on how to speed up Magento and keep it running fast to ensure return shoppers and sales. Speed Up Magento Index Latest Version Content Delivery Network Utilize Caching Enable ...
Vinod Kumar's user avatar
  • 2,055
4 votes

Magento unable to add webp images to category thubmnail

I almost feel it is spammy, but just to mention: A free way of implementing WebP is here: https://www.yireo.com/software/magento-extensions/webp2
Jisse Reitsma's user avatar
4 votes

Magento 2 increase site speed

Some important points for speeding up Magento 2:: Production Mode Full Page Cache Minify JS and CSS Check TTFB and try to reduce it Enable Flat Categories and Products Enable GZIP ...
Saphal Jha's user avatar
  • 1,873
3 votes

how to optimize magento 1.9.X website?

You can use tools like "https://gtmetrix.com" to check why your website is slow. And based on suggestion you can make neccesary changes. Some common things which help in magento site optimization ...
Pawan's user avatar
  • 5,901
3 votes

What is faster - getting raw attribute value or use collection?

Bit different numbers here. "xhprof'ed" with with ~700 products .... $storeId = 1; $productIds = Mage::getModel('catalog/category')->load(41) ->getProductCollection() ->getAllIds(); ...
sv3n's user avatar
  • 11.7k
3 votes

how to check which collection is taking how much time to load in a function in magento 1.9

There are 3 ways as per my knowledge. May be more... not sure though. Magento's Way 1) Go to lib/Varien/Db/Adapter/Pdo/Mysql.php set $_debug to TRUE and set $_logAllQueries to TRUE. Now in this var/...
Kingshuk Deb's user avatar
  • 1,214
3 votes

Does magento2 use r.js optimization for require.js when deploying static files

Yes. It could be optimized by using r.js Anton Krill showed a basic implementation here https://github.com/antonkril/magento-rjs-config - however Magento team is working on new external bundling ...
JanuszJanczy's user avatar
3 votes
Accepted

How do you minify merged css and js on Magento 1.9?

If you are in Magento 1.x, i would ignore the merging for css and js files. That functionality breaks more things that it fixes. There is no built in minification for Magento 1.x, so you will have to ...
circlesix's user avatar
  • 4,293
3 votes
Accepted

Speed up magento by htacess

You need to add compression code into you .htaccess file just like mine as below: ############################################ ## uncomment these lines for CGI mode ## make sure to specify the ...
Vicky Dev's user avatar
  • 1,992
3 votes
Accepted

Magento 1.7 + Apache + 2GB RAM super slow with new theme

In my experience, bought themes are very often put together without following Magento's best practices or built with flexibility in mind more than performance. We've often decided to just theme a ...
TJ Gamble at Jamersan's user avatar
3 votes
Accepted

Image optimizer Magento1.9.3.2

Check if the optipng binary is available: which optipng If it was found, make sure it has the correct access permissions: chmod +x PATH_FROM_optipng
David Lambauer's user avatar
3 votes
Accepted

Magento 2 : page speed optimization

Firstly you if want good magento pagespeed, the store must be set to production mode using following command; php bin/magento deploy:mode:set production Now, for caching you can use magento's ...
Vivek Kumar's user avatar
  • 5,395
3 votes

How to add the MAGE_INDEXER_THREADS_COUNT environment variable to env.php?

Works if you insert below 'MAGE_MODE' with: 'x-frame-options' => 'SAMEORGIN', 'MAGE_MODE' => 'production', 'MAGE_INDEXER_THREADS_COUNT' => '3', 'session' => [ 'save' => 'memcache', ...
Nemanja Djuric's user avatar
3 votes

Add tag "noscript" in HEAD for CSS files ( Magento 2)

You can add scripts from admin area. Navigate Admin -> Content -> Design -> Configuration -> [your theme] -> HTML Head. In this section you can add your scripts.
Greg's user avatar
  • 2,729
3 votes
Accepted

Advanced js bundling

Found the issue, main problem was that the guide in the devdocs has some mistakes in it. To fix this I had to find in my build.js "jquery/jquery-migrate": ["jquery" in the shim section and replace it ...
Vlad Patru's user avatar
  • 1,200
3 votes
Accepted

Check if product is saleable, without product load

Try this: $collection = Mage::getModel('catalog/product')->getCollection() ->addAttributeToFilter('entity_id', array('in' => $_products)) ->addAttributeToSelect(Mage::getSingleton(...
Marius's user avatar
  • 198k
3 votes
Accepted

JS Merge vs JS Bundle which one is better for Google ranking

After working with many Magento 2 websites I came up with JS merging with minify on works better for Google's new insight. Also, page loads resources asynchronously which makes page rendering fast.
Gulshan Maurya's user avatar
3 votes

Magento 2.2.2 site loading speed is very slow

You need to check following things for improve site speed in Magento: Update latest version of Magento 2 Enable Varnish Cache Configure Memcached Enable Flat Categories and Products Merge & ...
Mahesh Dave's user avatar
2 votes

Site loading speed is very slow

Magento is a great e-commerce framework. It has tons of features and you can really build a scalable e-commerce platform. I used Magento in my latest project and faced this speed issue. After doing ...
Ranjeet Vimal's user avatar
2 votes
Accepted

Magmi blank page while importing products

You are running out of memory. Many times, when there is no memory, it dies a silent death. Check your php.ini memory_limit and also the memory limit in your .htaccess file. Increase as needed. I ...
Shawn Abramson's user avatar
2 votes

How to tackle with multiple time product load in magento?

In general the colleagues are right. But in this specific example you can try to use directly collection. Instead of: foreach ($productIds as $productId) { $product = Mage::getModel('catalog/...
michael's user avatar
  • 2,770

Only top scored, non community-wiki answers of a minimum length are eligible