Skip to content

Instantly share code, notes, and snippets.

View ovaistariq's full-sized avatar

Ovais Tariq ovaistariq

View GitHub Profile

IO Bound Workload

Config:

  • 2 x Intel Xeon(R) CPU E5-2620 v4 @ 2.10GHz (8 cores), 32 vcpus total
  • 16GB RAM
  • Table rows: 5M
  • Number of tables: 16
  • Rand-type: uniform

Dataset size:

  • InnoDB Uncompressed: 116GB
## Analyze InnoDB status
grep -h "lock on" log | cut -d "-" -f2- | sort | uniq -c | sort -nr > lock_on.txt
grep -h "Mutex at" log | cut -d "," -f 1 | sort | uniq -c | sort -nr > mutex_at.txt
grep -h "has waited at " log | awk '{print $6" "$7" "$8}' | sort | uniq -c | sort -nr > has_waited_at.txt
grep -h "Last time write locked " log | sort | uniq -c | sort -nr > last_time_write_locked.txt
grep -A 2 "\-\-\-TRANSACTION" log | grep COMMIT | cut -d "," -f 1,2,3 | sort | uniq -c | sort -nr > commit_statements.txt
#!/usr/bin/env python
"""
Uses rsync to sync files in parallel between a source and destination.
This script has been tested with Python 2.7.4 and 2.6.8; it requires 2.5+.
This script has also been tested with rsync versions 3.0.9 and 2.6.8.
BASIC USAGE:

For 5.1 and above when slow_query_log_file is a dynamic variable

  • file: start_queries_capture.sh
#!/bin/bash

mysql -e "set global slow_query_log_file='/var/log/mysql/slow_query_capture.log'"
mysql -e "set global long_query_time=0"
mysqladmin flush-logs

get a branch and store it in the directory percona_server_5.5

bzr branch lp:percona-server/5.5 percona_server_5.5

get a branch from a tag

  • each minor MySQL version is identified by a tag, for example 5.5.27 here major version is 5.5 and that will be the name of the branch and the tag name will have 5.5.27 in it
  • to find the name of the tag corresponding to a minor release, first go inside the directory corresponding to the branch of the major version, for example in the example above go to the directory percona_server_5.5 and then the following: bzr tags | grep 5.5.27
  • then what the above returns, use it as follows to fetch the branch corresponding to the tag and store it in the directory percona_server_5.5.27 bzr branch -r tag:Percona-Server-5.5.27-28.0 lp:percona-server/5.5 percona_server_5.5.27
import requests
import hashlib
import subprocess
import time
url = 'http://cachefly.cachefly.net/100mb.test'
backup_file = 'backup.out'
md5sum_file = 'backup.out.md5'
gpg_file = 'backup.out.gpg'
@ovaistariq
ovaistariq / migration.sh
Last active August 26, 2015 22:17 — forked from stephenlauck/migration.sh
Migrate node across hosted chef servers
# update gems
sudo gem update --no-rdoc --no-ri
# edit client.rb with correct validation key and chef server
# also set the environment
log_level :info
log_location STDOUT
chef_server_url "https://api.opscode.com/organizations/modcloth-comments"
validation_client_name "modcloth-comments-validator"
node_name "comments-standalone-01.demo.modcloth.com"
@ovaistariq
ovaistariq / set_hyperthreading.sh
Created May 2, 2015 02:45
Disable/enable hyperthreading
#!/bin/bash
hyperthreading=$1
if [[ -z $hyperthreading ]]; then
echo "Missing argument: Specify 0 to disable hyperthreading and 1 to enable hyperthreading"
exit 2
fi
# Be careful to not skip the space at the beginning nor the end
@ovaistariq
ovaistariq / tables_without_pk.sql
Created October 21, 2014 18:33
MySQL - find tables without Primary Key
select tables.table_schema
, tables.table_name
, tables.engine
from information_schema.tables
left join (
select table_schema
, table_name
from information_schema.statistics
group by table_schema
, table_name
FIELDS = ['cmd', 'command', 'start', 'end', 'delta', 'msg', 'stdout', 'stderr']
def human_log(res):
if type(res) == type(dict()):
for field in FIELDS:
if field in res.keys():
print '\n{0}:\n{1}'.format(field, res[field])
class CallbackModule(object):