Skip to content

Instantly share code, notes, and snippets.

View fictorial's full-sized avatar

Brian Hammond fictorial

View GitHub Profile
posix = require('posix');
sys = require('sys');
var writer = posix.open('/tmp/data', process.O_CREAT | process.O_WRONLY, 0666).wait();
var data = 42;
sys.puts("written: " + posix.write(writer, data, null, 'binary').wait());
posix.close(writer);
// file is 2 bytes in size and contains:
// 42
# SoftLayer; Intel 5520; Linux 2.6; x86_64; 36GiB RAM (but that does not really matter for this)
./redis-benchmark -q
SET: 69048.28 requests per second
GET: 67174.49 requests per second
INCR: 57477.01 requests per second
LPUSH: 67689.19 requests per second
LPOP: 67127.52 requests per second
PING: 64541.93 requests per second
LPUSH (again, in order to bench LRANGE): 67662.16 requests per second
./bench_logstore
benchmarkPutsNoSyncIntValue: 453125 puts / second
benchmarkPutsNoSyncIntValue: 1 index file growths performed
benchmarkPutsSyncOncePerSecondIntValue: 426514 puts / second
benchmarkPutsSyncOncePerSecondIntValue: 0 syncs performed
benchmarkPutsSyncOncePerSecondIntValue: 0 index file growths performed
benchmarkPutsNoSync1KiBValue: 245941 puts / second
benchmarkPutsNoSync1KiBValue: 1 index file growths performed
benchmarkPutsSyncOncePerSecond1KiBValue: 29379 puts / second
benchmarkPutsSyncOncePerSecond1KiBValue: 1 syncs performed
$ cat pongserver.py
from circuits.net.sockets import TCPServer
from circuits.net.pollers import EPoll
class PongServer(TCPServer):
def connect(self, sock, host, port):
self.write(sock, 'HTTP/1.0 200 OK\r\nContent-Length: 5\r\n\r\nPong!\r\n')
self.close(sock)
# python 2.6 on linux 2.6.18
# from: http://scotdoyle.com/python-epoll-howto.html
import socket, select
EOL1 = b'\n\n'
EOL2 = b'\n\r\n'
response = b'HTTP/1.0 200 OK\r\nDate: Mon, 1 Jan 1996 01:01:01 GMT\r\n'
response += b'Content-Type: text/plain\r\nContent-Length: 13\r\n\r\n'
response += b'Hello, world!'
>>> import redis
>>> r=redis.Redis()
>>> r.hset('foo','bar',10)
HSET foo bar 2
10
SELECT 0
[16258] 08 Mar 20:26:15 # ======= Ooops! Redis 1.3.4 got signal: -11- =======
[16258] 08 Mar 20:26:15 # redis_version:1.3.4
[16378] 08 Mar 20:45:15 # ======= Ooops! Redis 1.3.4 got signal: -11- =======
[16378] 08 Mar 20:45:15 # redis_version:1.3.4
arch_bits:32
multiplexing_api:epoll
process_id:16378
uptime_in_seconds:163
uptime_in_days:0
connected_clients:0
connected_slaves:0
blocked_clients:0
TypeError: Cannot call method 'set' of null
at doConnect (net:616:23)
at Stream.connect (net:670:30)
at Object.createConnection (net:379:5)
at Object.createClient (/Users/brian/projects/redis-node-client2/redis.js:20:25)
at Object.<anonymous> (/Users/brian/projects/redis-node-client2/example.js:2:32)
at Module._compile (node.js:704:23)
at node.js:732:20
at fs:51:23
at node.js:813:9
assert.AssertionError.prototype.toString = function() {
var desc = [ this.name+":"
, JSON.stringify(this.expected )
, this.operator
, JSON.stringify(this.actual)
].join(" ");
if (this.message) {
return [desc, "("+this.message+")"].join(' ');
} else {
return desc;
*4
$7
zincrby
$3
foo
$1
1
$1
a
$1