This file contains 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
/* | |
Based on code provided by Sebastian Sito in stackoverflow question: | |
http://stackoverflow.com/questions/9958589/async-redis-pooling-using-lib-event | |
*/ | |
#include <stdlib.h> | |
#include <event2/event.h> | |
#include <event2/http.h> | |
#include <event2/buffer.h> | |
#include <hiredis/hiredis.h> |
This file contains 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
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <sys/ioctl.h> |
This file contains 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
global | |
daemon | |
maxconn 256 | |
defaults | |
mode tcp | |
timeout connect 5000ms | |
timeout client 50000ms | |
timeout server 50000ms |
This file contains 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
require 'rubygems' | |
gem 'redis', '3.0.0.rc1' | |
require 'redis' | |
require 'redis/distributed' | |
# Create a client for 3 distributed Redis instances | |
$r = Redis::Distributed.new %w[redis://localhost:6380 redis://localhost:6381 redis://localhost:6382] | |
# Set 1000 items in distributed Redis |
This file contains 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
$ g++ --version | |
g++ (SUSE Linux) 4.5.0 20100604 [gcc-4_5-branch revision 160292] | |
$ g++ -std=c++0x -O2 main.cc | |
$ time ./a.out | |
real 0m33.838s | |
user 0m30.784s | |
sys 0m2.930s |
This file contains 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
#include <iostream> | |
#include <tr1/unordered_map> | |
#include <map> | |
#include <set> | |
// 37 ms per intersection for Redis | |
// 29 ms per intersection for this C++ program | |
using namespace std; | |
using namespace std::tr1; |
This file contains 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
#!/usr/bin/env python | |
# --------------------------------------------------------- | |
import redis | |
POOL = redis.ConnectionPool(host='localhost',port=6379,db=0) | |
# --------------------------------------------------------- | |
def main(): |
This file contains 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
/*************************************************************************** | |
* Copyright (C) 2008 by Amadeus * | |
* * | |
* This program is free software; you can redistribute it and/or modify * | |
* it under the terms of the GNU General Public License as published by * | |
* the Free Software Foundation; either version 2 of the License, or * | |
* (at your option) any later version. * | |
* * | |
* This program is distributed in the hope that it will be useful, * | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
This file contains 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
Dump of assembler code for function zslGetRank: | |
; Function prolog: save registers on the stack | |
0x0000000000427fd0 <+0>: push %r14 | |
0x0000000000427fd2 <+2>: push %r13 | |
0x0000000000427fd4 <+4>: mov %rsi,%r13 | |
0x0000000000427fd7 <+7>: push %r12 | |
0x0000000000427fd9 <+9>: push %rbp | |
0x0000000000427fda <+10>: push %rbx | |
0x0000000000427fdb <+11>: sub $0x10,%rsp |
This file contains 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
ncegcolnx243:src> numactl -C 4 redis-benchmark -q -n 100000 -d 100 -h ncegcolnx242 | |
PING (inline): 134048.27 requests per second | |
PING: 132978.73 requests per second | |
SET: 131926.12 requests per second | |
GET: 129701.68 requests per second | |
INCR: 132275.14 requests per second | |
LPUSH: 132450.33 requests per second | |
LPOP: 130039.02 requests per second | |
SADD: 132978.73 requests per second | |
SPOP: 132978.73 requests per second |