简体   繁体   English

了解Akka容错

[英]Understanding Akka Fault Tolerance

I am digging into Akka and was just looking at their fault tolerance example , and am trying to understand it. 我正在研究Akka ,只是在看他们的容错示例 ,并试图理解它。

  1. Why couldn't I just implement all those same types ( Worker , Listener , CounterService , etc.) in "pure Java" (no Akka). 为什么我不能只在“纯Java”(没有Akka)中实现所有相同的类型( WorkerListenerCounterService等)。 What infrastructure is Akka adding here out of the box? Akka开箱即用地添加了什么基础架构?
  2. In that diagram, what does Storage represent? 在该图中, Storage代表什么? An RDBMS? RDBMS? A Java app monitoring an RDBMS? 监视RDBMS的Java应用程序? A JDBC driver? JDBC驱动程序?
  3. That's great if Storage is a Java app and can throw a StorageException back to requesters, but what if the network between Storage and CounterService is severed or has transport-level issues? 如果Storage是一个Java应用程序,并且可以将StorageException返回给请求者,那就太好了,但是如果StorageCounterService之间的网络断开或出现传输级问题怎么办? Does this whole diagram still work (if so, how?!? ) or does Akka only provide "application-layer" fault tolerance? 整个图是否仍然有效(如果可以, 怎么办?!? )还是Akka仅提供“应用程序层”容错? In the latter case, how can Java/Akka handle hardware- or network-level failures? 在后一种情况下,Java / Akka如何处理硬件或网络级别的故障?
  1. Akka is based of the design pattern of actors, you can implement this pattern yourself, just like you could with MVC. Akka基于参与者的设计模式,您可以自己实现此模式,就像使用MVC一样。 I would say the best thing akka does for you is all the reactive stuff that will minize the amount of resources actors need. 我想说akka对您来说最好的事情是所有反应性的东西,这些东西将减少参与者所需的资源量。

  2. You can consider Storage as just being state or holding some state of the application. 您可以将存储视为状态或保持应用程序的某种状态。

  3. I think the main thing people refer to when they talk about fault tolerance is that because you can easily have distrubuted actors, and use something like the reliable proxy pattern http://doc.akka.io/docs/akka/snapshot/contrib/reliable-proxy.html you make your application in a way that it will keep functioning untill the very last node dies, and you wont lose any messages if you always implemented that pattern. 我认为人们在谈论容错时要提到的主要内容是,因为您可以轻易地分散参与者,并使用可靠的代理模式http://doc.akka.io/docs/akka/snapshot/contrib/可靠的代理.html ,使您的应用程序可以一直运行到最后一个节点死亡为止,并且如果您始终实施该模式,则不会丢失任何消息。 So it refers to message loss. 因此,它指的是消息丢失。 Everything is in terms of message in akka, you don't usually have requests that is not a very good idea because it is blocking, instead you use Futures if needed. 一切都是基于akka中的消息,您通常不会有一个不是一个好主意的请求,因为它正在阻塞,而是在需要时使用Future。 If your hardware stops functioning you wont retrieve the value of the future in the time you specify, and you can handle the failure yourself. 如果您的硬件停止运行,则您将无法在指定的时间内获取未来的价值,并且可以自行处理故障。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM