memcached 0.8.1 → 0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/BENCHMARKS +59 -54
- data/CHANGELOG +2 -0
- data/COMPATIBILITY +1 -0
- data/README +3 -3
- data/TODO +2 -0
- data/ext/extconf.rb +12 -5
- data/ext/rlibmemcached.i +23 -10
- data/ext/rlibmemcached_wrap.c +4048 -3977
- data/lib/memcached/behaviors.rb +33 -15
- data/lib/memcached/exceptions.rb +1 -1
- data/lib/memcached/memcached.rb +35 -14
- data/memcached.gemspec +6 -4
- data/test/profile/benchmark.rb +35 -1
- data/test/test_helper.rb +0 -5
- data/test/unit/memcached_test.rb +75 -22
- data.tar.gz.sig +0 -0
- metadata +22 -7
- metadata.gz.sig +0 -0
data/BENCHMARKS
CHANGED
@@ -10,63 +10,68 @@ You can easily run your own benchmarks, as long as you have memcached itself on
|
|
10
10
|
These benchmarks were run on 32-bit Intel OS X 10.4:
|
11
11
|
|
12
12
|
user system total real
|
13
|
-
set:plain:noblock:memcached 0.120000 0.020000 0.140000 ( 0.
|
14
|
-
set:plain:memcached 0.
|
15
|
-
set:plain:memcache-client
|
16
|
-
set:ruby:noblock:memcached 0.190000 0.
|
17
|
-
set:ruby:memcached 0.
|
18
|
-
set:ruby:caffeine 5.
|
19
|
-
set:ruby:memcache-client
|
20
|
-
get:plain:memcached 0.
|
21
|
-
get:plain:memcache-client
|
22
|
-
get:ruby:memcached 0.410000 0.
|
23
|
-
get:ruby:caffeine 5.
|
24
|
-
get:ruby:memcache-client
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
missing:ruby:
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
mixed:ruby:
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
hash:
|
37
|
-
hash:
|
38
|
-
hash:
|
39
|
-
hash:
|
40
|
-
hash:
|
41
|
-
hash:
|
13
|
+
set:plain:noblock:memcached 0.120000 0.020000 0.140000 ( 0.307926)
|
14
|
+
set:plain:memcached 0.260000 0.340000 0.600000 ( 1.282603)
|
15
|
+
set:plain:memcache-client 46.690000 0.580000 47.270000 ( 48.749359)
|
16
|
+
set:ruby:noblock:memcached 0.190000 0.020000 0.210000 ( 0.346802)
|
17
|
+
set:ruby:memcached 0.370000 0.340000 0.710000 ( 1.396252)
|
18
|
+
set:ruby:caffeine 5.640000 0.890000 6.530000 ( 7.364335)
|
19
|
+
set:ruby:memcache-client 46.900000 0.580000 47.480000 ( 48.988299)
|
20
|
+
get:plain:memcached 0.300000 0.340000 0.640000 ( 1.273405)
|
21
|
+
get:plain:memcache-client 47.200000 0.570000 47.770000 ( 49.161767)
|
22
|
+
get:ruby:memcached 0.410000 0.350000 0.760000 ( 1.447452)
|
23
|
+
get:ruby:caffeine 5.560000 0.910000 6.470000 ( 7.207449)
|
24
|
+
get:ruby:memcache-client 47.230000 0.580000 47.810000 ( 51.481972)
|
25
|
+
multiget:ruby:memcached 0.160000 0.060000 0.220000 ( 0.363161)
|
26
|
+
multiget:ruby:caffeine 4.800000 0.550000 5.350000 ( 5.658651)
|
27
|
+
multiget:ruby:memcache-client 50.710000 0.410000 51.120000 ( 52.303405)
|
28
|
+
missing:ruby:memcached 0.430000 0.370000 0.800000 ( 1.358393)
|
29
|
+
missing:ruby:memcached:inline 0.360000 0.370000 0.730000 ( 1.353781)
|
30
|
+
missing:ruby:caffeine 4.740000 0.870000 5.610000 ( 6.320854)
|
31
|
+
missing:ruby:memcache-client 46.840000 0.570000 47.410000 ( 48.789416)
|
32
|
+
mixed:ruby:noblock:memcached 0.750000 0.910000 1.660000 ( 2.807438)
|
33
|
+
mixed:ruby:memcached 0.760000 0.690000 1.450000 ( 4.057959)
|
34
|
+
mixed:ruby:caffeine 8.730000 1.780000 10.510000 ( 13.515564)
|
35
|
+
mixed:ruby:memcache-client 95.450000 1.160000 96.610000 (100.632132)
|
36
|
+
hash:crc:memcached 1.240000 1.360000 2.600000 ( 5.149145)
|
37
|
+
hash:fnv1_32:memcached 1.260000 1.360000 2.620000 ( 5.333619)
|
38
|
+
hash:hsieh:memcached 1.150000 1.370000 2.520000 ( 6.256728)
|
39
|
+
hash:fnv1_64:memcached 1.220000 1.360000 2.580000 ( 5.188369)
|
40
|
+
hash:ketama:memcached 1.150000 1.360000 2.510000 ( 5.076080)
|
41
|
+
hash:md5:memcached 1.220000 1.360000 2.580000 ( 6.622163)
|
42
|
+
hash:default:memcached 1.190000 1.350000 2.540000 ( 5.185591)
|
43
|
+
hash:fnv1a_32:memcached 1.210000 1.360000 2.570000 ( 5.759699)
|
44
|
+
hash:fnv1a_64:memcached 1.180000 1.360000 2.540000 ( 5.097193)
|
42
45
|
|
43
46
|
== x86-64 Linux
|
44
47
|
|
45
48
|
These benchmarks were run on AMD64 RHEL4:
|
46
49
|
|
47
50
|
user system total real
|
48
|
-
set:plain:noblock:memcached 0.
|
49
|
-
set:plain:memcached 0.
|
50
|
-
set:plain:memcache-client 13.
|
51
|
-
set:ruby:noblock:memcached 0.
|
52
|
-
set:ruby:memcached 0.210000 0.
|
53
|
-
set:ruby:memcache-client 13.
|
54
|
-
get:plain:memcached 0.
|
55
|
-
get:plain:memcache-client 14.
|
56
|
-
get:ruby:memcached 0.
|
57
|
-
get:ruby:memcache-client 14.
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
hash:
|
67
|
-
hash:
|
68
|
-
hash:
|
69
|
-
hash:
|
70
|
-
hash:
|
71
|
-
hash:
|
72
|
-
|
51
|
+
set:plain:noblock:memcached 0.110000 0.010000 0.120000 ( 1.350748)
|
52
|
+
set:plain:memcached 0.120000 0.350000 0.470000 ( 0.772407)
|
53
|
+
set:plain:memcache-client 13.670000 0.190000 13.860000 ( 14.266996)
|
54
|
+
set:ruby:noblock:memcached 0.160000 0.020000 0.180000 ( 2.259853)
|
55
|
+
set:ruby:memcached 0.210000 0.320000 0.530000 ( 0.841844)
|
56
|
+
set:ruby:memcache-client 13.710000 0.190000 13.900000 ( 14.249961)
|
57
|
+
get:plain:memcached 0.170000 0.270000 0.440000 ( 0.754607)
|
58
|
+
get:plain:memcache-client 14.200000 0.220000 14.420000 ( 14.761720)
|
59
|
+
get:ruby:memcached 0.230000 0.310000 0.540000 ( 0.847958)
|
60
|
+
get:ruby:memcache-client 14.170000 0.230000 14.400000 ( 14.804035)
|
61
|
+
multiget:ruby:memcached 0.070000 0.010000 0.080000 ( 0.177625)
|
62
|
+
multiget:ruby:memcache-client 14.860000 0.080000 14.940000 ( 15.092570)
|
63
|
+
missing:ruby:memcached 0.270000 0.310000 0.580000 ( 0.856026)
|
64
|
+
missing:ruby:memcached:inline 0.280000 0.300000 0.580000 ( 0.871487)
|
65
|
+
missing:ruby:memcache-client 14.110000 0.250000 14.360000 ( 14.765192)
|
66
|
+
mixed:ruby:noblock:memcached 0.480000 0.520000 1.000000 ( 1.615341)
|
67
|
+
mixed:ruby:memcached 0.520000 0.590000 1.110000 ( 1.668772)
|
68
|
+
mixed:ruby:memcache-client 27.710000 0.430000 28.140000 ( 28.788336)
|
69
|
+
hash:crc:memcached 0.790000 1.180000 1.970000 ( 3.041880)
|
70
|
+
hash:fnv1a_64:memcached 0.760000 1.060000 1.820000 ( 3.010219)
|
71
|
+
hash:fnv1_32:memcached 0.800000 1.050000 1.850000 ( 3.006838)
|
72
|
+
hash:fnv1_64:memcached 0.710000 1.260000 1.970000 ( 3.016661)
|
73
|
+
hash:default:memcached 0.660000 1.120000 1.780000 ( 3.115817)
|
74
|
+
hash:hsieh:memcached 0.620000 1.070000 1.690000 ( 3.106407)
|
75
|
+
hash:ketama:memcached 0.680000 1.180000 1.860000 ( 3.046879)
|
76
|
+
hash:md5:memcached 0.700000 1.130000 1.830000 ( 3.009488)
|
77
|
+
hash:fnv1a_32:memcached 0.620000 1.310000 1.930000 ( 3.027653)
|
data/CHANGELOG
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
|
2
|
+
v0.9. Move to libmemcached 0.19. Add some failover tests, but we are still waiting on libmemcached's replication branch for them to actually be useful. Fix CAS bug (ktheory).
|
3
|
+
|
2
4
|
v0.8.1. Disable NotFound backtraces for speed (Blaine Cook).
|
3
5
|
|
4
6
|
v0.8. CAS support. Update to libmemcached 0.16.
|
data/COMPATIBILITY
CHANGED
data/README
CHANGED
@@ -22,14 +22,14 @@ The <b>memcached</b> library wraps the pure-C libmemcached client via SWIG.
|
|
22
22
|
|
23
23
|
== Installation
|
24
24
|
|
25
|
-
You need Ruby 1.8.6, and {libmemcached 0.
|
25
|
+
You need Ruby 1.8.6, and {libmemcached 0.19}[http://tangent.org/552/libmemcached.html]. Other versions are not supported. You also need {memcached itself}[http://www.danga.com/memcached/] if you want to test against a local server.
|
26
26
|
|
27
|
-
For Linux, download and extract the {libmemcached tarball}[http://download.tangent.org/libmemcached-0.
|
27
|
+
For Linux, download and extract the {libmemcached tarball}[http://download.tangent.org/libmemcached-0.19.tar.gz]. Then run:
|
28
28
|
./configure
|
29
29
|
make && sudo make install
|
30
30
|
|
31
31
|
For OS X, you may be able to install it from MacPorts:
|
32
|
-
sudo port install libmemcached @0.
|
32
|
+
sudo port install libmemcached @0.19_0
|
33
33
|
|
34
34
|
Now install the gem:
|
35
35
|
sudo gem install memcached --no-rdoc --no-ri
|
data/TODO
CHANGED
data/ext/extconf.rb
CHANGED
@@ -18,11 +18,18 @@ end
|
|
18
18
|
dir_config 'rlibmemcached'
|
19
19
|
|
20
20
|
# XXX There's probably a better way to do this
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
raise "shared library 'libmemcached' not found" unless
|
22
|
+
find_library('memcached', 'memcached_server_add', *ENV['LD_LIBRARY_PATH'].to_s.split(":"))
|
23
|
+
|
24
|
+
[
|
25
|
+
'libmemcached/memcached.h',
|
26
|
+
'libmemcached/memcached_constants.h',
|
27
|
+
'libmemcached/memcached_storage.h',
|
28
|
+
'libmemcached/memcached_result.h',
|
29
|
+
'libmemcached/memcached_server.h'
|
30
|
+
].each do |header|
|
31
|
+
raise "header file '#{include}' not found" unless
|
32
|
+
find_header(header, *ENV['INCLUDE_PATH'].to_s.split(":"))
|
26
33
|
end
|
27
34
|
|
28
35
|
create_makefile 'rlibmemcached'
|
data/ext/rlibmemcached.i
CHANGED
@@ -16,14 +16,7 @@
|
|
16
16
|
%apply unsigned short { uint8_t };
|
17
17
|
%apply unsigned int { uint16_t };
|
18
18
|
%apply unsigned long { uint32_t flags, uint32_t offset };
|
19
|
-
|
20
|
-
|
21
|
-
// For behavior's set interface
|
22
|
-
%typemap(in) (void *data) {
|
23
|
-
int value = FIX2INT($input);
|
24
|
-
// printf("%d\n", value);
|
25
|
-
$1 = &value;
|
26
|
-
};
|
19
|
+
%apply unsigned long long {uint64_t data, uint64_t cas };
|
27
20
|
|
28
21
|
// Array of strings map for multiget
|
29
22
|
%typemap(in) (char **keys, size_t *key_length, unsigned int number_of_keys) {
|
@@ -54,14 +47,26 @@
|
|
54
47
|
(char *value, size_t value_length)
|
55
48
|
};
|
56
49
|
|
50
|
+
// Key strings with same master key
|
51
|
+
// XXX This will have to go once people start doing client-side replication and actually need to set the master key
|
52
|
+
%typemap(in) (char *master_key, size_t master_key_length, char *key, size_t key_length) {
|
53
|
+
$3 = $1 = STR2CSTR($input);
|
54
|
+
$4 = $2 = (size_t) RSTRING($input)->len;
|
55
|
+
};
|
56
|
+
|
57
|
+
|
57
58
|
//// Output maps
|
58
59
|
|
59
|
-
/* %apply unsigned long long { uint64_t cas }; */
|
60
60
|
%apply unsigned short *OUTPUT {memcached_return *error}
|
61
61
|
%apply unsigned int *OUTPUT {uint32_t *flags}
|
62
62
|
%apply size_t *OUTPUT {size_t *value_length}
|
63
63
|
%apply unsigned long long *OUTPUT {uint64_t *value}
|
64
64
|
|
65
|
+
// Uint64
|
66
|
+
%typemap(out) (uint64_t) {
|
67
|
+
$result = INT2FIX($1);
|
68
|
+
};
|
69
|
+
|
65
70
|
// String
|
66
71
|
%typemap(in, numinputs=0) (char *key, size_t *key_length) {
|
67
72
|
char string[256];
|
@@ -88,12 +93,17 @@
|
|
88
93
|
free($1);
|
89
94
|
};
|
90
95
|
|
96
|
+
//// SWIG includes, for functions, constants, and structs
|
97
|
+
|
91
98
|
%include "/opt/local/include/libmemcached/memcached.h"
|
99
|
+
%include "/opt/local/include/libmemcached/memcached_constants.h"
|
100
|
+
%include "/opt/local/include/libmemcached/memcached_storage.h"
|
101
|
+
%include "/opt/local/include/libmemcached/memcached_result.h"
|
102
|
+
%include "/opt/local/include/libmemcached/memcached_server.h"
|
92
103
|
|
93
104
|
//// Custom C functions
|
94
105
|
|
95
106
|
// Namespace and validate key. We could avoid several more dispatches and allocations if we called this from the libmemcached wrappers directly.
|
96
|
-
|
97
107
|
VALUE ns(char *namespace, size_t namespace_length, char *key, size_t key_length);
|
98
108
|
%{
|
99
109
|
VALUE ns(char *namespace, size_t namespace_length, char *key, size_t key_length) {
|
@@ -180,3 +190,6 @@ memcached_stat_st *memcached_select_stat_at(memcached_st *in_ptr, memcached_stat
|
|
180
190
|
return &(stat_ptr[index]);
|
181
191
|
};
|
182
192
|
%}
|
193
|
+
|
194
|
+
// Expose the hash generation function, which is not included in any header
|
195
|
+
unsigned int memcached_generate_hash(memcached_st *ptr, char *key, size_t key_length);
|