Redis-based mass data classified storage method and system

A mass data and storage system technology, applied in the computer field, can solve problems such as increasing response timeout rate, increasing query time, and difficulty in meeting the continuous growth of user data volume, and achieve the effect of reducing memory fragmentation and memory occupation

Active Publication Date: 2021-08-24
上海艾麒信息科技股份有限公司
View PDF12 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0003] Store user data directly in the database: This method has almost no limit to the growth of user data, and the cost of the hard disk is cheaper than memory, but the efficiency and response time of query data are far inferior to the memory database redis. For real-time advertising trading systems In terms of advertising, it will increase the response timeout rate of advertising bidding, and with the increase of user data, the query time will increase, which will further increase the response timeout rate;
[0004] Store user data directly in redis in the form of key-value key-value pairs. This method will take up 8 times more memory space than the method used in this patent, and the server cost needs to increase a lot, and it is difficult to meet the user data volume. Continuous growth, and at the same time, more memory fragments are generated when user data is added, deleted, or modified in business operations

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
  • Redis-based mass data classified storage method and system
  • Redis-based mass data classified storage method and system

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0053]According to a kind of Redis-based mass data classification storage method provided by the present invention, comprising:

[0054] Step S1: classify the data, and define a data category ID for each category of data;

[0055] Step S2: For each data type, calculate the number N of hash buckets according to the data scale of the corresponding actual business; according to the characteristics of redis, the ziplist data structure storage method with the most space-saving hash type data requires hash buckets ( That is, the field data stored in a hash key) is less than 512. Therefore, the calculation formula for the number N of hash buckets is: N=total data volume / 512, and rounded up.

[0056] Step S3: Use the data identification ID, data category ID, and the number N of data buckets as input factors, perform hash calculation, and obtain hash key and field;

[0057] Step S4: use the data content corresponding to the data identification ID as the hash value;

[0058] Step S5: ...

Embodiment 2

[0090] Embodiment 2 is a preferred example of embodiment 1

[0091] The present invention classifies and stores massive data into redis after hash calculation and processing, so as to save memory, improve access speed, and enable classification and independent maintenance.

[0092] The present invention provides a method for classifying and storing massive data based on Redis, comprising:

[0093] Step 1: Define user data category ID by business category;

[0094] Step 2: Define the number N of user data buckets according to the data magnitude corresponding to the data category ID;

[0095] Step 3: Using the hash algorithm A to calculate an integer-type hash result A using the string-type user data identifier, the data category ID, and the number N of the data buckets as factors;

[0096] Step 4: using the integer type hash result A as the hash key of the hash data type of redis;

[0097] Step 5: Using the user data identifier of the string type as the unique factor again, ...

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 Redis-based mass data classified storage method and system, and the method comprises the steps: S1, classifying data, and defining a data category ID for each category of data; S2, for each data category, calculating the number N of hash buckets according to the data scale of the corresponding actual service; S3, taking the data identifier ID, the data category ID and the number N of the data buckets as input parameter factors, and performing hash calculation to obtain a hash key and a field; S4, using the data content corresponding to the data identification ID as a hashvalue; and S5, storing the hashkey, the field and the hashvalue into the redis. According to the method and the device, the user data identifier is converted into a digital form and is stored in redis in the form of hash type data, so that the purpose of reducing memory occupation is achieved.

Description

technical field [0001] The present invention relates to the field of computer technology, in particular to a Redis-based massive data classification storage method and system. Background technique [0002] At present, when processing huge user data, there are generally the following common processing methods: [0003] Store user data directly in the database: This method has almost no limit to the growth of user data, and the cost of the hard disk is cheaper than memory, but the efficiency and response time of query data are far inferior to the memory database redis. For real-time advertising trading systems In terms of advertising, it will increase the response timeout rate of advertising bidding, and with the increase of user data, the query time will increase, which will further increase the response timeout rate; [0004] Store user data directly in redis in the form of key-value key-value pairs. This method will take up 8 times more memory space than the method used in...

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/22G06F11/10
CPCG06F16/2255G06F16/2219G06F11/1004
Inventor 周单健盛猛林立
Owner 上海艾麒信息科技股份有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products