Skip to content

Instantly share code, notes, and snippets.

View zachallett's full-sized avatar

Zac Hallett zachallett

  • Washington D.C. metro area
View GitHub Profile
@zachallett
zachallett / cpu_load.pl
Created December 3, 2013 21:20
Load testing scripts
#!/usr/bin/perl
use strict;
use warnings;
use threads;
my $NUM_THREADS = 8;
sub do_work {
while() {
@zachallett
zachallett / memory_checker.rb
Created December 2, 2013 15:22
Use a thread to check each unicorn worker's memory consumption and kill the worker if its too high. Found on: https://github.com/blog/519-unicorn-god
# This will ride alongside god and kill any rogue memory-greedy
# processes. Their sacrifice is for the greater good.
unicorn_worker_memory_limit = 300_000
Thread.new do
loop do
begin
# unicorn workers
#
ln -s /usr/share/zoneinfo/UTC /etc/localtime
yum -y update
rpm -Uvh http://rbel.frameos.org/rbel6
yum -y install gcc g++ zlib zlib-devel libxslt libxslt-devel libxml2-devel gcc openssl openssl-devel readline-devel make libcurl-devel.x86_64 htop vim curl strace liburl-devel wget
cd /tmp
wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
tar xzvf yaml-0.1.4.tar.gz