The Artima Developer Community
Sponsored Link

Programming in Scala Forum
Multi-actor single queue

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Peter Monks

Posts: 1
Nickname: pmonks
Registered: Jun, 2009

Multi-actor single queue Posted: Jun 6, 2009 9:27 PM
Reply to this message Reply
Advertisement
G'day everyone,

Apologies in advance if this has been asked before or is a n00b question.

To learn Scala, I'm considering re-implementing a little Java app that uses the SEDA architecture [1], and am not sure if/how I might use actors to implement it. Basically it's a batch application that processes a reasonably large amount of data, and I've broken that processing down into various stages that are quite independent of one another and vary between being I/O bound (both network and disk) and CPU bound.

In the Java app, each stage has a single queue feeding a dedicated thread pool, and each thread pool is sized to try to maximise usage of all three resources (disk, network and CPU). The logic running on each thread within a stage is identical, and there's a clean hand-off between each stage that ensures there's no shared mutable state (either within a single stage or between multiple stages).

Are actors suitable for this kind of thing? Are they re-entrant (so I only need one actor per stage, potentially running concurrently with itself) or can I instantiate multiple actors and hook them all up to a single message queue (so that producers are decoupled from the actor instances)? Is there a different approach that better maps to actor based concurrency?

Cheers,
Peter

[1] http://www.eecs.harvard.edu/~mdw/papers/seda-sosp01.pdf

Topic: New Forum for Scala Programmers Previous Topic   Next Topic Topic: erlang vs scala

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use