Earlier quoted context omitted.
Very readable for something so dense. Nice work! Thanks! you could return 1 on success, and keep returning something falsy on failure I come from an OS background, so to me 0 is success and non-zero is failure. It doesn't really matter which convention a project uses as long as it's consistent, so I documented this in my /STYLE file: "In general, functions should return (int)(-1) or NULL to indicate error."
Gotcha. I'm not an OS guy, and didn't know that convention. Thanks! Dumb question though: If rehash can only return -1 or 0, won't if(rehash(H)) always fail?
Storing hundreds of millions of simple key-value pairs in Redis
51–55 of 55 posts
Re: Storing hundreds of millions of simple key-value pairs in Redis
#52Earlier quoted context omitted.
You're probably wrong. Look at the comment above "stretches" here: https://github.com/binarylogic/authlogic/blob/master/lib/aut... This is crypto-related code in of the most popular Rails authentication gems. And this is one among many examples. I'm sure you've already come across something like that more than once. I trust code rather than comments. At least it doesn't lie.
Fixed :-) https://github.com/binarylogic/authlogic/commit/f52a699bbc9e...
Re: Storing hundreds of millions of simple key-value pairs in Redis
#53Why use clear text numbers? Most of the time, you're going to be using large numbers, so binary pack them as save more space. i had the same issue, normal storage was 1.1gb of space, HSET down to 200mb and binary packing every integer down dbl() bought it right down to 163mb of memory (32bit instance). For that 163mb, I was slicing a md5 of the field for the hset prefix, packing that and then using the remainer as th…
Re: Storing hundreds of millions of simple key-value pairs in Redis
#54Why use the whole Media ID as the key within the bucket, rather than just the last three digits?
Re: Storing hundreds of millions of simple key-value pairs in Redis
#55Earlier quoted context omitted.
build a finite state machine from the dataset Could you elaborate on that? Or provide a link for the novice?
Sure, I implemented the paper "How to squeeze a lexicon" http://www.n3labs.com/pdf/lexicon-squeeze.pdf with a few tweaks a while back. It uses a simple fixed format for all nodes, which works very well for datasets which contains many common prefixes and suffixes. For example, a polish dictionary containing 1.3 million strings is compressed down to 726KB. One of the thing I'm using it for is in a database for geopip…