Skip to content

Instantly share code, notes, and snippets.

View parhamr's full-sized avatar

Reid Parham parhamr

View GitHub Profile
sudo rm -rf /
@colby
colby / openssl.sh
Last active August 29, 2015 14:17
A simple script to upgrade OpenSSL related packages and restart services on Ubuntu/Debian
#!/bin/bash
awk=$(which awk || echo 'missing: install awk' && exit 1)
# update apt
sudo apt-get update
# get ssl related packages from simulated upgrade
sudo apt-get upgrade -s | grep ssl | grep Inst | $awk '{print $2}' | xargs -t sudo apt-get install -y
@alistairstead
alistairstead / local.xml
Created November 1, 2014 12:09
Disable the automatic application of update scripts on each page request following cache clear. Use MageRun to apply the upgrades manually within a controlled step.
<?xml version="1.0"?>
<config>
<global>
<skip_process_modules_updates>1</skip_process_modules_updates>
</global>
</config>
@colinmollenhour
colinmollenhour / Config.php
Last active April 22, 2020 09:45
Stampede-resistant Config Cache
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
@parhamr
parhamr / sysctl.conf
Last active August 29, 2015 14:05 — forked from colby/-
Boilerplate Linux Kernel tweaks for a webserver
fs.file-max=131072
kernel.shmall=32768
kernel.shmmax=536870912
net.core.netdev_max_backlog=4096
net.core.optmem_max=25165824
net.core.rmem_default=25165824
net.core.rmem_max=25165824
net.core.somaxconn=4096
net.core.wmem_default=65536
net.core.wmem_max=25165824
@JunichiIto
JunichiIto / alias_matchers.md
Last active April 16, 2024 16:18
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value

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
@corny
corny / install-cacert.sh
Created March 25, 2014 13:54
Install CA Cert certificates on Debian/Ubuntu
#!/bin/sh -e
mkdir -p /usr/share/ca-certificates/cacert.org/
curl http://www.cacert.org/certs/root.crt > /usr/share/ca-certificates/cacert.org/cacert.org.crt
curl http://www.cacert.org/certs/class3.crt >> /usr/share/ca-certificates/cacert.org/cacert.org.crt
sed -i 's/^\!\(cacert\)/\1/' /etc/ca-certificates.conf
update-ca-certificates
@peterjaap
peterjaap / Mage_Catalog_Model_Resource_Url_getProduct.php
Last active May 4, 2017 06:09
Modified Mage_Catalog_Model_Resource_Url::_getProduct function. This function now contains a boolean that you can set to switch between rewriting the URL's for ALL products and rewriting only the URL's of products that are visible. Idea inspired by Alan Storm's blog on Scaling Magento - http://alanstorm.com/scaling_magento_at_copious
<?php
protected function _getProducts($productIds, $storeId, $entityId, &$lastEntityId)
{
$products = array();
$websiteId = Mage::app()->getStore($storeId)->getWebsiteId();
$adapter = $this->_getReadAdapter();
if ($productIds !== null) {
if (!is_array($productIds)) {
$productIds = array($productIds);
@parhamr
parhamr / Magento1.12-SQL_type_example.md
Last active December 25, 2015 17:18
MySQL 5.6.11 skips indices when given quoted INTs

Removing quotes from an INT column allows MySQL to use the index and this can reduce rows scanned by 99.997 percent. Example from Magento 1.12 on a production database; the query takes nearly a second to execute:

mysql> explain DELETE FROM `catalog_product_index_price` WHERE entity_id IN('433284', 433283)\G;
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: catalog_product_index_price
         type: ALL
possible_keys: NULL