Skip to content

Instantly share code, notes, and snippets.

View iconara's full-sized avatar
🤖

Theo iconara

🤖
View GitHub Profile
@iconara
iconara / setup.sh
Created November 2, 2012 08:46
CloudInit script for Amazon Linux
#!/bin/bash
set -e -x
PATH="$PATH:/opt/aws/bin"
MESSAGES_LOG='/var/log/burt-setup.log'
OUTPUT_LOG='/var/log/burt-setup.out'
exec > $OUTPUT_LOG 2>&1
@iconara
iconara / post.md
Created September 4, 2012 06:26
Load Testing RabbitMQ 2.8.

At Burt we're heavy into RabbitMQ, we use it as a series of tubes that transports almost all of the wonderful data around our platform. It's served us well, apart from a tiny, tiny detail: give it too much of the good stuff and it sort of gets drunk and won't have anymore. Legend has it that version 2.8 solves that problem, and as far as we can tell it's almost all true. Read on for pretty graphs.

[[MORE]]

Background

Our whole platform runs off of Amazon EC2, and for this test set we set up RabbitMQ clusters of 1, 2 and 3 c1.xlarge instances.

Each cluster gets 24 durable queues, we basically use RabbitMQ for transport, and to get the maximum throughput you want to have many queues, since each queue is essentially single threaded.

We loaded the queues by parsing about 2.3 gigs worth of messages from old production logs. The messages were combined and sent in batches of ten (another good technique for getting higher throughput), and routed explicitly to one of then 24 queues based on a property o

@iconara
iconara / speaker.md
Created June 29, 2012 21:38 — forked from matiaskorhonen/speaker.md
Frozen Rails Talk Proposal Template (http://2012.frozenrails.eu/)
@iconara
iconara / worker_pool.rb
Created February 29, 2012 09:22
Simple JRuby worker pool using j.u.c.Executors
# encoding: utf-8
require 'java'
module JUC
java_import 'java.util.concurrent.Executors'
java_import 'java.util.concurrent.TimeUnit'
end
@iconara
iconara / ebs_cost_per_month.rb
Created January 13, 2012 21:46
EC2 Cost Per Hour
# gem install aws-sdk
require 'aws'
PRICE_PER_GB_MONTH = 0.11
ACCESS_KEY = '...'
SECRET_KEY = '...'
ENDPOINT = 'eu-west-1.ec2.amazonaws.com'
@iconara
iconara / aws_cluster_size.rb
Created December 18, 2011 18:25
How many cores do you have, punk?
EC2 = {
'm1.small' => {:ram => 1.7, :ecus => 1.0, :cores => 1, :storage => 160},
'm1.large' => {:ram => 7.5, :ecus => 4.0, :cores => 2, :storage => 850},
'm1.xlarge' => {:ram => 15.0, :ecus => 8.0, :cores => 4, :storage => 1690},
't1.micro' => {:ram => 0.6, :ecus => 2.0, :cores => 1, :storage => 0}, # 613/1024 Gb RAM and actually less than 2 CPUs, but bursting up to 2
'm2.xlarge' => {:ram => 17.1, :ecus => 6.5, :cores => 2, :storage => 420},
'm2.2xlarge' => {:ram => 34.2, :ecus => 13.0, :cores => 4, :storage => 850},
'm2.4xlarge' => {:ram => 68.4, :ecus => 26.0, :cores => 8, :storage => 1690},
'c1.medium' => {:ram => 1.7, :ecus => 5.0, :cores => 2, :storage => 350},
'c1.xlarge' => {:ram => 7.0, :ecus => 20.0, :cores => 8, :storage => 1690},
@iconara
iconara / gist:1315805
Created October 26, 2011 08:43
Installing JRuby with Oracle's JDK 7 Developer Preview
Code/mikka% rvm install jruby-1.6.5
jruby-1.6.5 - #fetching
jruby-1.6.5 - #downloading jruby-bin-1.6.5, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 14.6M 100 14.6M 0 0 156k 0 0:01:35 0:01:35 --:--:-- 210k
jruby-1.6.5 - #extracting jruby-bin-1.6.5 to /Users/theo/.rvm/src/jruby-1.6.5
jruby-1.6.5 - #extracted to /Users/theo/.rvm/src/jruby-1.6.5
Building Nailgun
jruby-1.6.5 - #installing to /Users/theo/.rvm/rubies/jruby-1.6.5
@iconara
iconara / gist:1232610
Created September 21, 2011 16:44
Storm/Zookeeper errors
2011-09-21 18:43:41 ZooKeeper [INFO] Client environment:zookeeper.version=3.3.2-1031432, built on 11/05/2010 05:32 GMT
2011-09-21 18:43:41 ZooKeeper [INFO] Client environment:host.name=172.16.160.1
2011-09-21 18:43:41 ZooKeeper [INFO] Client environment:java.version=1.7.0-internal
2011-09-21 18:43:41 ZooKeeper [INFO] Client environment:java.vendor=Oracle Corporation
2011-09-21 18:43:41 ZooKeeper [INFO] Client environment:java.home=/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/jre
2011-09-21 18:43:41 ZooKeeper [INFO] Client environment:java.class.path=/Users/theo/Downloads/storm-0.5.0/lib/clj-time-0.3.0.jar:/Users/theo/Downloads/storm-0.5.0/lib/clojure-1.2.0.jar:/Users/theo/Downloads/storm-0.5.0/lib/clojure-contrib-1.2.0.jar:/Users/theo/Downloads/storm-0.5.0/lib/clout-0.4.1.jar:/Users/theo/Downloads/storm-0.5.0/lib/commons-cli-1.2.jar:/Users/theo/Downloads/storm-0.5.0/lib/commons-codec-1.3.jar:/Users/theo/Downloads/storm-0.5.0/lib/commons-el-1.0.jar:/Users/theo/Downloads/storm-0.5.0/lib/commons-exe
@iconara
iconara / mq_stats.rb
Created August 30, 2011 09:22
Show queue stats in pretty tables
require 'open-uri'
require 'json'
class Queue
def initialize(info)
@info = info
end
def name
--- Main.css 2011-07-07 16:17:44.000000000 +0200
+++ Main.css 2011-07-07 16:13:21.000000000 +0200
@@ -117,19 +117,19 @@
#Content {padding: 0 40px 40px 40px;}
.section {float: left; width: 280px; margin: 0 20px 20px 0;}
-.section h2 {margin: 0 0 20px 0; padding: 23px 25px; color: #fff; background-color: #00FF00;
+.section h2 {margin: 0 0 20px 0; padding: 23px 25px; color: #444; background-color: #00FF00;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;