Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Cache updating method and system based on Canal

An update method and cache technology, applied in the computer field, can solve the problem of high database load, achieve the effect of improving the reading speed, increasing the update frequency, and avoiding excessive load

Inactive Publication Date: 2019-01-18
CTRIP COMP TECH SHANGHAI
View PDF5 Cites 15 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0006] The technical problem to be solved by the present invention is to provide a Canal-based cache update method and system in order to overcome the defect that the cache update in the prior art easily causes the database load to be too high

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
  • Cache updating method and system based on Canal
  • Cache updating method and system based on Canal
  • Cache updating method and system based on Canal

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0042] This embodiment provides a Canal-based cache update method, such as figure 1 As shown, Canal-based cache update methods include:

[0043] Step 101, the database generates an update log after the data field is changed, and the update log includes the changed value of the data field.

[0044] The database of the present embodiment is a MySQL database, and when MySQL internal additions, deletions, changes, etc. have updated content records to the MySQL database, a binary log (binary log file) update log can be generated to record the above-mentioned changes of the database.

[0045] Step 102, using Canal to read the database to obtain the updated diary;

[0046] More specifically, as figure 2 As shown, step 102 includes:

[0047] Step 1021, Canal sends an update command to the database;

[0048] Step 1022, the database receives the update instruction and sends the update log to Canal.

[0049] Canal simulates the interactive protocol of MySQL slave (master), and pret...

Embodiment 2

[0062] This embodiment provides a Canal-based cache update system, such as Figure 4 As shown, the Canal-based cache update system includes a change module 201 , a read module 202 , a parse module 203 , an update module 204 and an application module 205 .

[0063] The change module 201 is used to generate an update log when the data field is changed in the database, and the update log includes the changed value of the data field.

[0064] The database of the present embodiment is a MySQL database, and when MySQL internal additions, deletions, changes, etc. have updated content records to the MySQL database, a binary log (binary log file) update log can be generated to record the above-mentioned changes of the database.

[0065] The reading module 202 is used to use Canal to read the database to obtain the update log.

[0066] More specifically, the reading module 202 is also configured to use the Canal to send an update instruction to the database, and use the database to rec...

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 discloses a cache updating method and a system based on Canal. The cache updating method based on Canal comprises the following steps: S1, an updating diary is generated after a databasechanges a data field, and the updating diary includes a change value of the data field; S2, reading the database by Canal to obtain the update diary; S3, parseing the update journal by Canal to obtain the change value, and sending the change value to the message queue; S4, receiving and sending the change value to the message consuming end by the message queue, receiving and sending the change value to the cache by the message consuming end, and updating the change value by the cache. The invention utilizes Canal and message queue, When updating the saved data in the database, the changes ofthe data is timely and accurately monitored, and the updated data is updated in the cache synchronously, so as to avoid the defect of excessive load on the database caused by constantly querying the database, improve the updating frequency of the cache, and further improve the server and the reading speed of the cache.

Description

technical field [0001] The present invention relates to the computer field, in particular to a cache update method and system based on Canal (a binary log-based incremental log component). Background technique [0002] In existing data projects, databases are widely used. In most cases, the frequency of reading and writing of databases is more reads and less writes. Read operations generally include some complex judgment conditions, so the database will respond slowly when querying the database. Case. [0003] In order to improve the query speed of the database, a cache service is usually placed in front of the database to store the data of the database in the cache with a fast reading speed, which can effectively increase the data reading speed and improve the reading performance of the database. [0004] Caching can improve the overall performance of the database, but it also brings other problems. For example, after using the cache, it is equivalent to storing two copie...

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
Patent Type & Authority Applications(China)
IPC IPC(8): G06F16/23G06F16/2455G06F16/28
Inventor 谢炀炀刘诚
Owner CTRIP COMP TECH SHANGHAI
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products