[erlang-questions] ETS & SMP was: Parallelism, SMP, and multicore question

Valentin Micic <>
Wed Sep 3 09:43:47 CEST 2008

Is ETS utilizing the same locking policy for all table types (namely: public, protected or private), and if so, would it be possible to relax locking for protected and private access? 

We've noticed that if more than one process requires an access to the same ets table (in SMP environment), the system slows down considerably due to the locking mechanism. It is quite possible to optimize this by fronting such a table with a dedicated process for request serialization -- works better as there is always only one proccess requesting a lock.  Actually... as much as this works well for one table, not so sure how would such an "optimization" work for a large number of tables. By relaxing (or not having) a locking policy for (at least) tables with a private access, there would be no questions about it.


  ----- Original Message ----- 
  From: Edwin Fine 
  Sent: Tuesday, September 02, 2008 7:09 PM
  Subject: [erlang-questions] Parallelism, SMP, and multicore question

  Since the cognoscenti are talking about parallelism, maybe someone can answer something that has been perplexing me.

  Sometimes it has been measurably faster on a multicore system to run one VM per core, each with SMP disabled (or +S 1), than it is to run one or more SMP VMs. This is true even when running code that is innately parallel. On the other hand, I have seen benchmarks that show near-linear speedups using SMP. 

  I don't have code to support this; it's just something I, along with a couple of other people -- for whom I don't want to speak -- have noticed in passing.

  Does anyone have any insight into the internals of SMP who can tell me when SMP might be an asset, and when a liability? I know this is a "how long is a piece of string" question, but even though it's pretty general, someone somewhere who really knows Erlang inside out (i.e. not me) must surely have encountered this phenomenon.

  Are there conditions where contention between the threads of the SMP processes (e.g. mutexes) becomes significant enough that multiple separate non-SMP VMs perform better? If so, what would those conditions be?

  Could it have anything to do with the mix of CPU-bound processes and inter-process messaging or network I/O? If so, please could someone explain the mechanism?



  erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080903/5004c2e5/attachment.html>

More information about the erlang-questions mailing list