This file contains hidden or 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
subs = {}, conns = 0; | |
require('net').createServer(function (sock) { | |
sock.setEncoding('utf8'); | |
sock.subs = {}; | |
sock.id = conns++; | |
var buf = ''; | |
sock.addListener('data', function (chunk) { | |
buf += chunk; | |
var match; | |
while (match = buf.match(/^(.*)\r\n/)) { |
This file contains hidden or 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
$ ./test.js -v | |
DEBUG: [CONNECTED] | |
[INFO] Testing AUTH | |
========================================= | |
DEBUG: [SEND] *2<CRLF>$6<CRLF>select<CRLF>$2<CRLF>14<CRLF> | |
DEBUG: [SEND] *1<CRLF>$7<CRLF>flushdb<CRLF> | |
DEBUG: [SEND] *2<CRLF>$6<CRLF>select<CRLF>$2<CRLF>15<CRLF> | |
DEBUG: [SEND] *1<CRLF>$7<CRLF>flushdb<CRLF> | |
DEBUG: This test does not do anything |
This file contains hidden or 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
~ ⚡ node /tmp/readself.js | |
length=214 | |
// start of file readself.js | |
sys=require("sys"); | |
fs=require("fs"); | |
contents=fs.readFileSync(__filename, encoding="utf8"); // ö日本語 | |
sys.puts("length="+contents.length); | |
sys.puts(contents); | |
// end of file readself.js |
This file contains hidden or 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
~ ⚡ node /tmp/readself.js | |
contents length = 551 | |
buffer length before write = 551 | |
buffer length after write = 551 | |
not the same | |
contents | |
// file start | |
sys=require("sys"); | |
fs=require("fs"); | |
Buffer=require("buffer").Buffer; |
This file contains hidden or 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
~/projects/redis-node-client(master) ⚡ ./test/test_shutdown_reconnect.js | |
DEBUG: [CONNECT] | |
DEBUG: [SEND] *2<CRLF>$3<CRLF>del<CRLF>$3<CRLF>foo<CRLF> originalCommands = 1 COUNT = 1 | |
DEBUG: [SEND] *2<CRLF>$4<CRLF>incr<CRLF>$3<CRLF>foo<CRLF> originalCommands = 2 COUNT = 2 | |
DEBUG: [SEND] *2<CRLF>$4<CRLF>incr<CRLF>$3<CRLF>foo<CRLF> originalCommands = 3 COUNT = 3 | |
DEBUG: [SEND] *2<CRLF>$4<CRLF>incr<CRLF>$3<CRLF>foo<CRLF> originalCommands = 4 COUNT = 4 | |
DEBUG: [SEND] *2<CRLF>$4<CRLF>incr<CRLF>$3<CRLF>foo<CRLF> originalCommands = 5 COUNT = 5 | |
DEBUG: [SEND] *2<CRLF>$4<CRLF>incr<CRLF>$3<CRLF>foo<CRLF> originalCommands = 6 COUNT = 6 | |
DEBUG: [SEND] *2<CRLF>$4<CRLF>incr<CRLF>$3<CRLF>foo<CRLF> originalCommands = 7 COUNT = 7 | |
DEBUG: [SEND] *2<CRLF>$4<CRLF>incr<CRLF>$3<CRLF>foo<CRLF> originalCommands = 8 COUNT = 8 |
This file contains hidden or 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
~/projects/redis-node-client(master) ⚡ node test/phillip.js | |
DEBUG: [ENQUEUE] Not connected. Request queued. There are 1 requests queued. | |
DEBUG: [CONNECT] | |
DEBUG: [FLUSH QUEUE] 1 queued request buffers. | |
DEBUG: [DEQUEUE/SEND] *3<CRLF>$3<CRLF>set<CRLF>$8<CRLF>test:foo<CRLF>$3<CRLF>bar<CRLF>. queued buffers remaining = 0 | |
DEBUG: [RECV] +OK<CRLF> | |
21 Apr 16:10:20 - set test:foo: true | |
DEBUG: [NO CONNECTION] | |
DEBUG: CLOSED -- false | |
21 Apr 16:10:25 - timeout fired |
This file contains hidden or 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
var fs = require("fs"); | |
sys = require("sys"); | |
if (process.platform.toLowerCase().indexOf("linux") == -1) | |
throw new Error("unsupported platform"); | |
setInterval(function () { | |
fs.readFile("/proc/" + process.pid + "/status", function (err, data) { | |
if (err) { | |
sys.puts(err); |
This file contains hidden or 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
$ file /proc/14207/smaps | |
/proc/14207/smaps: empty | |
$ tail /proc/14207/smaps | |
Shared_Dirty: 0 kB | |
Private_Clean: 0 kB | |
Private_Dirty: 8 kB | |
bf9cc000-bf9e2000 rw-p bf9cc000 00:00 0 [stack] | |
Size: 88 kB | |
Rss: 32 kB |
This file contains hidden or 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
$ node /tmp/foo.js | |
23 Apr 16:34:09 - system memory total 368864 KB | |
23 Apr 16:34:10 - peak RSS 6264 KB (2% of total) | |
23 Apr 16:34:10 - private memory (current) 5304 KB (1% of total) | |
23 Apr 16:34:11 - peak RSS 6752 KB (2% of total) (grew by 488 KB) | |
23 Apr 16:34:11 - private memory (current) 5796 KB (2% of total) (grew by 492 KB) | |
23 Apr 16:34:12 - peak RSS 6816 KB (2% of total) (grew by 64 KB) | |
23 Apr 16:34:12 - private memory (current) 5864 KB (2% of total) (grew by 68 KB) | |
23 Apr 16:34:13 - peak RSS 6884 KB (2% of total) (grew by 68 KB) | |
23 Apr 16:34:13 - private memory (current) 5928 KB (2% of total) (grew by 64 KB) |
This file contains hidden or 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
$ NODE_PATH=/Users/brian/projects/redis-node-client/lib:$NODE_PATH node test-mget.js | |
DEBUG: [ENQUEUE] Not connected. Request queued. There are 1 requests queued. | |
DEBUG: [FLUSH QUEUE] 1 queued request buffers. | |
DEBUG: [ENQUEUE] Not connected. Request queued. There are 2 requests queued. | |
DEBUG: [FLUSH QUEUE] 2 queued request buffers. | |
DEBUG: [ENQUEUE] Not connected. Request queued. There are 3 requests queued. | |
DEBUG: [CONNECT] | |
DEBUG: [FLUSH QUEUE] 3 queued request buffers. | |
DEBUG: [DEQUEUE/SEND] *3<CRLF>$3<CRLF>set<CRLF>$3<CRLF>foo<CRLF>$3<CRLF>bar<CRLF>. queued buffers remaining = 2 | |
DEBUG: [DEQUEUE/SEND] *3<CRLF>$3<CRLF>set<CRLF>$3<CRLF>baz<CRLF>$3<CRLF>buz<CRLF>. queued buffers remaining = 1 |