nutcracker 0.4.0.16 → 0.4.1.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +3 -3
  3. data/ext/nutcracker/ChangeLog +33 -8
  4. data/ext/nutcracker/Makefile.in +34 -21
  5. data/ext/nutcracker/README.md +61 -26
  6. data/ext/nutcracker/aclocal.m4 +34 -31
  7. data/ext/nutcracker/autom4te.cache/output.0 +1875 -1330
  8. data/ext/nutcracker/autom4te.cache/output.1 +1875 -1330
  9. data/ext/nutcracker/autom4te.cache/requests +232 -451
  10. data/ext/nutcracker/autom4te.cache/traces.0 +2256 -2129
  11. data/ext/nutcracker/autom4te.cache/traces.1 +73 -59
  12. data/ext/nutcracker/config.h.in +1 -2
  13. data/ext/nutcracker/config.h.in~ +333 -0
  14. data/ext/nutcracker/config/compile +1 -1
  15. data/ext/nutcracker/config/config.guess +13 -160
  16. data/ext/nutcracker/config/config.sub +25 -11
  17. data/ext/nutcracker/config/depcomp +1 -1
  18. data/ext/nutcracker/config/install-sh +170 -196
  19. data/ext/nutcracker/config/ltmain.sh +3509 -2018
  20. data/ext/nutcracker/config/missing +1 -1
  21. data/ext/nutcracker/configure +1874 -1329
  22. data/ext/nutcracker/configure.ac +3 -2
  23. data/ext/nutcracker/contrib/Makefile.in +18 -5
  24. data/ext/nutcracker/contrib/yaml-0.1.4/LICENSE +19 -0
  25. data/ext/nutcracker/contrib/yaml-0.1.4/Makefile.am +20 -0
  26. data/ext/nutcracker/contrib/yaml-0.1.4/Makefile.in +832 -0
  27. data/ext/nutcracker/contrib/yaml-0.1.4/README +27 -0
  28. data/ext/nutcracker/contrib/yaml-0.1.4/aclocal.m4 +1157 -0
  29. data/ext/nutcracker/contrib/yaml-0.1.4/autom4te.cache/output.0 +13342 -0
  30. data/ext/nutcracker/contrib/yaml-0.1.4/autom4te.cache/output.1 +14611 -0
  31. data/ext/nutcracker/{autom4te.cache → contrib/yaml-0.1.4/autom4te.cache}/output.2 +3465 -8761
  32. data/ext/nutcracker/contrib/yaml-0.1.4/autom4te.cache/requests +516 -0
  33. data/ext/nutcracker/{autom4te.cache/traces.2 → contrib/yaml-0.1.4/autom4te.cache/traces.0} +662 -698
  34. data/ext/nutcracker/contrib/yaml-0.1.4/autom4te.cache/traces.1 +577 -0
  35. data/ext/nutcracker/contrib/yaml-0.1.4/autom4te.cache/traces.2 +2721 -0
  36. data/ext/nutcracker/contrib/yaml-0.1.4/config.h.in +79 -0
  37. data/ext/nutcracker/contrib/yaml-0.1.4/config.h.in~ +80 -0
  38. data/ext/nutcracker/contrib/yaml-0.1.4/config/compile +347 -0
  39. data/ext/nutcracker/contrib/yaml-0.1.4/config/config.guess +1421 -0
  40. data/ext/nutcracker/contrib/yaml-0.1.4/config/config.sub +1807 -0
  41. data/ext/nutcracker/contrib/yaml-0.1.4/config/depcomp +791 -0
  42. data/ext/nutcracker/contrib/yaml-0.1.4/config/install-sh +501 -0
  43. data/ext/nutcracker/contrib/yaml-0.1.4/config/ltmain.sh +11147 -0
  44. data/ext/nutcracker/contrib/yaml-0.1.4/config/missing +215 -0
  45. data/ext/nutcracker/contrib/yaml-0.1.4/config/test-driver +148 -0
  46. data/ext/nutcracker/contrib/yaml-0.1.4/configure +14611 -0
  47. data/ext/nutcracker/contrib/yaml-0.1.4/configure.ac +75 -0
  48. data/ext/nutcracker/contrib/yaml-0.1.4/doc/doxygen.cfg +222 -0
  49. data/ext/nutcracker/contrib/yaml-0.1.4/include/yaml.h +1971 -0
  50. data/ext/nutcracker/contrib/yaml-0.1.4/m4/libtool.m4 +8369 -0
  51. data/ext/nutcracker/contrib/yaml-0.1.4/m4/ltoptions.m4 +437 -0
  52. data/ext/nutcracker/contrib/yaml-0.1.4/m4/ltsugar.m4 +124 -0
  53. data/ext/nutcracker/contrib/yaml-0.1.4/m4/ltversion.m4 +23 -0
  54. data/ext/nutcracker/contrib/yaml-0.1.4/m4/lt~obsolete.m4 +99 -0
  55. data/ext/nutcracker/contrib/yaml-0.1.4/src/Makefile.am +4 -0
  56. data/ext/nutcracker/contrib/yaml-0.1.4/src/Makefile.in +600 -0
  57. data/ext/nutcracker/contrib/yaml-0.1.4/src/api.c +1392 -0
  58. data/ext/nutcracker/contrib/yaml-0.1.4/src/dumper.c +394 -0
  59. data/ext/nutcracker/contrib/yaml-0.1.4/src/emitter.c +2329 -0
  60. data/ext/nutcracker/contrib/yaml-0.1.4/src/loader.c +432 -0
  61. data/ext/nutcracker/contrib/yaml-0.1.4/src/parser.c +1374 -0
  62. data/ext/nutcracker/contrib/yaml-0.1.4/src/reader.c +465 -0
  63. data/ext/nutcracker/contrib/yaml-0.1.4/src/scanner.c +3570 -0
  64. data/ext/nutcracker/contrib/yaml-0.1.4/src/writer.c +141 -0
  65. data/ext/nutcracker/contrib/yaml-0.1.4/src/yaml_private.h +640 -0
  66. data/ext/nutcracker/contrib/yaml-0.1.4/tests/Makefile.am +8 -0
  67. data/ext/nutcracker/contrib/yaml-0.1.4/tests/Makefile.in +1083 -0
  68. data/ext/nutcracker/contrib/yaml-0.1.4/tests/example-deconstructor-alt.c +800 -0
  69. data/ext/nutcracker/contrib/yaml-0.1.4/tests/example-deconstructor.c +1130 -0
  70. data/ext/nutcracker/contrib/yaml-0.1.4/tests/example-reformatter-alt.c +217 -0
  71. data/ext/nutcracker/contrib/yaml-0.1.4/tests/example-reformatter.c +202 -0
  72. data/ext/nutcracker/contrib/yaml-0.1.4/tests/run-dumper.c +311 -0
  73. data/ext/nutcracker/contrib/yaml-0.1.4/tests/run-emitter.c +327 -0
  74. data/ext/nutcracker/contrib/yaml-0.1.4/tests/run-loader.c +63 -0
  75. data/ext/nutcracker/contrib/yaml-0.1.4/tests/run-parser.c +63 -0
  76. data/ext/nutcracker/contrib/yaml-0.1.4/tests/run-scanner.c +63 -0
  77. data/ext/nutcracker/contrib/yaml-0.1.4/tests/test-reader.c +354 -0
  78. data/ext/nutcracker/contrib/yaml-0.1.4/tests/test-version.c +29 -0
  79. data/ext/nutcracker/m4/libtool.m4 +1474 -1087
  80. data/ext/nutcracker/m4/ltoptions.m4 +90 -37
  81. data/ext/nutcracker/m4/ltsugar.m4 +4 -3
  82. data/ext/nutcracker/m4/ltversion.m4 +6 -6
  83. data/ext/nutcracker/m4/lt~obsolete.m4 +4 -3
  84. data/ext/nutcracker/man/nutcracker.8 +1 -1
  85. data/ext/nutcracker/notes/memcache.md +162 -0
  86. data/ext/nutcracker/notes/recommendation.md +10 -5
  87. data/ext/nutcracker/notes/redis.md +23 -9
  88. data/ext/nutcracker/scripts/nutcracker.init +10 -0
  89. data/ext/nutcracker/scripts/nutcracker.init.debian +83 -0
  90. data/ext/nutcracker/scripts/nutcracker.spec +36 -2
  91. data/ext/nutcracker/scripts/redis-check.sh +4 -0
  92. data/ext/nutcracker/src/Makefile.am +6 -1
  93. data/ext/nutcracker/src/Makefile.in +26 -12
  94. data/ext/nutcracker/src/event/Makefile.in +19 -6
  95. data/ext/nutcracker/src/hashkit/Makefile.in +19 -6
  96. data/ext/nutcracker/src/hashkit/nc_jenkins.c +1 -1
  97. data/ext/nutcracker/src/hashkit/nc_ketama.c +3 -3
  98. data/ext/nutcracker/src/nc.c +1 -1
  99. data/ext/nutcracker/src/nc_conf.c +67 -19
  100. data/ext/nutcracker/src/nc_conf.h +9 -4
  101. data/ext/nutcracker/src/nc_connection.c +35 -2
  102. data/ext/nutcracker/src/nc_connection.h +53 -47
  103. data/ext/nutcracker/src/nc_core.c +8 -1
  104. data/ext/nutcracker/src/nc_message.c +23 -7
  105. data/ext/nutcracker/src/nc_message.h +24 -1
  106. data/ext/nutcracker/src/nc_proxy.c +14 -3
  107. data/ext/nutcracker/src/nc_rbtree.c +1 -5
  108. data/ext/nutcracker/src/nc_request.c +58 -10
  109. data/ext/nutcracker/src/nc_response.c +27 -4
  110. data/ext/nutcracker/src/nc_server.c +33 -5
  111. data/ext/nutcracker/src/nc_server.h +10 -9
  112. data/ext/nutcracker/src/nc_string.h +17 -0
  113. data/ext/nutcracker/src/nc_util.c +5 -1
  114. data/ext/nutcracker/src/proto/Makefile.in +19 -6
  115. data/ext/nutcracker/src/proto/nc_memcache.c +76 -12
  116. data/ext/nutcracker/src/proto/nc_proto.h +9 -0
  117. data/ext/nutcracker/src/proto/nc_redis.c +400 -18
  118. data/lib/nutcracker.rb +1 -1
  119. data/lib/nutcracker/version.rb +1 -1
  120. metadata +61 -6
  121. data/ext/nutcracker/notes/memcache.txt +0 -123
@@ -2,7 +2,7 @@ If you are deploying nutcracker in your production environment, here are a few r
2
2
 
3
3
  ## Log Level
4
4
 
5
- By default debug logging is disabled in nutcracker. However, it is worthwhile running nutcracker with debug logging enabled and verbosity level set to LOG_INFO (-v 6 or --verbosity=6). This in reality does not add much overhead as you only pay the cost of checking an if condition for every log line encountered during the run time.
5
+ By default debug logging is disabled in nutcracker. However, it is worthwhile running nutcracker with debug logging enabled and verbosity level set to LOG_INFO (-v 6 or --verbose=6). This in reality does not add much overhead as you only pay the cost of checking an if condition for every log line encountered during the run time.
6
6
 
7
7
  At LOG_INFO level, nutcracker logs the life cycle of every client and server connection and important events like the server being ejected from the hash ring and so on. Eg.
8
8
 
@@ -50,7 +50,7 @@ It is always a good idea to configure nutcracker `timeout:` for every server poo
50
50
 
51
51
  Relying only on client-side timeouts has the adverse effect of the original request having timedout on the client to proxy connection, but still pending and outstanding on the proxy to server connection. This further gets exacerbated when client retries the original request.
52
52
 
53
- By default, nutcracker waits indefinitely for any request sent to the server. However, when `timeout:` key is configured, a requests for which no response is received from the server in `timeout:` msec is timedout and an error response `SERVER_ERROR Connection timed out\r\n` is sent back to the client.
53
+ By default, nutcracker waits indefinitely for any request sent to the server. However, when `timeout:` key is configured, a requests for which no response is received from the server in `timeout:` msec is timedout and an error response `SERVER_ERROR Connection timed out\r\n` (memcached) or `-ERR Connection timed out\r\n` (redis) is sent back to the client.
54
54
 
