Skip to content

Instantly share code, notes, and snippets.

View SchumacherFM's full-sized avatar

Cyrill Schumacher SchumacherFM

View GitHub Profile
@icholy
icholy / goi.md
Last active August 31, 2017 03:17

Interfaces

Let's imagine a very simple table

CREATE TABLE people {
  id bigserial,
  name character varying
}
@janisz
janisz / bench_test.go
Created March 24, 2016 13:40
Go Free cache vs BigCache
package bigcache
import (
"encoding/binary"
"testing"
"time"
"github.com/allegro/bigcache"
"github.com/coocood/freecache"
)

Magento Scaling Hypotheses

Magento’s checkout throughput can increase to at least 8 times its current capacity and up to 26 times more in ideal conditions.

  1. The current checkouts per hour limit for large, real-world Magento stores is 4,500
  2. This limit cannot effectively be increased with more and/or better hardware
  3. The improper type handling in Magento’s SQL code is the cause of the current limit
  4. If one SQL query is fixed, large Magento stores can scale to a new, real-world limit of 120,000 checkouts per hour
  5. For commodity hardware, this new limit might be 36,000 checkouts per hour
@IvanChepurnyi
IvanChepurnyi / Proposal.md
Last active June 26, 2020 22:22
Architectural Proposal for Magento 2 Inventory and Prices Mechanism

Problem

There are too tight relations of stock and prices to store views and websites in Magento that results in high complexity of implementation of b2b and drop shipping solutions in Magento.

The issue was very visible with the price index structure for Magento 1, and now Magento 2 stock index follows the same idea of having an index entry per website.

This strict relation to a website makes unnecessary data duplications in case if you have global stock. Although it makes over complicated multi-warehouse delivery, as you will be required to create a separate website for each warehouse, that duplicates other product data in the flat index structure and price index.

Solution

Create a separate scope entity for Price and Inventory, for using them as scope fields for respective data structures.

@colinmollenhour
colinmollenhour / Update.php
Created August 16, 2016 20:58
Improve Magento Layout Cache Efficiency
<?php
/**
* This rewrite modifies the caching behavior so that the layout cache key references a SHA1
* hash of the layout XML instead of the XML itself to avoid duplication. The layout XML must
* still be generated once for each layout key, but it will not be saved if the identical
* contents already exist, saving considerable cache backend storage.
*/
class Template_Core_Model_Layout_Update extends Mage_Core_Model_Layout_Update
{
@colinmollenhour
colinmollenhour / redis_
Created August 29, 2011 03:26
Munin plugin for Redis with added options
#!/usr/bin/perl -w
#
## Copyright (C) 2011 Colin Mollenhour <http://colin.mollenhour.com/>
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; version 2 dated June,
## 1991.
##
@Vinai
Vinai / or-example.php
Last active September 28, 2021 20:48
SearchCriteria OR Example for Magento 2
<?php
declare(strict_types = 1);
namespace Training5\VendorRepository\Controller\Test;
use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Framework\Api\Filter;
use Magento\Framework\Api\FilterBuilder;
@Vinai
Vinai / fix-url-keys.php
Last active September 2, 2022 16:24
This fixes the duplicate url_key issue in a Magento 1.8 / 1.13 installation.
<?php
/**
* Drop this into the shell directory in the Magento root and run with -h to see all options.
*/
require_once 'abstract.php';
/**
* Fix duplicate url keys for categories and products to work with the 1.8 alpha1 CE url key constraints.
@colinmollenhour
colinmollenhour / cleanCache.php
Created May 17, 2012 00:50
Simplified cache cleaning script for production updates.
<?php
/**
* Set global/skip_process_modules_updates to '1' in app/etc/local.xml and
* then use this script to apply updates and refresh the config cache without
* causing a stampede on the config cache.
*
* @author Colin Mollenhour
*/
umask(0);
ini_set('memory_limit','512M');
// Copyright 2016 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
// Command caption reads an audio file and outputs the transcript for it.
package main
import (
"fmt"
"io"