actor

_
timcharper
1月 20 02:18

    @timcharper , so what app the actor model can help, and what app the thread modle can help, could you please give me some advice? say, a heavy traffic app, for example a instant message server is ok using actor model, bussy logic is not very complicated. :point_up: January 18, 2016 10:39 PM

@bonafideyan depends on the properties of your system. If you have high concurrency, using the actor model can allow you to manage mutable state without needing to use mutexes, and also can run more efficiently since it can allow a single core to be devoted to a single task (reducing expensive context switches). It does this with relatively low overhead. Avoiding locks is almost always a win nowadays because it allows you to horizontally scale your processes better.

Also, the actor model is more elastic than, say, what Kafka provides. In Kafka, you can't modify partitions on the fly, and partitions are effectively round-robin. (if you have a consumer group processing a partition quickly, then they can't just use their spare resources to help out with the other partition). etc. So, Kafka has lower overhead because it has a simpler model for distributing messages, but with that simpler model comes constraints that may not work for your well for your needs.
In general, I would probably pick Kafka something that did high data throughput (log processing), was processed asynchronously, and has with more lenient SLAs (in terms of data freshness). If you require something more real-time, I'd go with the Actor model.

原文地址:https://www.cnblogs.com/jvava/p/5161299.html