This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
Tokyo::TyrantTable (Ruby FFI) | |
user system total real | |
inserting data 0.840000 0.190000 1.030000 ( 3.214565) | |
reading data 1.310000 0.210000 1.520000 ( 3.024142) | |
TokyoTyrant::RDB (Ruby) | |
user system total real | |
inserting data 1.170000 0.240000 1.410000 ( 2.859321) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
Tokyo::Tyrant (Ruby FFI) | |
user system total real | |
inserting data 0.140000 0.180000 0.320000 ( 1.208150) | |
reading data 0.240000 0.170000 0.410000 ( 1.467640) | |
TokyoTyrant::RDB (Ruby) | |
user system total real | |
inserting data 0.300000 0.170000 0.470000 ( 1.481900) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ab -c 100 -n 1000 http://0.0.0.0:9292/1 | |
This is ApacheBench, Version 2.3 <$Revision: 655654 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking 0.0.0.0 (be patient) | |
Completed 100 requests | |
Completed 200 requests | |
Completed 300 requests | |
Completed 400 requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
Tokyo Tyrant Bulk Operations Benchmark | |
TokyoTyrant::RDB (Ruby) mget | |
user system total real | |
inserting data 7.770000 1.870000 9.640000 ( 12.598373) | |
reading data 1.540000 0.250000 1.790000 ( 2.290628) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
Tokyo Tyrant Bulk Table Operations Benchmark | |
TokyoTyrant (C) | |
user system total real | |
bulk writing data 0.180000 0.000000 0.180000 ( 0.292081) | |
bulk reading data 0.120000 0.020000 0.140000 ( 0.216074) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# use this to install the same gems you have installed under one ruby in another | |
# run "gem list > ~/Desktop/gems.txt" | |
# run "ruby install_gems.rb /Users/r38y/Desktop/gems.txt" | |
gems = IO.readlines(ARGV.first) | |
gems.map! do |g| | |
stuff = g.split(' ') | |
gem_name = stuff.delete_at(0) | |
stuff.map{|v| v.gsub(/[\(\)\,]/, '')}.map{|v| "sudo gem install #{gem_name} -v=#{v}"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# URL shortener used to benchmark redis-rb and RubyRedis applied to ruby-tokyotyrant | |
# Script takes 1.2 seconds | |
require 'rubygems' | |
require 'benchmark' | |
require 'tokyo_tyrant' | |
puts Benchmark.realtime{ | |
T=TokyoTyrant::DB.new('127.0.0.1', 45000) | |
def shorten(url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'tokyo_tyrant' | |
t = TokyoTyrant::Table.new('127.0.0.1', 1978) | |
100.times do |i| | |
t[i] = { 'name' => "Pat #{i}", 'sex' => i % 2 > 0 ? 'male' : 'female' } | |
end | |
q = t.query | |
q.condition('sex', :streq, 'male') | |
q.limit(5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'tokyo_tyrant' | |
$tyrant = TokyoTyrant::Table.new | |
module Cacheable | |
module TyrantTable | |
def self.included(base) #:nodoc: | |
super | |
base.class_eval %q{ | |
cattr_accessor :cache_records | |
@@cache_records = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tyrannical | |
require 'tokyo_tyrant' | |
class TrueClass | |
def to_tokyo_tyrant;"1";end | |
end | |
class FalseClass | |
def to_tokyo_tyrant;"0";end |
OlderNewer