Browsed by
Category: Optimize

Magento 2 – PHP Optimize Tips – Part 2

Magento 2 – PHP Optimize Tips – Part 2

Continue of Part 1. After part 1 you know how to process with large Collection, why we need to use Model Factory instead of Model in __constructor and Customer data sections to load a partition of the web page without disabling FULL page cache. Today I will provide you with consultation and assist you with some tips when you’re working on data. Tip 1: Use in condition instead of for each id and load Data Model You have an array…

Read More Read More

Magento 2 – PHP Optimize Tips – Part 1

Magento 2 – PHP Optimize Tips – Part 1

There are many ways to optimize Magento 2. However, the first thing you should do is optimizing your codes before touching to DB or Cache. Tip 1: Using Factory in the constructor. Why did I say that? Because of the case very simple of Dependence Injection design working in Magento 2 => _constructor, __constructor … will be called, it’s very bad if in the constructor or default functions call for each Collection. => If your classes are Factory the loop process will…

Read More Read More

How to override Magento 2 js using Mixins?

How to override Magento 2 js using Mixins?

A Magento 2 RequireJS “mixin” allows you to programmatically listen for the initial instantiation of any RequireJS, How to mixins in Magento 2 work? First, create requirejs-config.js var config = { config: { mixins: { ‘Magento_Checkout/js/model/quote’: { ‘PackageName_ModuleName/js/plugin-quote’: true } } } };   Magento_Checkout/js/model/quote js file you want to rewrite. PackageName_ModuleName/js/plugin-quote target file. plugin-quote.js /*global define*/ define([“jquery”], //defile more js here function ($) { ‘use strict’; var mixins = { getTotals: function () { //Define new content for getTotal() function…

Read More Read More

Config Redis Cache with Magento 2

Config Redis Cache with Magento 2

1. Raise somaxconn above [tcp-backlog] value: sudo nano /etc/rc.local Add this: sysctl -w net.core.somaxconn=65535 When you reboot the next time, the new setting will be to allow 65535 connections instead of 128 as before. 2. Make sure to disable Linux kernel feature transparent huge pages, it will affect greatly both memory usage and latency in a negative way. This is accomplished with the following command: echo never > /sys/kernel/mm/transparent_hugepage/enabled. then add the command to your /etc/rc.local file. if test -f…

Read More Read More

Follow by Email
Facebook
Facebook
LinkedIn