Link Details

I spent a fair amount of time developing actor-based systems recently, specifically with the Scala Actor library. Regardless of whether you are implementing actors with the Scala library, Akka, Lift or Scalaz, some basic gotchas can present themselves until you get a feel for what you're doing. Here are some of them that I've learned the hard way.

Posted by twr@chariotsolutions.com  |   Jul 07 2011 / 04:42

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Comments

User 393686 avatar

RawThinkTank replied ago:

He forgot to mention how to spawn a thread on a particular core for an actor.

Reply 0 votes
User 759731 avatar

shinolajla replied ago:

@RawThinkTank FYI, I'm the author of the post, just wanted to respond to your point. I assume you're using thread-based actors when spawning for a particular core. Can you share a use case for when you would want to do this? Is it to for cache coherence?

Note that I've only used event-based actors in production with a shared thread pool.

Reply 0 votes
User 393686 avatar

RawThinkTank replied ago:

i dont know if its even possible, but if its not then the writing is clear on the walls that days of JVM are numbered.

its obvious that people are gona move to platforms that allow them to write multicore concurrent programs instead of just paralleling serial ones and pseudo concurrency that has no control over cores.

Reply -1 votes
User 279247 avatar

bclapper replied ago:

Right. Erlang isn't popular at all. Scala's increasing adoption on the JVM is clearly an anomaly. Microsoft's rolling out F# is laughable and stupid.

Instead of bloviating pointless responses like this, why not write a well-researched, well-written blog article of your own, one that attempts to set forth your position logically and coherently?

Assuming, of course, that you're capable of doing so. I'm dubious...

Reply 0 votes
User 279247 avatar

bclapper replied ago:

There are ways to dedicate a thread to an actor. But as for dedicating an actor or a thread to a core--are you really sure you can do a better job of processing and thread scheduling than the operating system?

If so, I await your blog post(s).

Reply 0 votes
User 279247 avatar

bclapper replied ago:

There are ways to dedicate a thread to an actor. But as for dedicating an actor or a thread to a core--are you really sure you can do a better job of processing and thread scheduling than the operating system?

If so, I await your blog post(s).

Reply 0 votes
User 759731 avatar

shinolajla replied ago:

In reviewing the LMAX architecture, I think I'm getting a fundamental grip on where you're going with this. It's worth noting that LMAX built their system on the JVM with highly-tuned Java, though.

However, controlling cores comes with a price. LMAX's architecture works because they have a balanced flow of operations that a single core can work on. If your flow is unbalanced, you need the ability to switch contexts via waits or ForkJoin. Or possibly actors.

I guess my point is that you have to choose your architecture by the needs of your system. Actors are a composable abstraction for concurrency that work well in systems with certain performance characteristics, even heavy load. For extreme cases (like LMAX), they're not a good fit.

Reply 0 votes

Recommended Links

Scala
Written by: Ryan Knight
Featured Refcardz: Top Refcardz:
  1. Apache Hadoop
  2. Play
  3. Akka
  4. Debugging JavaScript
  5. Design Patterns
  1. Apache Hadoop
  2. REST
  3. Java
  4. Git
  5. Java Performance
Connect with DZone