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 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.368084)
14
- set:plain:memcached 0.270000 0.340000 0.610000 ( 1.499177)
15
- set:plain:memcache-client 47.310000 0.670000 47.980000 ( 50.628096)
16
- set:ruby:noblock:memcached 0.190000 0.010000 0.200000 ( 0.354409)
17
- set:ruby:memcached 0.380000 0.340000 0.720000 ( 1.454480)
18
- set:ruby:caffeine 5.570000 0.890000 6.460000 ( 7.456010)
19
- set:ruby:memcache-client 48.340000 0.770000 49.110000 ( 52.899929)
20
- get:plain:memcached 0.350000 0.330000 0.680000 ( 1.410108)
21
- get:plain:memcache-client 48.000000 0.670000 48.670000 ( 51.532252)
22
- get:ruby:memcached 0.410000 0.340000 0.750000 ( 1.432786)
23
- get:ruby:caffeine 5.480000 0.910000 6.390000 ( 7.269396)
24
- get:ruby:memcache-client 48.320000 0.770000 49.090000 ( 52.790661)
25
- missing:ruby:memcached 0.420000 0.370000 0.790000 ( 1.458207)
26
- missing:ruby:memcached:inline 0.430000 0.370000 0.800000 ( 1.633660)
27
- missing:ruby:caffeine 5.270000 0.900000 6.170000 ( 7.442863)
28
- missing:ruby:memcache-client 48.270000 0.750000 49.020000 ( 53.028126)
29
- mixed:ruby:noblock:memcached 0.760000 0.900000 1.660000 ( 2.935532)
30
- mixed:ruby:memcached 0.770000 0.670000 1.440000 ( 2.891710)
31
- mixed:ruby:caffeine 9.850000 1.780000 11.630000 ( 13.339650)
32
- mixed:ruby:memcache-client 97.490000 1.460000 98.950000 (105.600490)
33
- hash:fnv1_32:memcached 1.270000 1.350000 2.620000 ( 5.557949)
34
- hash:fnv1_64:memcached 1.200000 1.350000 2.550000 ( 5.446442)
35
- hash:hsieh:memcached 1.210000 1.360000 2.570000 ( 5.365423)
36
- hash:md5:memcached 1.250000 1.340000 2.590000 ( 5.457329)
37
- hash:default:memcached 1.220000 1.340000 2.560000 ( 5.455361)
38
- hash:ketama:memcached 1.170000 1.350000 2.520000 ( 5.361789)
39
- hash:fnv1a_64:memcached 1.240000 1.350000 2.590000 ( 5.389261)
40
- hash:fnv1a_32:memcached 1.180000 1.350000 2.530000 ( 5.332386)
41
- hash:crc:memcached 1.220000 1.350000 2.570000 ( 5.460113)
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.100000 0.010000 0.110000 ( 3.387985)
49
- set:plain:memcached 0.160000 0.310000 0.470000 ( 0.744728)
50
- set:plain:memcache-client 13.710000 0.110000 13.820000 ( 14.021691)
51
- set:ruby:noblock:memcached 0.170000 0.000000 0.170000 ( 3.513274)
52
- set:ruby:memcached 0.210000 0.380000 0.590000 ( 0.812180)
53
- set:ruby:memcache-client 13.600000 0.220000 13.820000 ( 14.232239)
54
- get:plain:memcached 0.150000 0.310000 0.460000 ( 0.747339)
55
- get:plain:memcache-client 14.020000 0.290000 14.310000 ( 14.706064)
56
- get:ruby:memcached 0.320000 0.250000 0.570000 ( 0.828972)
57
- get:ruby:memcache-client 14.050000 0.220000 14.270000 ( 14.648995)
58
- missing:ruby:memcached 0.530000 0.280000 0.810000 ( 1.117403)
59
- missing:ruby:memcache-client 13.660000 0.200000 13.860000 ( 14.315195)
60
- mixed:ruby:noblock:memcached 0.500000 0.490000 0.990000 ( 1.541679)
61
- mixed:ruby:memcached 0.470000 0.550000 1.020000 ( 1.691884)
62
- mixed:ruby:memcache-client 27.640000 0.480000 28.120000 ( 28.921745)
63
- hash:crc:memcached 0.650000 1.200000 1.850000 ( 3.112681)
64
- hash:fnv1_32:memcached 0.660000 1.140000 1.800000 ( 2.985026)
65
- hash:fnv1_64:memcached 0.630000 1.280000 1.910000 ( 3.027491)
66
- hash:default:memcached 0.680000 1.120000 1.800000 ( 2.991388)
67
- hash:hsieh:memcached 0.760000 1.220000 1.980000 ( 3.074890)
68
- hash:fnv1a_32:memcached 0.680000 1.190000 1.870000 ( 2.996147)
69
- hash:md5:memcached 0.650000 1.230000 1.880000 ( 3.126424)
70
- hash:ketama:memcached 0.650000 1.200000 1.850000 ( 3.062838)
71
- hash:fnv1a_64:memcached 0.610000 1.300000 1.910000 ( 3.030487)
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
@@ -4,6 +4,7 @@
4
4
  This chart shows which versions of the Ruby library are compatible with which versions of libmemcached.
5
5
 
6
6
  <b>Library version</b>:: <b>libmemcached version</b>
7
+ 0.9:: 0.19
7
8
  0.8:: 0.16
8
9
  0.7:: 0.15
9
10
  0.6:: 0.13
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.16}[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.
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.16.tar.gz]. Then run:
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.16_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
@@ -1,2 +1,4 @@
1
1
 
2
+ * Test consistent hashing
2
3
  * Verify libmemcached version
4
+ * Support hostname looks with caching behavior
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
- unless find_library 'memcached', 'memcached_server_add', *ENV['LD_LIBRARY_PATH'].to_s.split(":")
22
- raise "shared library 'libmemcached' not found"
23
- end
24
- unless find_header 'libmemcached/memcached.h', *ENV['INCLUDE_PATH'].to_s.split(":")
25
- raise "header file 'libmemcached/memcached.h' not found"
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
- /* %apply unsigned long long { uint64_t cas }; */
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);