当前位置:网站首页>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 !
边栏推荐
- SQL语句加强练习(MySQL8.0为例)
- MySQL one master multiple slaves + linear replication
- JVM family -- monitoring tools
- Rhcsa day 3
- Development of digital collection trading platform development of digital collection platform
- [.NET + mqtt]. Mise en œuvre de la communication mqtt dans l'environnement net 6 et démonstration de code pour l'abonnement et la publication de messages bilatéraux du serveur et du client
- [paddleseg source code reading] normalize operation of paddleseg transform
- Deep thinking on investment
- pytest多进程/多线程执行测试用例
- [PaddleSeg 源码阅读] PaddleSeg计算 mIoU
猜你喜欢

Package details_ Four access control characters_ Two details of protected

Third party login initial version

JSON string conversion in unity

Don't disagree, this is the most powerful "language" of the Internet

How about the ratings of 2022 Spring Festival Gala in all provinces? Map analysis helps you show clearly!

postgresql 用户不能自己创建表格配置

Detailed explanation of PPTC self recovery fuse

ctf-pikachu-CSRF

用于TCP协议交互的TCPClientDemo

Easy to win insert sort
随机推荐
How much does it cost to open a futures account in China? Where is it safe to open an account at present?
Rhcsa day 2
Constantly changing harmonyos custom JS components during the Spring Festival - Smart Koi
Management and thesis of job management system based on SSM
“软硬皆施”,助力建成新型云计算数据中心
Teach you how to optimize SQL
ctf-pikachu-CSRF
A review of reverse reinforcement learning at Virginia Tech (VT)
pytest多进程/多线程执行测试用例
疫情来袭--远程办公之思考|社区征文
Wechat official account web page authorization
Leecode 122. Zuijia timing of buying and selling stocks ②
How about the ratings of 2022 Spring Festival Gala in all provinces? Map analysis helps you show clearly!
渗透实战-SQLServer提权
MySQL is dirty
CSP drawing
What is the difference between enterprise wechat applet and wechat applet
How to use STR function of C language
[paddleseg source code reading] paddleseg calculates Miou
[paddleseg source code reading] normalize operation of paddleseg transform