memcached 0.6 → 0.7
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/BENCHMARKS +101 -0
- data/CHANGELOG +2 -0
- data/COMPATIBILITY +9 -0
- data/Manifest +9 -5
- data/README +13 -25
- data/TODO +1 -8
- data/ext/extconf.rb +8 -4
- data/ext/rlibmemcached.i +156 -0
- data/ext/{libmemcached_wrap.c → rlibmemcached_wrap.c} +890 -585
- data/lib/memcached.rb +8 -7
- data/lib/memcached/behaviors.rb +4 -4
- data/lib/memcached/exceptions.rb +7 -4
- data/lib/memcached/memcached.rb +82 -49
- data/lib/memcached/rails.rb +55 -0
- data/memcached.gemspec +14 -6
- data/test/profile/benchmark.rb +371 -0
- data/test/profile/profile.rb +14 -0
- data/test/profile/valgrind.rb +133 -0
- data/test/unit/binding_test.rb +1 -1
- data/test/unit/memcached_test.rb +67 -15
- data/test/unit/rails_test.rb +72 -0
- metadata +12 -7
- metadata.gz.sig +0 -0
- data/ext/libmemcached.i +0 -107
- data/test/benchmark/benchmark.rb +0 -259
- data/test/benchmark/benchmark_set_get.rb +0 -56
- data/test/benchmark/profile.rb +0 -49
@@ -1,56 +0,0 @@
|
|
1
|
-
|
2
|
-
HERE = File.dirname(__FILE__)
|
3
|
-
$LOAD_PATH << "#{HERE}/../../lib/"
|
4
|
-
|
5
|
-
require 'memcached'
|
6
|
-
require 'benchmark'
|
7
|
-
|
8
|
-
@value = []
|
9
|
-
@marshalled = Marshal.dump(@value)
|
10
|
-
|
11
|
-
@opts = [
|
12
|
-
['127.0.0.1:43042', '127.0.0.1:43043'],
|
13
|
-
{
|
14
|
-
:buffer_requests => true,
|
15
|
-
:no_block => true,
|
16
|
-
:namespace => "benchmark_namespace"
|
17
|
-
}
|
18
|
-
]
|
19
|
-
@key1 = "Short"
|
20
|
-
@key2 = "Sym1-2-3::45"*8
|
21
|
-
@key3 = "Long"*40
|
22
|
-
@key4 = "Medium"*8
|
23
|
-
|
24
|
-
def restart_servers
|
25
|
-
system("ruby #{HERE}/../setup.rb")
|
26
|
-
sleep(1)
|
27
|
-
end
|
28
|
-
|
29
|
-
Benchmark.bm(31) do |x|
|
30
|
-
n = 3000
|
31
|
-
restart_servers
|
32
|
-
|
33
|
-
@m = Memcached.new(*@opts)
|
34
|
-
x.report("set:ruby:memcached") do
|
35
|
-
n.times do
|
36
|
-
@m.set @key1, @value
|
37
|
-
@m.set @key2, @value
|
38
|
-
@m.set @key3, @value
|
39
|
-
@m.set @key1, @value
|
40
|
-
@m.set @key2, @value
|
41
|
-
@m.set @key3, @value
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
@m = Memcached.new(*@opts)
|
46
|
-
x.report("get:ruby:memcached") do
|
47
|
-
n.times do
|
48
|
-
@m.get @key1
|
49
|
-
@m.get @key2
|
50
|
-
@m.get @key3
|
51
|
-
@m.get @key1
|
52
|
-
@m.get @key2
|
53
|
-
@m.get @key3
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
data/test/benchmark/profile.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
|
2
|
-
HERE = File.dirname(__FILE__)
|
3
|
-
$LOAD_PATH << "#{HERE}/../../lib/"
|
4
|
-
|
5
|
-
require 'memcached'
|
6
|
-
require 'ostruct'
|
7
|
-
require 'benchmark'
|
8
|
-
require 'rubygems'
|
9
|
-
require 'ruby-prof'
|
10
|
-
|
11
|
-
@value = []
|
12
|
-
@marshalled = Marshal.dump(@value)
|
13
|
-
@opts = [
|
14
|
-
['127.0.0.1:43042', '127.0.0.1:43043'],
|
15
|
-
{
|
16
|
-
:buffer_requests => true,
|
17
|
-
:no_block => true,
|
18
|
-
:namespace => "benchmark_namespace"
|
19
|
-
}
|
20
|
-
]
|
21
|
-
@key1 = "Short"
|
22
|
-
@key2 = "Sym1-2-3::45"*8
|
23
|
-
@key3 = "Long"*40
|
24
|
-
@key4 = "Medium"*8
|
25
|
-
|
26
|
-
system("ruby #{HERE}/../setup.rb")
|
27
|
-
sleep(1)
|
28
|
-
|
29
|
-
@m = Memcached.new(*@opts)
|
30
|
-
|
31
|
-
result = RubyProf.profile do
|
32
|
-
1000.times do
|
33
|
-
@m.set @key1, @value
|
34
|
-
@m.set @key2, @value
|
35
|
-
@m.set @key3, @value
|
36
|
-
@m.get @key1
|
37
|
-
@m.get @key2
|
38
|
-
@m.get @key3
|
39
|
-
@m.set @key1, @value
|
40
|
-
@m.get @key1
|
41
|
-
@m.set @key2, @value
|
42
|
-
@m.get @key2
|
43
|
-
@m.set @key3, @value
|
44
|
-
@m.get @key3
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
printer = RubyProf::GraphPrinter.new(result)
|
49
|
-
printer.print(STDOUT, 0)
|