Skip to content

Instantly share code, notes, and snippets.

@ijin
ijin / rbenv-install-system-wide.sh
Created November 3, 2012 00:41 — forked from jpfuentes2/rbenv-install-system-wide.sh
CentOS: rbenv install and system wide install
#!/bin/bash
# CentOS rbenv system wide installation script
# Forked from https://gist.github.com/1237417
# Installs rbenv system wide on CentOS 5/6, also allows single user installs.
# Install pre-requirements
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel \
make bzip2 autoconf automake libtool bison iconv-devel git-core
@ijin
ijin / gist:3038946
Created July 3, 2012 10:30
tuningathon4 /etc/sysconfig/varnish
NFILES=131072
MEMLOCK=82000
RELOAD_VCL=1
DAEMON_OPTS="-a :3000 \
-T :6082 \
-f /etc/varnish/default.vcl \
-t 120 \
-S /etc/varnish/secret \
-s malloc,64M \
@ijin
ijin / gist:3038775
Created July 3, 2012 09:44
tuningathon4 /etc/varnish/default.vcl
# This is a basic VCL configuration file for varnish. See the vcl(7)
# man page for details on VCL syntax and semantics.
#
# Default backend definition. Set this to point to your content
# server.
#
backend default {
.host = "127.0.0.1";
.port = "3001";
}
@ijin
ijin / gist:3038562
Created July 3, 2012 08:46
tuningathon4 - best w/ varnish
32005 fetches, 9 max parallel, 1.20014e+08 bytes, in 10.0008 seconds
3749.86 mean bytes/connection
3200.23 fetches/sec, 1.20004e+07 bytes/sec
msecs/connect: 0.249777 mean, 64.577 max, 0.023 min
msecs/first-response: 2.02407 mean, 1094.87 max, 0.188 min
15156 bad byte counts
HTTP response codes:
code 200 -- 32005
Score: 3203.969 (get=3200.244, comment=3.725(4), check=1.000)
@ijin
ijin / gist:3038551
Created July 3, 2012 08:43
tuningathon4 - best w/ ruby only
190 fetches, 9 max parallel, 1.02258e+06 bytes, in 10 seconds
5382.01 mean bytes/connection
19 fetches/sec, 102258 bytes/sec
msecs/connect: 0.125232 mean, 0.285 max, 0.031 min
msecs/first-response: 455.956 mean, 1031.53 max, 68.138 min
186 bad byte counts
HTTP response codes:
code 200 -- 190
Score: 29.733 (get=19.000, comment=10.733(11), check=1.000)
@ijin
ijin / gist:3038511
Created July 3, 2012 08:37
tuningathon4 - ruby 1.9.3-p194
36 fetches, 9 max parallel, 329147 bytes, in 10 seconds
9142.97 mean bytes/connection
3.6 fetches/sec, 32914.7 bytes/sec
msecs/connect: 27.9452 mean, 1001.77 max, 0.044 min
msecs/first-response: 2207.35 mean, 3049.54 max, 1514.12 min
19 bad byte counts
HTTP response codes:
code 200 -- 36
Score: 6.102 (get=3.600, comment=2.502(3), check=1.000)
@ijin
ijin / gist:3038507
Created July 3, 2012 08:35
tuningathon4 - after tuning development.rb
fetches, 9 max parallel, 154142 bytes, in 10 seconds
5315.24 mean bytes/connection
2.9 fetches/sec, 15414.2 bytes/sec
msecs/connect: 34.6278 mean, 1000.81 max, 0.044 min
msecs/first-response: 2669.64 mean, 3776.01 max, 1958.68 min
12 bad byte counts
HTTP response codes:
code 200 -- 29
Score: 5.255 (get=2.900, comment=2.355(3), check=1.000)
@ijin
ijin / gist:3038461
Created July 3, 2012 08:24
tuningathon4 initial benchmark
12 fetches, 9 max parallel, 45576 bytes, in 10 seconds
3798 mean bytes/connection
1.2 fetches/sec, 4557.6 bytes/sec
msecs/connect: 83.4978 mean, 1000.51 max, 0.044 min
msecs/first-response: 4880.63 mean, 6446.66 max, 2048.37 min
HTTP response codes:
code 200 -- 12
Score: 2.439 (get=1.200, comment=1.239(2), check=1.000)
@ijin
ijin / resque.rake
Created February 9, 2012 14:19
resque drain_pool
desc "Stops the pool proccess"
task :drain_pool do
begin
Dir.glob(Rails.root.join('tmp', 'pids').join('resque_workers_pc.pid').to_s) do |pidfile|
begin
pid = File.read(pidfile).to_i
Process.kill("QUIT", pid)
Rails.logger.info "Pooling process #{pid} ended"
rescue Errno::ESRCH => e
Rails.logger.info "Stale #{pidfile}"
@ijin
ijin / percona_raid_ec2.sh
Created July 28, 2011 15:55
percona server & raid setup on ec2
# install percona server
wget http://www.percona.com/downloads/RPM-GPG-KEY-percona
sudo apt-key add RPM-GPG-KEY-percona
echo "deb http://repo.percona.com/apt `lsb_release -cs` main" | sudo tee -a /etc/apt/sources.list
echo "deb-src http://repo.percona.com/apt `lsb_release -cs` main" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install percona-server-server-5.1 percona-server-client-5.1 percona-server-common libmysqlclient-dev