Which are the kind of applications/services/components where the Actors model (Scala, Erlang) is best suited for?
Besides the benefits of this model over the shared-memory model, I'm just trying to understand where开发者_运维百科 to apply it for higher levels use-cases.
As to Scala, Actors model fits most of the multi-threaded cases one can think about:
- Swing GUI application
- Web Applications (see Lift framework)
- Application Server in multicore environment:
- Batch processing of requests/data
- Background tracking tasks
- Notifications & Scheduled tasks
Actors model makes design much clearer and greatly simplifies interprocess communication.
OTP Framework : Provides really good framework for network based applications.
Helps in making fault tolerant applications . (process restart using Supervisor's in OTP).
Both Synchronous and Asynchronous modes of communication can be done using gen_server.
Event based callbacks can be used using gen_event.
State machine can be programmed easily using gen_fsm (In case you need to follow some states in your application).
A process crash does not bring the whole application down. Only that particular process crashes.
Functional programming language.
A lot easier to program at binary level.
Garbage collection.
Native compilation option.
Fair amount of good useful modules are available.
Able to make good solid concurrent applications easily.
And lots more.... I really enjoyed working on some applications in erlang , making those in c/c++ would have been very difficult.
精彩评论