Skip to content

Instantly share code, notes, and snippets.

@sreeix
sreeix / test.rb
Created October 10, 2011 14:06
test for custom benchmarking
class Foo
include CustomBenchmarking
def bar
print '.'
end
benchmarking :bar
end
puts ObjectSpace.count_objects
1000000.times {|x| Foo.new.bar}
@sreeix
sreeix / Results Over various scenarios
Created November 13, 2011 10:36
Randomizing in Ruby with Redis/Cycle/Kernel.rand
althea/spaghetti/sf[cycling_email_addresses]% ruby script/random_test.rb
#################################################################
At 10 elements
------------------Redis Random-----------------------
[["[email protected]", 0.4], ["[email protected]", 0.4], ["[email protected]", 0.1], ["[email protected]", 0.1]]
------------------Cycle-----------------------
[["[email protected]", 0.3], ["[email protected]", 0.3], ["[email protected]", 0.2], ["[email protected]", 0.2]]
------------------Randomm Ruby-----------------------
[["[email protected]", 0.2], ["[email protected]", 0.4], ["[email protected]", 0.3], ["[email protected]", 0.1]]
#################################################################
@sreeix
sreeix / aggressive.txt
Created November 22, 2011 13:08
benchmarking with multiple my.cnf values.
key_buffer = 384M
max_allowed_packet = 1M
table_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 64M
@sreeix
sreeix / Result
Created November 28, 2011 16:54
Threads are hard
$ rails/runner foo.rb
1
2
3
4
5
6
7
@sreeix
sreeix / JSFoo Birds of Feather.md
Created February 3, 2012 17:47
Node.js Birds of Feather at JSFoo Chennai.

Hi,

This is sreekanth, I had done a Node.js talk at JSFoo.

One of the strong impressions from JSFoo Pune was the conversations in the session and outside of the session, between me and other people on the sidelines and the blogs was around

Node.js. As a scalability Solution., or weather it is faster than Ruby, or How node.js's reactor is better or worse than Erlang's Actors/share nothing processes vs threading.

There seems to be a lot FUD and very little concrete numbers around those conversations. I was thinking if there is a full on debate, maybe moderated or maybe in the BOF session

@sreeix
sreeix / cassandra_benchmark.rb
Created February 9, 2012 15:31
cassandra benchmarking code
require 'benchmark'
require 'cassandra/0.7'
@client = Cassandra.new('Search', '127.0.0.1:9160')
@json = JSON.parse(File.read("coupon.json"))
@index = 0
def create_coupon
@index += 1
@client.insert(:Coupon, @index.to_s, @json)
end
@sreeix
sreeix / gist:1790221
Created February 10, 2012 15:18
My New publickey
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDZIQY04o7NdG4QmJ3uMSYWV06fYDYIDhqyGGswItkzC52Zf5FirAblJO6ypgGjPN/Ivo69sZPR5NMxwNV9RhUw9f4NEuYc2vZuhXUXdgZhWBXGtI9FykkStpG9VBp/8ZF1GUQmxcDqoLYT3P1vLMkUU5f54C6OakHtOp3WvqeZmQLwfuBy6szRVQQaxj4+ySZw/T4p/lVe5ODhQWytxbFXxQiaiZ2VHMKCpV7zhECfmTCmK/pINJVIU1d77inuuU6RUJrRtjh0Msdx3Qez7vE6FCQK7iBYJPpGFj9fqTqablWglom4dDc/bDznjHg+7RaTPjugL+NceZD0S03HLAg1 [email protected]
@sreeix
sreeix / screen.txt
Created February 10, 2012 17:04
screen reference
screen -ls --> see current screens and states
screen -r <screenid> --> attach to a detached screen
screen -x <screenid> --> share an attached screen
screen -S <name> -> Create a new screen
inside screen:
ctrl+an, ctrl+pn to go to next and previous windows
ctrl+d to detach when you're finished
ctrl+ac to create a new window
ctrl+ad to detach from screen
@sreeix
sreeix / Gemfile
Created February 20, 2012 07:19
Benchmarks Memcache
source :rubygems
gem "dalli", "~> 1.0.4", :require => ['dalli']
gem "trollop"
gem "statsample"
# gem "kgio"
@sreeix
sreeix / install_redis.md
Created February 21, 2012 19:48
Our Standard Redis Server Setup
# Redis configuration file example
# Note on units: when memory size is needed, it is possible to specifiy
# it in the usual form of 1k 5GB 4M and so forth:
#
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes