Skip to content

Instantly share code, notes, and snippets.

Didier Spezia dspezia

Block or report user

Report or block dspezia

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dspezia
dspezia / C++03
Created Apr 25, 2012
Simulate Redis set/zset intersection
View C++03
#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;
@dspezia
dspezia / Example log
Created Apr 9, 2012
Assessing pending activity of a Redis server
View Example log
> ~/tcp_redis_monitor.py 6379
Timestamp Nb TX bytes RX bytes TX RMA RX RMA
1333983822.943 1 0 0 0.000 0.000
1333983823.193 1 0 0 0.000 0.000
1333983824.194 1 0 0 0.000 0.000
1333983825.195 1 0 0 0.000 0.000
1333983826.196 1 0 0 0.000 0.000
@dspezia
dspezia / redis3.py
Created Apr 1, 2012
hmget memory issue
View redis3.py
#!/usr/bin/env python
# ---------------------------------------------------------
import redis
POOL = redis.ConnectionPool(host='localhost',port=6379,db=0)
# ---------------------------------------------------------
def main():
@dspezia
dspezia / mytest.c
Created Apr 1, 2012
Example of async hiredis with libevent
View mytest.c
/*
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>
@dspezia
dspezia / Makefile
Created Feb 23, 2012
Example of pipelining with hiredis
View Makefile
OBJ = genload.o
BINS = genload
CC=g++
OPTIMIZATION?=-O3
CFLAGS?=$(OPTIMIZATION) $(ARCH) $(PROF) -I ../hiredis
CCLINK?=-pthread
LDFLAGS?=-L../hiredis -lhiredis -lm
OBJ = example.o
@dspezia
dspezia / Sequencer.cc
Created Feb 9, 2012
Example of double queue pattern
View Sequencer.cc
/***************************************************************************
* 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 *
@dspezia
dspezia / gist:1771342
Created Feb 8, 2012
Example of Redis zset + key iteration + pipelining in Python
View gist:1771342
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ----------------------------------------------------
import redis, random
POOL = redis.ConnectionPool(host='localhost', port=6379, db=0)
NUSERS = 10000
NTAGS = 500
@dspezia
dspezia / gist:1640804
Created Jan 19, 2012
Annotated zslGetRank
View gist:1640804
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
@dspezia
dspezia / tst.cpp
Created Dec 10, 2011
Variadic rpush C++ hiredis example
View tst.cpp
#include <iostream>
#include <vector>
#include <string>
#include <stdexcept>
#include <hiredis.h>
using namespace std;
@dspezia
dspezia / 1 GigE
Created Nov 22, 2011
Benchmark Redis 2.4.3 comparing various object sizes
View 1 GigE
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
You can’t perform that action at this time.