Method for caching data
A data cache and data technology, applied in the field of network communication, can solve the problems of random IO reading ability, random reading and writing ability limitation, etc., and achieve the effects of reducing occupation, realizing separation, and improving storage capacity
Patent Information
- Authority / Receiving Office
- CN · China
- Current Assignee / Owner
- Publication Date
- 2014-01-15
Smart Images
Figure 1 Figure 2 Figure 3
Abstract
Description
technical field
[0001] The invention relates to the technical field of network communication, in particular to a data caching method. Background technique
[0002] With the increase in the number of users of instant messaging products and the increase in user activity, the number of friends in instant messaging products has grown exponentially, and the pressure on the system for data access is bound to increase, and a large number of concurrent random accesses to the database are usually It is the bottleneck of the system, because it is a very random access for users to obtain relevant data of all their friends, and the random IO read ability of the database to the disk is limited by the random read and write ability of the disk itself.
[0003] Therefore, only by finding a way to determine hot data and caching as much hot data as possible (hot data refers to data that has been accessed more times, it can also be called active data, relatively, inactive data is called cold d...
Examples
Embodiment Construction
[0038] The core idea of the present invention is: serialize the data put into the cache, reduce the occupied memory, cache as much data as possible, and adopt a new cache management method to realize the separation of hot and cold data, avoiding the Random access makes hot data obsolete.
[0039] In addition, after the data is cached, because the memory cache is lost after the service starts abnormally, a large number of business accesses will "penetrate" the cache to directly access the database.
[0040] In this regard, the present invention further periodically persists the cached hot data to the disk to form a dmp file, and then records the update of the cache into a log (log) file. If the service restarts, use the dmp file to restore the hot zone data in the cache, read the log file (recording the modification of the cache after persistence), and delete the corresponding modification record in the log file from the restored cache, that is The correctness of the cache c...