当前位置:网站首页>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 !
边栏推荐
- Typical applications of minimum spanning tree
- Add IDM to Google browser
- Have you entered the workplace since the first 00???
- Zhihu million hot discussion: why can we only rely on job hopping for salary increase? Bosses would rather hire outsiders with a high salary than get a raise?
- CUDA basic knowledge
- Monitoring - Prometheus introduction
- Audio and video technology development weekly | 232
- postgresql 用户不能自己创建表格配置
- Development of digital collection trading platform development of digital collection platform
- Leecode 122. Zuijia timing of buying and selling stocks ②
猜你喜欢
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.
In my spare time, I like to write some technical blogs and read some useless books. If you want to read more of my original articles, you can follow my personal wechat official account up technology c
Easy to win insert sort
Webhook triggers Jenkins for sonar detection
Zhihu million hot discussion: why can we only rely on job hopping for salary increase? Bosses would rather hire outsiders with a high salary than get a raise?
基于PHP的轻量企业销售管理系统
[PaddleSeg 源码阅读] PaddleSeg 自定义数据类
Objective-C description method and type method
SQL statement strengthening exercise (MySQL 8.0 as an example)
Add IDM to Google browser
随机推荐
Which product is better for 2022 annual gold insurance?
'2'>' 10'==true? How does JS perform implicit type conversion?
vue多级路由嵌套怎么动态缓存组件
“软硬皆施”,助力建成新型云计算数据中心
Katalon框架测试web(二十六)自动发邮件
[source code analysis] model parallel distributed training Megatron (5) -- pipestream flush
MySQL is dirty
Detailed explanation of PPTC self recovery fuse
Objective-C member variable permissions
图解网络:什么是热备份路由器协议HSRP?
[PaddleSeg 源码阅读] PaddleSeg计算Dice
MySQL one master multiple slaves + linear replication
Learning video website
[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
Apple submitted the new MAC model to the regulatory database before the spring conference
MySQL query
深入浅出对话系统——使用Transformer进行文本分类
Add token validation in swagger
支持首次触发的 Go Ticker
Why is it recommended that technologists write blogs?