最多一次和恰好一次 [英] at-most-once and exactly-once

查看:253
本文介绍了最多一次和恰好一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究分布式系统,当涉及到RPC部分时,我已经听说过这两种语义(最多一次和完全一次).我了解,当我们不想重复执行时,实例数据库最多只能使用一次.

I am studying Distributed Systems and when it comes to the RPC part, I have heard about these two semantics (at-most-once and exactly-once). I understand that the at-most-once is used on databases for instances, when we don't want duplicate execution.

第一个问题:

这是如何实现的?服务器如何知道它不应该再次执行请求?它可能是重复的,但也可能是合法请求.

How is this achieved? How does the server know that it shouldnt execute the request again? It might be a duplicate but it might be a legitimate request as well.

第二个问题是:

标题中两种语义之间的区别是什么?我会读 :).我知道最多可能根本不执行一次,但是,一次执行到底可以保证执行什么呢?

What is the difference between the two semantics in the title? I can read :). I know that at-most-once might not be executed at all but, what does exactly-once do that guarantees the execution?

推荐答案

在语义最多为一次的情况下,在失败的情况下会再次发送请求,但请求会在服务器上被过滤以获取重复项

In cases of at most once semantics, request is sent again in case of failure, but request is filtered on the server for duplicates.

语义恰好一次中,再次发送请求,对请求进行重复过滤,并保证服务器在发生故障后重新启动并从崩溃的地方开始处理请求.

In exactly once semantics, request is sent again, request is filtered for duplicate and there is a guarantee for the server to restart after failure and start processing requests from where it crashed.

但是仅一次是无法实现的,因为客户端发送请求时以及到达服务器之前,服务器崩溃.无法跟踪请求.

But exactly once is not realizable because what happens when client sends request, and before it reaches the server, server crashes. There is no way of tracking the request.

http://de.wikipedia.org/wiki/Remote_Procedure_Call#Fehlersemantik

这篇关于最多一次和恰好一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