150 points · by joshbaptiste · 13y ago · 63 comments
When this was released last year, ruby[1], jruby[2] and rubinius[3] all switched to siphash[4]. Looking at [5] mentions tomcat, .NET, PHP, etc. all switching away from MurmurHash.
(I'm not saying one would HashDoS one's own database, I'm merely pointing out that MurmurHash3 wasn't _designed_ with low collision rates in mind [siphash is, though])
[0] http://emboss.github.com/blog/2012/12/14/breaking-murmur-has...
[1] http://www.ruby-lang.org/en/news/2012/11/09/ruby19-hashdos-c...
[2] http://jruby.org/2012/12/03/jruby-1-7-1.html
[3] https://github.com/rubinius/rubinius/commit/a9a40fc6a1256bcf...
[4] https://131002.net/siphash/
[5] http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2011-481...
[edit: formatting]
There is a difference between "low collision rate" and "collision resistance".
Real-world data often contain regular patterns that can cause "bad" hash functions to give very non-random output, e.g. numbers at fixed intervals, pointers all aligned to 4k boundaries, or long strings that differ only by a short suffix.
For instance, early versions of Java would sample only a few of the characters in a long string to calculate the hash code, which caused horrendous performance if you stored a bunch of related file paths in a hash map.
Most hash functions try to avoid bad behaviour on this kind of good-natured input, but some are better at it than others, due to careful design for random-like distribution, and low collision rates.
http://www.strchr.com/hash_functions has examples of collision rates for different hashes, all non-cryptographic.
http://docs.python.org/3/whatsnew/3.3.html#summary-release-h...
That said, it's a fine hash function if you're not worried about malicious keys.
As someone in the thread below wrote, Murmur is good if you don't worry about malicious keys (it is not cryptographic, and doesn't claim to be).
I don't worry about malicious keys :)
Further, _any_ hash, even cryptographic, will not protect you if it is not used with a random seed unknown & unpredictable to the attacker.
Also, great choice for searchability: "go god." You guys are so clever!
http://www.biblicalheritage.org/bible%20studies/10%20command...
It has its root in 'Go database', and began as a working name that I never had time to replace...
None of those are best for all workloads. There are situations where using a radix-tree is actually faster than a hashtable with a good hash function, and situations where it is slower than a red-black tree.
Do you really need data to be ordered? Why do you care about having "close" data on the same node?
And to avoid having a separate structure for the Merkle trees I just hash all nodes in the main tree, and compare the hashes to find differences.
Thus the same content must have the same structure, or the comparisons won't work.
Why not call it Heaven? It's got clouds.
$ apt-cache search god | grep "^god"
god - Fully configurable process monitoring
[1] http://packages.debian.org/search?keywords=god&searchon=...[2] http://packages.ubuntu.com/search?keywords=god&searchon=...
I have yet to find a bunch of equally powerful machines to perform a proper scalability benchmark :/
Also a 5 second Googling shows there's ways to set Redis up to stop writing but continue reading if you're running out of memory. If you really have that large memory needs then you're going to also run out of memory with this new lib on 1 machine.
It seems like Redis has more than enough options to prevent real problems from occurring once you do surpass your hardware requirements.