The Trouble with Erlang Concurrency
tfox.org
tfox.org
This article takes a deeply interesting problem (paradigms in distributed computing) and manages to discuss nothing of substance.
The fact that Mnesia isn't mentioned once indicates the author is insufficiently knowledgeable about Erlang to write an informed article. This isn't an ad hominem attack because he didn't even mention Mnesia, hence this is an attack on the content of the article rather than his credentials.
(This rather anal mention of ad hominem is relevant because the author brings it up in the comments).
To those that follow, you'll learn more reading:
Erlang - mnesia (Erlang documentation) http://www.erlang.org/doc/man/mnesia.html
CAP theorem https://secure.wikimedia.org/wikipedia/en/wiki/CAP_theorem
And, of course, if you want to use something that someone has "just done", you would simply use Riak, which uses Erlang to implement an Amazon Dynamo type distributed key-value store:
Not that difficult. A few Google's and you're set.
EDIT: On reading my post I realise that Mnesia is an OTP application, rather than an Erlang built-in, and that Riak is an Erlang-based 3rd party library. However, using canonical libraries is part-and-parcel with learning about a language, IMO.
That said, the author has a point. But by privileging actors as much as it does, Erlang gets a lot of great stuff out of it that have no effective competition in other languages, OTP in particular. Haskell may offer every sensible concurrency construct under the sun, but you don't get OTP to speak of. (Some efforts are underway, but they are new and I'd be surprised if they are stable yet.) Erlang is definitely niche, but it fits that niche very well and the niche is larger than it may initially appear... but it certainly isn't the best choice for all purposes. Nothing is, and nothing can be. The argument is a bit klunky but the point is still ultimately correct.
I do not see, why you cannot replicate the ConcurrentHashMap behavior in Erlang?
> Now, you could do some clever stuff and partition the map up into N actual maps, one for each of N processes and farm the requests out to the set of processes based on the hash-code. But that’s getting complex[...].
Well, his problem seems to be that nobody has already included something like this in Erlang/OTP, whereas there is java.util.concurrent.ConcurrentHashMap since Java 5. That is an issue with the standard library, but not a flaw of the Actor model. This "clever stuff" is present in ConcurrentHashMap, too.
That's not even close to true. Getting different building blocks from a language/runtime is not the same as not getting any building blocks.
Erlang absolutely thrashes the JVM with it's concurrency features, and easily extends across cores and machines like not much else.
As an example of this, how to write a mutex in erlang: http://james-iry.blogspot.com/2009/04/erlang-style-actors-ar...
on a side note, ConcurrentHashMap in java also ends up using a hashing scheme to locate the appropriate segment for queries.
another approach to partitioning the keys would be to use a bloom-filter. nodes can periodically exchange their filter-databases either in its entirety or a compressed delta etc.