Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Evaluating memory consumption of 1M targeted tag sets
var redis = require('redis')
var rc = redis.createClient(6379, 'localhost');
function create( target, callback )
{
x = []
for ( var i=0; i<40; ++i )
{
// Only 100K entries in the reverse index
var n = 1000*Math.round(Math.random()*100000);
x.push(n);
}
var multi = rc.multi()
multi.sadd( "tgt:"+target, x )
x.forEach( function( xn ) {
multi.sadd( "tag:"+xn, target )
});
multi.exec( function(err,replies) {
callback()
});
}
function filln( offset, N, callback )
{
var count = 0;
for ( i=0; i<N; ++i ) {
create(offset+i, function () {
count++;
if ( count == N )
callback()
})
}
}
function fill( N, i, callback )
{
if ( i >= N/1000 ) {
callback();
return
}
filln( i*1000, 1000, function() {
console.log( "Done",i);
fill( N, ++i, callback )
});
}
rc.flushall( function(err,rr) {
fill( 1000000, 0, function() {
console.log("end");
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.