55
55
  ## Error Response
56
56
 
@@ -115,7 +115,7 @@ Note that when using node names for consistent hashing, twemproxy ignores the we
115
115
 
116
116
  [Hash Tags](http://antirez.com/post/redis-presharding.html) enables you to use part of the key for calculating the hash. When the hash tag is present, we use part of the key within the tag as the key to be used for consistent hashing. Otherwise, we use the full key as is. Hash tags enable you to map different keys to the same server as long as the part of the key within the tag is the same.
117
117
 
118
- For example, the configuration of server pool _beta_, aslo shown below, specifies a two character hash_tag string - "{}". This means that keys "user:{user1}:ids" and "user:{user1}:tweets" map to the same server because we compute the hash on "user1". For a key like "user:user1:ids", we use the entire string "user:user1:ids" to compute the hash and it may map to a different server.
118
+ For example, the configuration of server pool _beta_, also shown below, specifies a two character hash_tag string - "{}". This means that keys "user:{user1}:ids" and "user:{user1}:tweets" map to the same server because we compute the hash on "user1". For a key like "user:user1:ids", we use the entire string "user:user1:ids" to compute the hash and it may map to a different server.
119
119
 
120
120
  beta:
121
121
  listen: 127.0.0.1:22122
@@ -130,8 +130,7 @@ For example, the configuration of server pool _beta_, aslo shown below, specifie
130
130
  - 127.0.0.1:6381:1 server2
131
131
  - 127.0.0.1:6382:1 server3
132
132
  - 127.0.0.1:6383:1 server4
133
-
134
-
133
+
135
134
  ## Graphing Cache-pool State
136
135
 
137
136
  When running nutcracker in production, you often would like to know the list of live and ejected servers at any given time. You can easily answer this question, by generating a time series graph of live and/or dead servers that are part of any cache pool. To do this your graphing client must collect the following stats exposed by nutcracker:
@@ -155,3 +154,9 @@ You can also graph the timestamp at which any given server was ejected by graphi
155
154
  By design, twemproxy multiplexes several client connections over few server connections. It is important to note that **"read my last write"** constraint doesn't necessarily hold true when twemproxy is configured with `server_connections: > 1`.
156
155
 
157
156
  To illustrate this, consider a scenario where twemproxy is configured with `server_connections: 2`. If a client makes pipelined requests with the first request in pipeline being `set foo 0 0 3\r\nbar\r\n` (write) and the second request being `get foo\r\n` (read), the expectation is that the read of key `foo` would return the value `bar`. However, with configuration of two server connections it is possible that write and read request are sent on different server connections which would mean that their completion could race with one another. In summary, if the client expects "read my last write" constraint, you either configure twemproxy to use `server_connections:1` or use clients that only make synchronous requests to twemproxy.
157
+
158
+ ## twemproxy and python-memcached
159
+
160
+ The implementation of delete command in [python-memcached](https://github.com/linsomniac/python-memcached) conflicts with the one in twemproxy. See [issue 283](https://github.com/twitter/twemproxy/pull/283) for details. The workaround for this issue is to call `delete_multi` in python-memcached as follows:
161
+
162
+ mc.delete_multi([key1, key2, ... keyN], time=None)
@@ -39,7 +39,7 @@
39
39
  +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
40
40
  | RESTORE | Yes | RESTORE key ttl serialized-value |
41
41
  +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
42
- | SORT | Yes* | SORT key [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC|DESC] [ALPHA] [STORE destination] |
42
+ | SORT | Yes | SORT key [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC|DESC] [ALPHA] [STORE destination] |
43
43
  +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
44
44
  | TTL | Yes | TTL key |
45
45
  +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
@@ -48,8 +48,6 @@
48
48
  | SCAN | No | SCAN cursor [MATCH pattern] [COUNT count] |
49
49
  +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
50
50
 
51
- * SORT support requires that the supplied keys hash to the same server. You can ensure this by using the same [hashtag](notes/recommendation.md#hash-tags) for all keys in the command.
52
-
53
51
  ### Strings Command
54
52
 
55
53
  +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
@@ -176,7 +174,7 @@
176
174
  | RPUSHX | Yes | RPUSHX key value |
177
175
  +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
178
176
 
179
- * RPOPLPUSH support requires that source and destination keys hash to the same server. You can ensure this by using the same [hashtag](notes/recommendation.md#hash-tags) for source and destination key. Twemproxy does no checking on its end to verify that source and destination key hash to the same server, and the RPOPLPUSH command is forwarded to the server that the source key hashes to
177
+ * RPOPLPUSH support requires that source and destination keys hash to the same server. You can ensure this by using the same [hashtag](recommendation.md#hash-tags) for source and destination key. Twemproxy does no checking on its end to verify that source and destination key hash to the same server, and the RPOPLPUSH command is forwarded to the server that the source key hashes to
180
178
 
181
179
  ### Sets
182
180
 
@@ -214,7 +212,7 @@
214
212
  | SSCAN | Yes | SSCAN key cursor [MATCH pattern] [COUNT count] |
215
213
  +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
216
214
 
217
- * SIDFF, SDIFFSTORE, SINTER, SINTERSTORE, SMOVE, SUNION and SUNIONSTORE support requires that the supplied keys hash to the same server. You can ensure this by using the same [hashtag](notes/recommendation.md#hash-tags) for all keys in the command. Twemproxy does no checking on its end to verify that all the keys hash to the same server, and the given command is forwarded to the server that the first key hashes to.
215
+ * SIDFF, SDIFFSTORE, SINTER, SINTERSTORE, SMOVE, SUNION and SUNIONSTORE support requires that the supplied keys hash to the same server. You can ensure this by using the same [hashtag](recommendation.md#hash-tags) for all keys in the command. Twemproxy does no checking on its end to verify that all the keys hash to the same server, and the given command is forwarded to the server that the first key hashes to.
218
216
 
219
217
 
220
218
  ### Sorted Sets
@@ -263,7 +261,7 @@
263
261
  | ZSCAN | Yes | ZSCAN key cursor [MATCH pattern] [COUNT count] |
264
262
  +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
265
263
 
266
- * ZINTERSTORE and ZUNIONSTORE support requires that the supplied keys hash to the same server. You can ensure this by using the same [hashtag](notes/recommendation.md#hash-tags) for all keys in the command. Twemproxy does no checking on its end to verify that all the keys hash to the same server, and the given command is forwarded to the server that the first key hashes to.
264
+ * ZINTERSTORE and ZUNIONSTORE support requires that the supplied keys hash to the same server. You can ensure this by using the same [hashtag](recommendation.md#hash-tags) for all keys in the command. Twemproxy does no checking on its end to verify that all the keys hash to the same server, and the given command is forwarded to the server that the first key hashes to.
267
265
 
268
266
  ### HyperLogLog
269
267
 
@@ -277,7 +275,7 @@
277
275
  | PFMERGE | Yes* | PFMERGE destkey sourcekey [sourcekey ...] |
278
276
  +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
279
277
 
280
- * PFMERGE support requires that the supplied keys hash to the same server. You can ensure this by using the same [hashtag](notes/recommendation.md#hash-tags) for all keys in the command. Twemproxy does no checking on its end to verify that all the keys hash to the same server, and the given command is forwarded to the server that the first key hashes to.
278
+ * PFMERGE support requires that the supplied keys hash to the same server. You can ensure this by using the same [hashtag](recommendation.md#hash-tags) for all keys in the command. Twemproxy does no checking on its end to verify that all the keys hash to the same server, and the given command is forwarded to the server that the first key hashes to.
281
279
 
282
280
 
283
281
  ### Pub/Sub
@@ -330,7 +328,7 @@
330
328
  | SCRIPT LOAD | No | SCRIPT LOAD script |
331
329
  +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
332
330
 
333
- * EVAL and EVALSHA support is limited to scripts that take at least 1 key. If multiple keys are used, all keys must hash to the same server. You can ensure this by using the same [hashtag](notes/recommendation.md#hash-tags) for all keys. If you use more than 1 key, the proxy does no checking to verify that all keys hash to the same server, and the entire command is forwarded to the server that the first key hashes to
331
+ * EVAL and EVALSHA support is limited to scripts that take at least 1 key. If multiple keys are used, all keys must hash to the same server. You can ensure this by using the same [hashtag](recommendation.md#hash-tags) for all keys. If you use more than 1 key, the proxy does no checking to verify that all keys hash to the same server, and the entire command is forwarded to the server that the first key hashes to
334
332
 
335
333
  ### Connection
336
334
 
@@ -399,7 +397,7 @@
399
397
  ## Note
400
398
 
401
399
  - redis commands are not case sensitive
402
- - only vectored commands 'MGET key [key ...]' and 'DEL key [key ...]' needs to be fragmented
400
+ - only vectored commands 'MGET key [key ...]', 'MSET key value [key value ...]', 'DEL key [key ...]' needs to be fragmented
403
401
 
404
402
  ## Performance
405
403
 
@@ -445,3 +443,19 @@
445
443
  LRANGE_500 (first 450 elements): 8605.85 requests per second
446
444
  LRANGE_600 (first 600 elements): 6587.62 requests per second
447
445
 
446
+ ## redis-auth feature
447
+
448
+ + you can enable redis-auth for a pool with 'redis_auth':
449
+
450
+ alpha:
451
+ listen: 127.0.0.1:22121
452
+ hash: fnv1a_64
453
+ distribution: ketama
454
+ redis: true
455
+ redis_auth: testpass
456
+
457
+ + notice:
458
+ + *MUST* set all redis with a same passwd, and all twemproxy with the same passwd
459
+ + Length of password should less than 256
460
+
461
+
@@ -26,6 +26,16 @@ prog="nutcracker"
26
26
 
27
27
  start () {
28
28
  echo -n $"Starting $prog: "
29
+ #Test the config before start.
30
+ daemon --user ${USER} ${prog} $OPTIONS -t >/dev/null 2>&1
31
+ RETVAL=$?
32
+ if [ $RETVAL -ne 0 ] ; then
33
+ echo "Config check fail! Please use 'nutcracker -c /etc/nutcracker/nutcracker.yml' for detail."
34
+ echo_failure;
35
+ echo;
36
+ exit 1
37
+ fi
38
+
29
39
  daemon --user ${USER} ${prog} $OPTIONS
30
40
  RETVAL=$?
31
41
  echo
@@ -0,0 +1,83 @@
1
+ #!/bin/sh
2
+ ### BEGIN INIT INFO
3
+ # Provides: nutcracker
4
+ # Required-Start: $network $remote_fs $local_fs
5
+ # Required-Stop: $network $remote_fs $local_fs
6
+ # Default-Start: 2 3 4 5
7
+ # Default-Stop: 0 1 6
8
+ # Short-Description: Stop/start nutcracker
9
+ ### END INIT INFO
10
+
11
+ PATH=/sbin:/usr/sbin:/bin:/usr/bin
12
+ DESC=nutcracker
13
+ NAME=nutcracker
14
+ USER=nobody
15
+ CONFFILE=/opt/nutcracker/etc/$NAME.yml
16
+ LOGFILE=/opt/nutcracker/log/nutcracker.log
17
+ DAEMON=/opt/nutcracker/sbin/nutcracker
18
+ PIDFILE=/var/run/nutcracker/$NAME.pid
19
+ STATSPORT=22222
20
+ DAEMON_ARGS="-c $CONFFILE -o $LOGFILE -p $PIDFILE -s $STATSPORT -v 11 -m 2048 -d"
21
+ #DAEMON_ARGS="-c $CONFFILE -p $PIDFILE -s $STATSPORT -d"
22
+ SCRIPTNAME=/etc/init.d/$NAME
23
+
24
+ ulimit -Hn 100000
25
+ ulimit -Sn 100000
26
+
27
+ [ -x $DAEMON ] || exit 0
28
+
29
+ [ -r /etc/default/$NAME ] && . /etc/default/$NAME
30
+
31
+ . /lib/init/vars.sh
32
+
33
+ . /lib/lsb/init-functions
34
+
35
+ do_start()
36
+ {
37
+ mkdir -p /var/run/nutcracker
38
+ touch $PIDFILE
39
+ chown $USER:$USER -R /var/run/nutcracker
40
+ chmod 755 /var/run/nutcracker
41
+
42
+ echo -n "Starting ${NAME}: "
43
+ start-stop-daemon --start --quiet -m --pidfile $PIDFILE --chuid $USER:$USER --exec $DAEMON -- \
44
+ $DAEMON_ARGS
45
+ case "$?" in
46
+ 0|1) echo "STARTED." ;;
47
+ 2) echo "FAILED." ;;
48
+ esac
49
+ }
50
+
51
+ do_stop()
52
+ {
53
+ echo -n "Stopping ${NAME}: "
54
+ start-stop-daemon --stop --quiet --pidfile $PIDFILE --exec $DAEMON || true
55
+
56
+ case "$?" in
57
+ 0|1) echo "STOPPED.";;
58
+ 2) echo "FAILED." ;;
59
+ esac
60
+ }
61
+
62
+ case "$1" in
63
+ start)
64
+ do_start
65
+ ;;
66
+ stop)
67
+ do_stop
68
+ ;;
69
+ status)
70
+ status_of_proc -p $PIDFILE "$DAEMON" nutcracker && exit 0 || exit $?
71
+ ;;
72
+ restart)
73
+ do_stop
74
+ do_start
75
+ ;;
76
+ *)
77
+ echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2
78
+ exit 3
79
+ ;;
80
+ esac
81
+
82
+ exit
83
+ $RETVAL
@@ -1,6 +1,6 @@
1
1
  Summary: Twitter's nutcracker redis and memcached proxy
2
2
  Name: nutcracker
3
- Version: 0.3.0
3
+ Version: 0.4.1
4
4
  Release: 1
5
5
 
6
6
  URL: https://github.com/twitter/twemproxy/
@@ -16,7 +16,8 @@ BuildRequires: libtool
16
16
 
17
17
  %description
18
18
  twemproxy (pronounced "two-em-proxy"), aka nutcracker is a fast and lightweight proxy for memcached and redis protocol.
19
- It was primarily built to reduce the connection count on the backend caching servers.
19
+ It was primarily built to reduce the connection count on the backend caching servers. This, together with protocol
20
+ pipelining and sharding enables you to horizontally scale your distributed caching architecture.
20
21
 
21
22
  %prep
22
23
  %setup -q
@@ -65,6 +66,39 @@ fi
65
66
  %config(noreplace)%{_sysconfdir}/%{name}/%{name}.yml
66
67
 
67
68
  %changelog
69
+ * Mon Jun 22 2015 Manju Rajashekhar <manj@cs.stanford.edu>
70
+ - twemproxy: version 0.4.1 release
71
+ - redis_auth is only valid for a redis pool
72
+ - getaddrinfo returns non-zero +ve value on error
73
+ - fix-hang-when-command-only (charsyam)
74
+ - fix bug crash when get command without key and whitespace (charsyam)
75
+ - mark server as failed on protocol level transiet failures like -OOM, -LOADING, etc
76
+ - implemented support for parsing fine grained redis error response
77
+ - remove redundant conditional judgement in rbtree deletion (leo ma)
78
+ - fix bug mset has invalid pair (charsyam)
79
+ - fix bug mset has invalid pair (charsyam)
80
+ - temp fix a core on kqueue (idning)
81
+ - support "touch" command for memcached (panmiaocai)
82
+ - fix redis parse rsp bug (charsyam)
83
+ - SORT command can take multiple arguments. So it should be part of redis_argn() and not redis_arg0()
84
+ - remove incorrect assert because client could send data after sending a quit request which must be discarded
85
+ - allow file permissions to be set for UNIX domain listening socket (ori liveneh)
86
+ - return error if formatted is greater than mbuf size by using nc_vsnprintf() in msg_prepend_format()
87
+ - fix req_make_reply on msg_get, mark it as response (idning)
88
+ - redis database select upon connect (arne claus)
89
+ - redis_auth (charsyam)
90
+ - allow null key(empty key) (idning)
91
+ - fix core on invalid mset like "mset a a a" (idning)
92
+
93
+ * Tue Oct 18 2014 idning <idning@gmail.com>
94
+ - twemproxy: version 0.4.0 release
95
+ - mget improve (idning)
96
+ - many new commands supported: LEX, PFADD, PFMERGE, SORT, PING, QUIT, SCAN... (mattrobenolt, areina, idning)
97
+ - handle max open file limit(allenlz)
98
+ - add notice-log and use ms time in log(idning)
99
+ - fix bug in string_compare (andyqzb)
100
+ - fix deadlock in sighandler (idning)
101
+
68
102
  * Fri Dec 20 2013 Manju Rajashekhar <manj@cs.stanford.edu>
69
103
  - twemproxy: version 0.3.0 release
70
104
  - SRANDMEMBER support for the optional count argument (mkhq)
@@ -616,3 +616,7 @@ printf '*4\r\n$4\r\neval\r\n$10\r\nreturn 123\r\n$1\r\n1\r\n$1\r\n1\r\n' | socat
616
616
  printf '*7\r\n$4\r\neval\r\n$40\r\nreturn {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}\r\n$1\r\n2\r\n$9\r\nkey1{tag}\r\n$4\r\narg1\r\n$9\r\nkey2{tag}\r\n$4\r\narg2\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
617
617
  printf '*9\r\n$4\r\neval\r\n$56\r\nreturn {KEYS[1],KEYS[2],KEYS[3],ARGV[1],ARGV[2],ARGV[3]}\r\n$1\r\n3\r\n$9\r\nkey1{tag}\r\n$4\r\narg1\r\n$9\r\nkey2{tag}\r\n$4\r\narg2\r\n$9\r\nkey3{tag}\r\n$4\r\narg3\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
618
618
  printf '*4\r\n$4\r\neval\r\n$11\r\nreturn {10}\r\n$1\r\n1\r\n$4\r\nTEMP\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
619
+
620
+ # quit
621
+ printf '\nquit\n'
622
+ printf '*1\r\n$4\r\nquit\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
@@ -9,7 +9,9 @@ AM_CPPFLAGS += -I $(top_srcdir)/src/proto
9
9
  AM_CPPFLAGS += -I $(top_srcdir)/src/event
10
10
  AM_CPPFLAGS += -I $(top_srcdir)/contrib/yaml-0.1.4/include
11
11
 
12
- AM_CFLAGS =
12
+ AM_CFLAGS =
13
+ # about -fno-strict-aliasing: https://github.com/twitter/twemproxy/issues/276
14
+ AM_CFLAGS += -fno-strict-aliasing
13
15
  AM_CFLAGS += -Wall -Wshadow
14
16
  AM_CFLAGS += -Wpointer-arith
15
17
  AM_CFLAGS += -Winline
@@ -23,6 +25,9 @@ AM_LDFLAGS += -lm -lpthread -rdynamic
23
25
  if OS_SOLARIS
24
26
  AM_LDFLAGS += -lnsl -lsocket
25
27
  endif
28
+ if OS_FREEBSD
29
+ AM_LDFLAGS += -lexecinfo
30
+ endif
26
31
 
27
32
  SUBDIRS = hashkit proto event
28
33
 
@@ -1,7 +1,7 @@
1
- # Makefile.in generated by automake 1.14.1 from Makefile.am.
1
+ # Makefile.in generated by automake 1.15 from Makefile.am.
2
2
  # @configure_input@
3
3
 
4
- # Copyright (C) 1994-2013 Free Software Foundation, Inc.
4
+ # Copyright (C) 1994-2014 Free Software Foundation, Inc.
5
5
 
6
6
  # This Makefile.in is free software; the Free Software Foundation
7
7
  # gives unlimited permission to copy and/or distribute it,
@@ -15,7 +15,17 @@
15
15
  @SET_MAKE@
16
16
 
17
17
  VPATH = @srcdir@
18
- am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
18
+ am__is_gnu_make = { \
19
+ if test -z '$(MAKELEVEL)'; then \
20
+ false; \
21
+ elif test -n '$(MAKE_HOST)'; then \
22
+ true; \
23
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
24
+ true; \
25
+ else \
26
+ false; \
27
+ fi; \
28
+ }
19
29
  am__make_running_with_option = \
20
30
  case $${target_option-} in \
21
31
  ?) ;; \
@@ -80,10 +90,9 @@ build_triplet = @build@
80
90
  host_triplet = @host@
81
91
  @OS_SOLARIS_FALSE@am__append_1 = -D_GNU_SOURCE
82
92
  @OS_SOLARIS_TRUE@am__append_2 = -lnsl -lsocket
93
+ @OS_FREEBSD_TRUE@am__append_3 = -lexecinfo
83
94
  sbin_PROGRAMS = nutcracker$(EXEEXT)
84
95
  subdir = src
85
- DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
86
- $(top_srcdir)/config/depcomp
87
96
  ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
88
97
  am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
89
98
  $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -91,6 +100,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
91
100
  $(top_srcdir)/configure.ac
92
101
  am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
93
102
  $(ACLOCAL_M4)
103
+ DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
94
104
  mkinstalldirs = $(install_sh) -d
95
105
  CONFIG_HEADER = $(top_builddir)/config.h
96
106
  CONFIG_CLEAN_FILES =
@@ -190,6 +200,7 @@ am__define_uniq_tagged_files = \
190
200
  ETAGS = etags
191
201
  CTAGS = ctags
192
202
  DIST_SUBDIRS = $(SUBDIRS)
203
+ am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp
193
204
  DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
194
205
  am__relativize = \
195
206
  dir0=`pwd`; \
@@ -259,6 +270,7 @@ LIBTOOL = @LIBTOOL@
259
270
  LIPO = @LIPO@
260
271
  LN_S = @LN_S@
261
272
  LTLIBOBJS = @LTLIBOBJS@
273
+ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
262
274
  MAKEINFO = @MAKEINFO@
263
275
  MANIFEST_TOOL = @MANIFEST_TOOL@
264
276
  MKDIR_P = @MKDIR_P@
@@ -340,12 +352,13 @@ MAINTAINERCLEANFILES = Makefile.in
340
352
  AM_CPPFLAGS = $(am__append_1) -I $(top_srcdir)/src/hashkit -I \
341
353
  $(top_srcdir)/src/proto -I $(top_srcdir)/src/event -I \
342
354
  $(top_srcdir)/contrib/yaml-0.1.4/include
343
- AM_CFLAGS = -Wall -Wshadow -Wpointer-arith -Winline -Wunused-function \
344
- -Wunused-variable -Wunused-value -Wno-unused-parameter \
345
- -Wno-unused-value -Wconversion -Wsign-compare \
346
- -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls \
347
- -Wmissing-declarations
348
- AM_LDFLAGS = -lm -lpthread -rdynamic $(am__append_2)
355
+ # about -fno-strict-aliasing: https://github.com/twitter/twemproxy/issues/276
356
+ AM_CFLAGS = -fno-strict-aliasing -Wall -Wshadow -Wpointer-arith \
357
+ -Winline -Wunused-function -Wunused-variable -Wunused-value \
358
+ -Wno-unused-parameter -Wno-unused-value -Wconversion \
359
+ -Wsign-compare -Wstrict-prototypes -Wmissing-prototypes \
360
+ -Wredundant-decls -Wmissing-declarations
361
+ AM_LDFLAGS = -lm -lpthread -rdynamic $(am__append_2) $(am__append_3)
349
362
  SUBDIRS = hashkit proto event
350
363
  nutcracker_SOURCES = \
351
364
  nc_core.c nc_core.h \
@@ -388,7 +401,6 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
388
401
  echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
389
402
  $(am__cd) $(top_srcdir) && \
390
403
  $(AUTOMAKE) --foreign src/Makefile
391
- .PRECIOUS: Makefile
392
404
  Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
393
405
  @case '$?' in \
394
406
  *config.status*) \
@@ -793,6 +805,8 @@ uninstall-am: uninstall-sbinPROGRAMS
793
805
  mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
794
806
  uninstall-am uninstall-sbinPROGRAMS
795
807
 
808
+ .PRECIOUS: Makefile
809
+
796
810
 
797
811
  # Tell versions [3.59,3.63) of GNU make to not export all variables.
798
812
  # Otherwise a system limit (for SysV at least) may be exceeded.
@@ -1,7 +1,7 @@
1
- # Makefile.in generated by automake 1.14.1 from Makefile.am.
1
+ # Makefile.in generated by automake 1.15 from Makefile.am.
2
2
  # @configure_input@
3
3
 
4
- # Copyright (C) 1994-2013 Free Software Foundation, Inc.
4
+ # Copyright (C) 1994-2014 Free Software Foundation, Inc.
5
5
 
6
6
  # This Makefile.in is free software; the Free Software Foundation
7
7
  # gives unlimited permission to copy and/or distribute it,
@@ -16,7 +16,17 @@
16
16
 
17
17
 
18
18
  VPATH = @srcdir@
19
- am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
19
+ am__is_gnu_make = { \
20
+ if test -z '$(MAKELEVEL)'; then \
21
+ false; \
22
+ elif test -n '$(MAKE_HOST)'; then \
23
+ true; \
24
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
25
+ true; \
26
+ else \
27
+ false; \
28
+ fi; \
29
+ }
20
30
  am__make_running_with_option = \
21
31
  case $${target_option-} in \
22
32
  ?) ;; \
@@ -80,8 +90,6 @@ POST_UNINSTALL = :
80
90
  build_triplet = @build@
81
91
  host_triplet = @host@
82
92
  subdir = src/event
83
- DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
84
- $(top_srcdir)/config/depcomp $(noinst_HEADERS)
85
93
  ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
86
94
  am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
87
95
  $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -89,6 +97,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
89
97
  $(top_srcdir)/configure.ac
90
98
  am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
91
99
  $(ACLOCAL_M4)
100
+ DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \
101
+ $(am__DIST_COMMON)
92
102
  mkinstalldirs = $(install_sh) -d
93
103
  CONFIG_HEADER = $(top_builddir)/config.h
94
104
  CONFIG_CLEAN_FILES =
@@ -169,6 +179,7 @@ am__define_uniq_tagged_files = \
169
179
  done | $(am__uniquify_input)`
170
180
  ETAGS = etags
171
181
  CTAGS = ctags
182
+ am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp
172
183
  DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
173
184
  ACLOCAL = @ACLOCAL@
174
185
  AMTAR = @AMTAR@
@@ -213,6 +224,7 @@ LIBTOOL = @LIBTOOL@
213
224
  LIPO = @LIPO@
214
225
  LN_S = @LN_S@
215
226
  LTLIBOBJS = @LTLIBOBJS@
227
+ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
216
228
  MAKEINFO = @MAKEINFO@
217
229
  MANIFEST_TOOL = @MANIFEST_TOOL@
218
230
  MKDIR_P = @MKDIR_P@
@@ -316,7 +328,6 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
316
328
  echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/event/Makefile'; \
317
329
  $(am__cd) $(top_srcdir) && \
318
330
  $(AUTOMAKE) --foreign src/event/Makefile
319
- .PRECIOUS: Makefile
320
331
  Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
321
332
  @case '$?' in \
322
333
  *config.status*) \
@@ -584,6 +595,8 @@ uninstall-am:
584
595
  mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
585
596
  tags tags-am uninstall uninstall-am
586
597
 
598
+ .PRECIOUS: Makefile
599
+
587
600
 
588
601
  # Tell versions [3.59,3.63) of GNU make to not export all variables.
589
602
  # Otherwise a system limit (for SysV at least) may be exceeded.