我们使用称为disposable actors
的模式:
- 为每个申请请求创建一个新的临时参与者.
- 该参与者可能会创建其他参与者来执行与请求相关的某些工作.
- 处理后的结果发送回客户端.
- 与此请求有关的所有临时演员都被杀死.那就是使用
PoisonPill
的地方.
- A new temporary actor is created for each application request.
- This actor may create some other actors to do some work related to the request.
- Processed result is sent back to client.
- All temporary actors related to this request are killed. That's the place where
PoisonPill
is used.
创建一个actor意味着非常低的开销(大约300个字节的RAM),因此这是一个很好的实践.
Creating an actor implies a very low overhead (about 300 bytes of RAM), so it's quite a good practise.