Unlock instant, AI-driven research and patent intelligence for your innovation.

Method for realizing timed task atomicity by using database lock

A timed task and database technology, applied in the information field, can solve problems such as business data inconsistency, data inconsistency, affecting task execution schedules, etc., to avoid dirty data problems, ensure uniqueness, and easy to implement methods.

Pending Publication Date: 2021-12-24
紫光云技术有限公司
View PDF7 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0002] With the development of computer applications, application services have already shifted from monolithic services to microservice architectures. Early monolithic services had many disadvantages, and service maintenance was difficult. The emergence of microservice architectures solved the disadvantages of monolithic services, but in many When the replica service executes the scheduled task, there will be the following problems: (1), when multiple copies execute the same scheduled task at the same time, the same task will be executed multiple times at the same time point, and there will be inconsistency in the data updated by each service, which will directly The problem of making business data inconsistent; (2), multiple copies pull a large amount of data from remote services at the same time, and write them into the database, and a large amount of repeated data is written into the database, which increases the processing pressure of the database and affects the task execution schedule; therefore , there is an urgent need for a method of using database locks to realize the atomicity of timed tasks

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method for realizing timed task atomicity by using database lock
  • Method for realizing timed task atomicity by using database lock
  • Method for realizing timed task atomicity by using database lock

Examples

Experimental program
Comparison scheme
Effect test

no. 1 example

[0027] For a first example, see figure 1 with figure 2 As shown, the present invention provides a method for utilizing database locks to realize the atomicity of timed tasks, including the following steps: S1, setting multiple groups of virtual machine nodes, each group of virtual machine nodes is equipped with an ntp server, and multiple nodes deploy the ntp server , the purpose is to keep the multi-node time consistent, the multi-node time consistency ensures the time lock consistency of the scheduled tasks of multiple copies, and maintains task consistency;

[0028] S2. Set a time lock for the timed task generated in step S1, and set a time specification corresponding to the time lock of the timed task;

[0029] S3. According to the time specification in step S2, set the primary key of the time lock, set the timed task with the time lock to preempt the database row-level lock, set the time lock field as the primary key in the database, and ensure the uniqueness of the tim...

no. 2 example

[0043] In the second embodiment, an electronic device includes a processor, and a memory that communicates with the processor and stores instructions executable by the processor. The steps of a method for realizing the atomicity of a timed task by using a database lock are described.

no. 3 example

[0044] In the third embodiment, a server includes at least one processor, and a memory communicated with the processor, the memory stores instructions executable by the at least one processor, and the instructions are processed by the processor The processor executes, so that the at least one processor executes the steps of the method for implementing the atomicity of the timed task by using the database lock described in the first embodiment.

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention provides a method for realizing timed task atomicity by using a database lock, and the method comprises the following steps: S1, setting a plurality of groups of virtual machine nodes, and deploying an ntp server on each group of virtual machine nodes; S2, setting a time specification corresponding to the timing task time lock; S3, setting a time lock main key, and setting a timing task of a time lock to preempt a database row-level lock; S4, according to a time lock return result in the step S3, judging whether the task is preempted or not; S5, enabling the timed task preempting the time lock to enter a task execution queue and execute the task, wherein the timed task which does not preempt the time lock gives up the task executed this time; S6, updating the lock data after the task is executed, and checking a task execution result. According to the method, based on the timed task characteristics, the timed task time lock is integrated with the database row-level lock to realize the atomicity of the timed task, and the uniqueness of the service timed task under the condition of multiple copies is ensured, so that the problem of dirty data caused by the timed task is avoided.

Description

technical field [0001] The invention belongs to the field of information technology, and in particular relates to a method for realizing the atomicity of timed tasks by using database locks. Background technique [0002] With the development of computer applications, application services have already shifted from monolithic services to microservice architectures. Early monolithic services had many disadvantages, and service maintenance was difficult. The emergence of microservice architectures solved the disadvantages of monolithic services, but in many When the replica service executes the scheduled task, there will be the following problems: (1), when multiple copies execute the same scheduled task at the same time, the same task will be executed multiple times at the same time point, and there will be inconsistency in the data updated by each service, which will directly The problem of making business data inconsistent; (2), multiple copies pull a large amount of data fro...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06F16/23G06F9/50G06F9/48
CPCG06F16/2322G06F9/4887G06F9/5038Y02D10/00
Inventor 李伟伟
Owner 紫光云技术有限公司
Features
  • R&D
  • Intellectual Property
  • Life Sciences
  • Materials
  • Tech Scout
Why Patsnap Eureka
  • Unparalleled Data Quality
  • Higher Quality Content
  • 60% Fewer Hallucinations
Social media
Patsnap Eureka Blog
Learn More