什么时候节点检查点本身

When does a node checkpoint itself

我知道有一些与 @Suspendable 相关的注释可以将函数标记为可序列化。流量检查点本身有多少?

只有在等待响应时有 send/sendAndReceive 时,节点才会检查自己吗?或者它是否每隔一段时间序列化检查点?

给定一个除了计算什么都不做的流程,它serialise/write到磁盘的数量是多少,如果其他线程执行 vault [=28] 的峰值负载为 read/write,这是否会影响性能=].

@Suspendable 如何在这些只做计算而不做其他事情的私有方法中发挥作用。如果一个方法被注释,它只会在下一个 send 上序列化,否则什么都不会序列化?

例子

@Suspendable
override fun call() {
        val states = querySomeStates()
        computeSomethingHeavy(states)
        decideSomething()
}

@Suspendable
private querySomeStates()

@Suspendable
computeSomethingHeavy()

@Suspendable
decideSomething()

@Suspendable 将函数标记为 可能 可暂停。只有在执行以下操作之一时,流程才会实际上暂停:

  • 流程开始
  • send
  • receive
  • sendAndReceive
  • waitForLedgerCommit
  • getFlowInfo
  • sleep

执行这些操作之一时,节点使用 Quasar 捕获执行堆栈并创建检查点。如果函数不执行任何这些操作,则不会创建检查点。即使流程正在执行繁重的计算 and/or 函数也被标记为 @Suspendable,这也是正确的。换句话说,Quasar 不会 进行抢占,这意味着我们不会 "checkpoint periodically",但只在特定的调用站点。

例如,这是一个简单流程中的检查点序列:

@Suspendable fun call() { // checkpoint! sendSomething() computeSomething() } @Suspendable fun sendSomething() { send() // checkpoint! } @Suspendable fun computeSomething() { heavyComputation() // no checkpoint! }