当前位置:网站首页>Introduction to asynchronous task capability of function calculation - task trigger de duplication
Introduction to asynchronous task capability of function calculation - task trigger de duplication
2022-07-04 03:47:00 【InfoQ】
Preface
Talking about task de duplication

- At-Most-Once: Ensure that the message is delivered at most once . When the network partition appears 、 When system components are down , Message loss may occur ;
- At-Least-Once: Ensure that the message is delivered at least once . The messaging link supports error retry , The message retransmission mechanism is used to ensure that the downstream must receive the upstream message , But in the case of downtime or network partition , May cause the same message to be delivered multiple times .
- Exactly-Once Mechanism can ensure that the message is sent exactly once , Accurate once does not mean that there is no retransmission in the case of downtime or network partition , Instead, retransmission does not change the state of the receiver , It is the same as the result of one transmission . In actual production , It often depends on retransmission mechanism & The receiver removes the duplicate ( idempotent ) To achieve Exactly Once.
- System side support : Task scheduling system itself failover It does not affect the correctness and uniqueness of message delivery ;
- Provide users with a mechanism , It can be combined with business scenarios , Trigger the whole business logic + Perform to heavy .
Function to calculate the implementation background of asynchronous task trigger de duplication

- System side support : Steps in 2.1 - 3.1 in , Of any intermediate process Failover Only one step can be triggered 3.2 Implementation , That is, the user instance will be scheduled to run only once ;
- User side application level de duplication capability : It can support users to repeatedly execute steps 1, But it will only be triggered once step 3.2 Implementation .
The system side is upgraded gracefully & Failover When the task distribution to re guarantee
- The uniqueness of consumption : Each message in each queue is consumed , Will enter “ Invisible mode ”. In this mode , This message is not available to other consumers ;
- The actual consumer of each message needs to update the invisible time of the pattern in real time ; When the consumer is finished , Delete the message to be displayed .

- Calculate the scheduling strategy of the load balancing module according to the function , Listen to the queue for which you are responsible ;
- When a message appears in the queue , Pull the news , And maintain a state in memory : Until the message consumption is completed ( The user instance returns the result of function execution ) front , The visible time of continuously updating messages , Make sure that the message does not appear in the queue again ;
- When the task is completed , Show delete this message .

- If the message has not been delivered to the user's execution instance ( chart 2 Step in 3.1 ~ 3.2), So when this one Scheduler The responsible queue is used by others Scheduler After picking up , The message will reappear after the consumption visible period , therefore Scheduler 2 The message will be retrieved again , Do the following triggering .
- If the message has already started executing ( step 3.2), When the news is in Scheduler 2 After it reappears in , We rely on users VM Medium Agent Conduct status management . here Scheduler 2 The corresponding Agent Send execution request ; here Agent It is found that the message already exists in memory , Then the execution request will be ignored , And inform you of the execution results through this link Scheduler 2, And then complete Failover The recovery of .
User side business level distribution de duplication is realized
- The message did not reach the function computing system , The task was not submitted successfully ;
- The message has reached the function calculation and is queued , Task submitted successfully , However, due to the timeout, the user cannot know the information about the successful submission .
import fc "github.com/aliyun/fc-go-sdk"
func SubmitJob() {
invokeInput := fc.NewInvokeFunctionInput("ServiceName", "FunctionName")
invokeInput = invokeInput.WithAsyncInvocation().WithStatefulAsyncInvocationID("TaskUUID")
invokeOutput, err := fcClient.InvokeFunction(invokeInput)
...
}
summary
1 minute Serverless Build real websites at top speed


Click on
here
, Direct experience !
边栏推荐
- [paddleseg source code reading] paddleseg calculates Miou
- Infiltration practice guest account mimikatz sunflower SQL rights lifting offline decryption
- system information
- CesiumJS 2022^ 源码解读[0] - 文章目录与源码工程结构
- EV6 helps the product matrix, and Kia is making efforts in the high-end market. The global sales target in 2022 is 3.15 million?
- Have you entered the workplace since the first 00???
- Summary of Chinese remainder theorem
- Package details_ Four access control characters_ Two details of protected
- Jenkins configures IP address access
- 2022 Guangxi provincial safety officer a certificate examination materials and Guangxi provincial safety officer a certificate simulation test questions
猜你喜欢
Es network layer
Rhcsa day 2
CesiumJS 2022^ 源码解读[0] - 文章目录与源码工程结构
Go 语言入门很简单:Go 实现凯撒密码
2022-07-03: there are 0 and 1 in the array. Be sure to flip an interval. Flip: 0 becomes 1, 1 becomes 0. What is the maximum number of 1 after turning? From little red book. 3.13 written examination.
What kind of experience is it when the Institute earns 20000 yuan a month!
Development of digital collection trading platform development of digital collection platform
Cache general management class + cache httpcontext Current. Cache and httpruntime Differences between caches
Explain AI accelerator in detail: why is this the golden age of AI accelerator?
logistic regression
随机推荐
三菱M70宏变量读取三菱M80公共变量采集三菱CNC变量读取采集三菱CNC远程刀补三菱机床在线刀补三菱数控在线测量
Leetcode51.n queen
Typical applications of minimum spanning tree
【.NET+MQTT】.NET6 環境下實現MQTT通信,以及服務端、客戶端的雙邊消息訂閱與發布的代碼演示
New year's first race, submit bug reward more!
Detailed explanation of PPTC self recovery fuse
2022 attached lifting scaffold worker (special type of construction work) free test questions and attached lifting scaffold worker (special type of construction work) examination papers 2022 attached
Don't disagree, this is the most powerful "language" of the Internet
Summary of Chinese remainder theorem
What is the difference between enterprise wechat applet and wechat applet
Jenkins configures IP address access
JSON string conversion in unity
用于TCP协议交互的TCPClientDemo
Add IDM to Google browser
Objective-C description method and type method
ctf-pikachu-CSRF
[paddleseg source code reading] paddleseg calculation dice
system information
[database I] database overview, common commands, view the table structure of 'demo data', simple query, condition query, sorting data, data processing function (single row processing function), groupi
How to use websocket to realize simple chat function in C #