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

Version-based data update method, device, electronic device and storage medium

A data update and data technology, applied in database update, electronic digital data processing, structured data retrieval, etc., can solve problems such as users seeing and nickname information not being updated in time, and achieve the effect of avoiding data inconsistency

Active Publication Date: 2022-05-13
VIRTAI TECH BEIJING CO LTD
View PDF6 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

For example, the user's nickname field is successfully updated in the database, but the corresponding nickname information in the cache is not updated in time, causing the user to see the old nickname

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
  • Version-based data update method, device, electronic device and storage medium
  • Version-based data update method, device, electronic device and storage medium
  • Version-based data update method, device, electronic device and storage medium

Examples

Experimental program
Comparison scheme
Effect test

Embodiment approach 1

[0034] Implementation mode 1: update the cache (cache) immediately after updating the database (db).

[0035] This implementation mode 1 can refresh the cache at the fastest speed, but in some high concurrency scenarios, such as figure 1As shown in the figure, the multiple operations of writing to the cache may be out of order due to network out-of-sequence or different processing time, etc., resulting in a problem of out-of-order and overwriting each other, resulting in data inconsistency.

[0036] Based on this, you can consider using methods such as memory locks / distribution locks to serialize operations. For example, operations such as write db (write database) and update cache (update cache) can be included in the scope of a lock in the application (app) code, so that the above-mentioned coverage problem will not occur. But the granularity of this lock is relatively large, because it includes several round-trips of network transmission and the time for database persisten...

Embodiment approach 2

[0037] Implementation 2: delete the cache after updating the db, this implementation is also called cache aside.

[0038] Embodiment 2 is relatively balanced, but in special scenarios, such as figure 2 As shown, there is also a situation where the cache is overwritten by the old version of the data, resulting in data inconsistency.

[0039] Based on this, it can be considered to add an expiration time to the cache, relying on the automatic expiration of the cache, so as to reduce the inconsistent time, but this implementation method does not fundamentally solve the problem.

Embodiment approach 3

[0040] Implementation mode 3: Return directly after updating the cache, and refresh to db asynchronously by an independent worker program. This implementation mode is also called write behind.

[0041] This implementation mode 3 can achieve fast writing speed and high throughput, but this implementation mode may also have long-term inconsistency between cache and db data, and there is a risk of data loss in some special scenarios , For example, before the worker program is refreshed to the db, the cache server is down, etc. And this implementation method also needs a set of track mechanism to identify which caches have been modified, and only refresh the modified cache data when refreshing the db, or only refresh to when some caches need to fail due to insufficient space. db. It can be seen that the overall implementation complexity of this embodiment is relatively high.

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 present invention relates to a version-based data updating method, device, electronic equipment and storage medium, the method comprising: in response to a request for updating the first data of the setting data item into the database, updating the first data and its first The version identification is updated in the database; after that, the first setting operation is performed, so that the data of the setting data item is not stored in the cache, and the first version identification is updated in the cache; in response to reading the setting data item The request for the data of the data, in the case that the data of the setting data item is not stored in the cache, the second data of the setting data item stored in the database and the second version identifier thereof are obtained; the corresponding setting data item is stored in the cache If the third version identifier of the second version identifier determines that the update time of the data corresponding to the third version identifier in the database is earlier than or equal to the update time of the second data in the database, update the second data to cached.

Description

technical field [0001] Embodiments of the present invention relate to the technical field of data update, and more specifically, relate to a version-based data update method, device, electronic device, and storage medium. Background technique [0002] In the current very popular Web (World Wide Web, global wide area network, also known as the World Wide Web) service architecture, the database (data base, db) is a very important component of data persistence. However, due to the characteristics of the database that must persist data to the disk, its responsiveness will be stretched when faced with a large number of high-concurrent requests, and it cannot meet the high-performance requirements. This can usually be done between the application (Application, app) and the database. Add a layer of cache (cache) in between, so that when reading data, it is read directly from the cache. Since the cache is generally stored in the memory, its access speed is much faster than that of ...

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 Patents(China)
IPC IPC(8): G06F16/23G06F16/2455
CPCG06F16/2365G06F16/2329G06F16/24552
Inventor 郭彬王鲲陈飞邹懋
Owner VIRTAI TECH BEIJING CO LTD