A method, device, electronic device and storage medium for dynamic data storage

By dynamically selecting storage media, the bottleneck problem of mechanical hard drives during traffic peak periods is solved, the service efficiency and hit rate of storage media are improved, and the service quality of the equipment is guaranteed.

CN114528231BActive Publication Date: 2025-10-03BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202011197039.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-30
Publication Date
2025-10-03
Estimated Expiration
2040-10-30

AI Technical Summary

Technical Problem

During traffic peaks, mechanical hard drives are the first to reach bottlenecks, causing excessive pressure on the storage media of cache devices and affecting service quality.

Method used

By obtaining the attribute information in the data storage request, the target storage medium is dynamically selected, including hash calculation and random number generation to determine the storage address, and data is reasonably allocated to different types of storage media to avoid overloading of mechanical hard drives.

Benefits of technology

It improves the service efficiency and hit rate of storage media, reduces the storage pressure of mechanical hard disks, and ensures the service quality of the equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114528231B_ABST
    Figure CN114528231B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, electronic device and storage medium for dynamic data storage. The method comprises: obtaining a data storage request, wherein the data storage request carries the data to be stored; determining the attribute information corresponding to the data to be stored; determining the target storage medium corresponding to the data to be stored from a storage medium set based on the attribute information, wherein the storage medium set includes at least two different types of candidate storage media; and storing the data to be stored in the target storage medium. The technical solution provided in the embodiment of the present application improves the service efficiency and hit rate of each storage medium by determining the target storage medium for storing the data to be stored when the data storage request meets the preset conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data storage, and in particular to a method, device, system, electronic device and storage medium for dynamic data storage. Background Art

[0002] With the development of the internet, a typical CDN (Content Delivery Network) cache typically includes three types of storage media: memory, mechanical hard drives, and solid-state drives. Memory and solid-state drives offer high performance but relatively small capacity, so they are typically used to cache hot and small files. However, at specific times (such as peak traffic periods), when the traffic pattern remains unchanged, an overall increase in traffic volume can cause mechanical hard drives to reach their bottleneck first, while solid-state drives and memory remain relatively stable. Consequently, the hit rates of the three types of cache media remain relatively stable, resulting in excessive cache pressure on all three types of storage media, impacting service quality. Summary of the Invention

[0003] In order to solve the above technical problems or at least partially solve the above technical problems, the present application provides a data dynamic storage method, device, electronic device and storage medium.

[0004] According to one aspect of an embodiment of the present application, a method for dynamically storing data is provided, comprising:

[0005] Obtain a data storage request, wherein the data storage request carries the data to be stored;

[0006] Determining attribute information corresponding to the data to be stored;

[0007] determining, according to the attribute information, a target storage medium corresponding to the data to be stored from a storage medium set, wherein the storage medium set includes at least two candidate storage media of different types;

[0008] The data to be stored is stored in the target storage medium.

[0009] Furthermore, the storage medium set includes at least two candidate storage media of the same type. When it is determined that the data to be stored corresponds to at least two target storage media of the same type, storing the data to be stored in the target storage media includes:

[0010] Obtaining a data identifier of the data to be stored;

[0011] Performing a hash calculation based on the data identifier to obtain a target hash value;

[0012] Obtaining a target storage address corresponding to the target hash value;

[0013] Determining a storage address corresponding to the target storage medium;

[0014] The data to be stored is stored in a target storage medium where the storage address matches the target storage address.

[0015] Furthermore, the attribute information includes at least one of the following: time information of the data to be stored, data type of the data to be stored, and data volume of the data to be stored;

[0016] The determining, from a set of storage media according to the attribute information, a target storage medium corresponding to the data to be stored, includes:

[0017] When the attribute information satisfies a preset condition, determining a target storage medium corresponding to the data to be stored from a set of storage media;

[0018] The attribute information satisfies the preset conditions including at least one of the following:

[0019] The time information belongs to the target time period;

[0020] The data type belongs to a preset data type;

[0021] The data volume is greater than or equal to a preset data volume.

[0022] Furthermore, determining the target storage medium corresponding to the data to be stored from a set of storage media according to the attribute information includes:

[0023] Obtaining a random function corresponding to the data to be stored;

[0024] Calculating a random number corresponding to the data to be stored according to the random function;

[0025] A target storage medium corresponding to the data to be stored is determined from a storage medium set according to the random number.

[0026] Furthermore, determining the target storage medium corresponding to the data to be stored from a set of storage media according to the random number includes:

[0027] Determining an upper limit of storage capacity per unit time of the first candidate storage medium within the target time period;

[0028] determining, according to the random number, the amount of data stored in the first candidate storage medium per unit time within the target time period;

[0029] When the amount of stored data is less than the storage capacity upper limit, determining the first candidate storage medium as the target storage medium;

[0030] When the amount of stored data is greater than or equal to the storage upper limit, a second candidate storage medium corresponding to the first candidate storage medium is selected from the storage medium set as the target storage medium, and the second candidate storage medium is of a different type from the first candidate storage medium.

[0031] Furthermore, determining the upper limit of the storage capacity per unit time of the first candidate storage medium within the target time period includes:

[0032] Obtaining the number and storage ratio of the random numbers;

[0033] An upper limit of the storage capacity per unit time of the first candidate storage medium within the target time period is calculated according to the number of the random numbers and the storage ratio.

[0034] Furthermore, before determining the upper limit of the storage capacity per unit time of the first candidate storage medium within the target time period, the aforementioned method further includes:

[0035] Acquire historical data storage records, wherein the historical data storage records include historical data storage amounts for multiple time periods;

[0036] The time period in which the amount of historical data stored is greater than or equal to a preset threshold is used as the target time period.

[0037] Furthermore, determining the upper limit of the storage capacity per unit time of the first candidate storage medium within the target time period includes:

[0038] Acquire a target historical data storage volume per unit time within the target time period based on the historical data storage record;

[0039] Obtaining storage performance information of the first candidate storage medium;

[0040] The upper limit of the storage capacity corresponding to the first candidate storage medium within the unit time is calculated according to the target historical data storage capacity and storage performance information.

[0041] According to another aspect of the embodiments of the present application, a data dynamic storage device is provided, including:

[0042] An acquisition module, configured to acquire a data storage request, wherein the data storage request carries data to be stored;

[0043] A determination module, configured to determine attribute information corresponding to the data to be stored;

[0044] a processing module, configured to determine, based on the attribute information, a target storage medium corresponding to the to-be-stored data from a storage medium set, wherein the storage medium set includes at least two candidate storage media of different types;

[0045] The storage module is used to store the data to be stored in the target storage medium.

[0046] According to another aspect of an embodiment of the present application, a storage medium is further provided, which includes a stored program, and the above steps are executed when the program is run.

[0047] According to another aspect of an embodiment of the present application, an electronic device is also provided, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; wherein: the memory is used to store computer programs; the processor is used to execute the steps in the above method by running the program stored in the memory.

[0048] An embodiment of the present application also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the steps in the above method.

[0049] The above-mentioned technical solution provided by the embodiment of the present application has the following advantages compared with the existing technology: the technical solution provided by the embodiment of the present application improves the service efficiency and hit rate of each storage medium by determining the target storage medium for storing the data to be stored when the data storage request meets the preset conditions. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0051] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0052] Figure 1 A flowchart of a method for dynamic data storage provided in an embodiment of the present application;

[0053] Figure 2 A flowchart of a method for dynamic data storage provided in another embodiment of the present application;

[0054] Figure 3 A flowchart of a method for dynamic data storage provided in another embodiment of the present application;

[0055] Figure 4 A block diagram of a dynamic data storage device provided in an embodiment of the present application;

[0056] Figure 5A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0057] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. The schematic embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0058] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another similar entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0059] In related technologies, a buffer is usually used to manage multiple storage media, such as memory, solid-state drives, and mechanical hard drives.

[0060] Typically, the buffer is used to manage multiple first candidate storage media and multiple second candidate storage media, where the first candidate storage medium is a mechanical hard disk and the second candidate storage medium is a solid state drive or memory. The embodiment of this application is mainly explained using a solid state drive as an example.

[0061] The original meaning of a buffer refers to a type of RAM with faster access speeds than standard random access memory (RAM). Generally speaking, unlike the system's main memory, it uses expensive but faster static random access memory (SRAM), rather than dynamic random access memory (DRAM). A buffer is a first-level memory located between main memory and the CPU. Composed of static random access memory chips (SRAM), it has a relatively small capacity but a much higher speed than main memory, approaching the speed of the CPU. In the computer memory system hierarchy, a buffer is a high-speed, small-capacity memory located between the central processing unit (CPU) and main memory, forming a first-level memory along with the main memory. Information scheduling and transfer between the buffer and main memory is automatically handled by hardware.

[0062] The embodiments of the present application can be applied to a buffer, and storage media are allocated to the data to be stored according to the attributes of the data to be stored in the data storage request, so as to improve the service efficiency and hit rate of each storage medium.

[0063] The present invention provides a method, apparatus, electronic device, and storage medium for dynamic data storage. The methods provided in the present invention can be applied to any desired electronic device, such as a server, terminal, or other electronic device. These devices are not specifically limited here and, for ease of description, are referred to as electronic devices.

[0064] According to one aspect of the embodiments of the present application, a method embodiment of a method for dynamically storing data is provided. Figure 1 A flowchart of a method for dynamic data storage provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the method includes the following steps S11 to S14:

[0065] Step S11, obtaining a data storage request, the data storage request carrying the data to be stored;

[0066] The data storage request in the embodiment of the present application may be generated by the client. When there is data to be stored in the client, a data storage request is generated and sent to a cache.

[0067] Step S12, determining attribute information corresponding to the data storage request;

[0068] In an embodiment of the present application, upon receiving a data storage request, the data to be stored carried in the data storage request is parsed to determine attribute information of the data to be stored. The attribute information referred to in the embodiment of the present application may be time information of the data to be stored, data type of the data to be stored, data volume of the data to be stored, and the like.

[0069] Step S13, determining a target storage medium corresponding to the data to be stored from a storage medium set according to the attribute information, where the storage medium set includes at least two candidate storage media of different types;

[0070] In an embodiment of the present application, when the attribute information satisfies a preset condition, a target storage medium corresponding to the data to be stored is determined from the set of storage media. The attribute information satisfying the preset condition includes at least one of the following: the time information falls within a target time period; the data type falls within a preset data type; and the data volume is greater than or equal to a preset data volume. It is understood that the target time period may be a peak traffic period.

[0071] Step S14: storing the data to be stored in the target storage medium.

[0072] In an embodiment of the present application, the storage medium set includes at least two candidate storage media of the same type. When it is determined that the data to be stored corresponds to at least two target storage media of the same type, storing the data to be stored in the target storage medium includes the following steps A1-A5:

[0073] Step A1, obtaining the data identifier of the data to be stored;

[0074] Step A2, performing hash calculation based on the data identifier to obtain a target hash value;

[0075] Step A3, obtaining a target storage address corresponding to the target hash value;

[0076] Step A4, determining the storage address corresponding to the target storage medium;

[0077] Step A5: storing the data to be stored in a target storage medium whose storage address matches the target storage address.

[0078] It is understood that the data identifier can be a data name, etc., or a data code. The hash algorithm can be one or a combination of algorithms such as MD5, SHA-1, and SHA256. The hash algorithm is used to calculate the data name to obtain a target hash value. The target hash value is used as the key name, and the target storage address corresponding to the target hash value is determined from a preset hash value and storage medium address correspondence table.

[0079] The technical solution provided in the embodiment of the present application determines the target storage medium for storing the data to be stored when the data storage request meets the preset conditions, thereby improving the service capabilities of each storage medium and increasing the hit rate of each storage medium.

[0080] In an embodiment of the present application, determining a target storage medium corresponding to the data to be stored from a storage medium set includes the following steps B1 to B3:

[0081] Step B1, obtaining a random function corresponding to the data to be stored;

[0082] Step B2, calculating a random number corresponding to the data to be stored according to a random function;

[0083] Step B3: determining the target storage medium corresponding to the data to be stored from the storage medium set according to the random number.

[0084] The step of obtaining the random function corresponding to the data to be stored includes: determining storage parameters corresponding to the data to be stored, and determining the random function corresponding to the storage parameters according to a function generation strategy.

[0085] It's important to note that there are many different ways to generate random numbers. These methods are called random number generators. The characteristic of random numbers is that the subsequent numbers generated have no relationship to the previous ones.

[0086] The main principle of random number generation is to input the provided storage parameters into a random function, and output a single random number or multiple random numbers (i.e., a random number sequence) through the random function. In the embodiment of the present application, configuration information is first obtained. The configuration information includes: storage parameters and random functions. The storage parameters can be a fixed value or a value set by the staff based on the current amount of stored data. The random function includes at least one of the following: a mixed congruential function, an iterative median function, a multiplicative congruential function, or other linear or nonlinear functions.

[0087] The configuration information can be pre-stored in the server, and when the configuration information is needed, it can be directly read from the server. In addition, the configuration information can also be provided by the staff. In addition, the above configuration information can also include other configuration data such as the number of random numbers and remarks information, and this exemplary embodiment is not limited to this.

[0088] In the embodiment of the present application, the above step A3 determines the target storage medium corresponding to the data to be stored from the storage medium set according to the random number, including the following steps C1-C4:

[0089] Step C1, determining the upper limit of the storage capacity per unit time of the first candidate storage medium in the target time period;

[0090] In an embodiment of the present application, the upper limit of the storage capacity per unit time can be determined by the number of random numbers and the storage ratio pre-set by the staff. For example: when the number of random numbers is 100, the range of random numbers can be selected as 0-99. It can be seen that the total storage capacity per unit time is 100. Then, based on the total storage capacity and the storage ratio of 20%, the upper limit of the storage capacity of the first candidate storage medium is determined to be 20, and the upper limit of the storage capacity of the second candidate storage medium is determined to be 80.

[0091] Step C2: determining the amount of data stored per unit time on the first candidate storage medium within the target time period according to the random number.

[0092] In an embodiment of the present application, the amount of data stored per unit time in the first candidate storage medium within the target time period is determined based on the number of random numbers generated per unit time. For example, if the number of random numbers generated per unit time is 17, the amount of data stored per unit time in the first candidate storage medium within the target time period is 17.

[0093] Step C3: When the amount of stored data is less than the upper storage limit, a first candidate storage medium is determined as the target storage medium.

[0094] As an example, the target time period is 19:00-20:00, and the unit time of this time period is minutes. Determine the time information corresponding to the data to be stored, and the number of random numbers generated in this unit time. Determine the amount of stored data based on the number of generated random numbers. For example, in the time period 19:10-19:11, the number of random numbers generated is 19, that is, the amount of stored data is 19. At this time, the amount of stored data is less than the storage limit, so the first candidate storage medium is used as the target storage medium.

[0095] Step C4: when the amount of stored data is greater than or equal to the storage capacity upper limit, a second candidate storage medium corresponding to the first candidate storage medium is selected from the storage medium set as the target storage medium, where the second candidate storage medium is of a different type from the first candidate storage medium.

[0096] In an embodiment of the present application, when the amount of stored data is greater than or equal to the storage capacity upper limit, the pre-stored correspondence between the first candidate storage medium and the second candidate storage medium is obtained, and the second candidate storage medium corresponding to the first candidate storage medium is determined based on the correspondence.

[0097] As an example, the target time period is 19:00-20:00, and the unit time of this time period is minutes. Determine the time information corresponding to the data to be stored, and the number of random numbers generated in this unit time. Determine the amount of stored data based on the number of generated random numbers. For example, in the time period 19:10-19:11, the number of random numbers generated is 59, that is, the amount of stored data is 59. At this time, the amount of stored data is greater than the storage limit, so the second candidate storage medium corresponding to the first candidate storage medium is used as the target storage medium.

[0098] The embodiment of the present application reduces the storage pressure of the mechanical hard disk by setting a storage upper limit, avoids overloading of the mechanical hard disk, and stores data exceeding the storage upper limit in the memory or solid-state drive, thereby ensuring the service quality of a single device.

[0099] Figure 2 A flowchart of a method for dynamic data storage provided in another embodiment of the present application is shown in FIG. Figure 2 As shown, the embodiment of the present application further provides a method embodiment for implementing step S13: determining a target time period, which may include the following steps:

[0100] Step S21, obtaining historical data storage records, the historical data storage records including historical data storage amounts for multiple time periods;

[0101] In an embodiment of the present application, historical data storage records can be recorded in cycles, and the historical records include the historical data storage volume for each day in a week, wherein the historical data storage volume for each day includes the data storage volume for each time period of the day.

[0102] Step S22: The time period in which the amount of historical data stored is greater than or equal to the preset threshold is used as the target time period.

[0103] In the embodiment of the present application, the daily data storage volume is analyzed to determine time periods in which the data storage volume is greater than or equal to a preset threshold. The number of time periods in which the historical data storage volume is greater than or equal to the preset threshold is then counted within a week, and the time periods that exceed the preset number are used as target time periods. For example, if the number of times 19:00-22:00 is 6 and the number of times 12:00-13:00 is 5 within a week, both of which are greater than the preset number of times 4, then the time periods 19:00-22:00 and 12:00-13:00 are used as target time periods.

[0104] Figure 3 A flowchart of a method for dynamic data storage provided in another embodiment of the present application is shown in FIG. Figure 3 As shown, the embodiment of the present application further provides a method embodiment for implementing step S13: determining the upper limit of the storage capacity per unit time of the first candidate storage medium in the target time period. The method may include the following steps:

[0105] Step S31, obtaining a target amount of historical data storage for a target time period based on the historical data storage record;

[0106] Step S32: obtaining storage performance information of the first candidate storage medium;

[0107] Step S33 : Calculate the storage capacity upper limit corresponding to the first candidate storage medium according to the target historical data storage capacity and the storage performance information.

[0108] In an embodiment of the present application, the first candidate storage medium is a mechanical hard disk, and the storage performance information of the mechanical hard disk may be the data throughput of the mechanical hard disk. The storage capacity upper limit is determined based on the historical data storage capacity and the data throughput.

[0109] As an example, within the target time period of 19:00-22:00, the target historical data storage volume for the first time period of 19:00-20:00 is A, the target historical data storage volume for the second time period of 20:00-21:00 is B, and the target historical data storage volume for the third time period of 20:00-21:00 is C. The target storage ratio is then determined based on the data storage volume and data throughput of each time period. For example, the storage ratio for the first time period is 20%, the storage ratio for the second time period is 25%, and the storage ratio for the third time period is 15%. Since the preset total storage volume is 100, the storage upper limit for each time period is determined based on the storage ratio. The storage upper limit of the first candidate storage medium in the first time period is 20, the storage upper limit of the second time period is 25, and the storage upper limit of the third time period is 15.

[0110] The embodiment of the present application sets a target storage indicator. When in a traffic peak period, the amount of data stored in the second candidate storage medium (solid-state drive or memory) will be calculated based on the target storage indicator and the current data volume, thereby ensuring the service quality of the first candidate storage medium (mechanical hard disk).

[0111] Figure 4 This is a block diagram of a data dynamic storage device provided in an embodiment of the present application. The device can be implemented as part or all of an electronic device through software, hardware, or a combination of both. Figure 4 As shown, the data dynamic storage device includes:

[0112] An acquisition module 41 is configured to acquire a data storage request, wherein the data storage request carries data to be stored;

[0113] A determination module 42 is used to determine attribute information corresponding to the data to be stored;

[0114] A processing module 43 is configured to determine a target storage medium corresponding to the data to be stored from a storage medium set according to the attribute information, where the storage medium set includes at least two candidate storage media of different types;

[0115] The storage module 44 is configured to store the data to be stored in a target storage medium.

[0116] Furthermore, the storage medium set includes at least two candidate storage media of the same type. When it is determined that the data to be stored corresponds to at least two target storage media of the same type, the storage module 44 is used to obtain the data identifier of the data to be stored, perform hash calculation based on the data identifier to obtain a target hash value, obtain a target storage address corresponding to the target hash value, determine the storage address corresponding to the target storage medium, and store the data to be stored in the target storage medium whose storage address matches the target storage address.

[0117] Furthermore, the attribute information includes at least one of the following: time information of the data to be stored, data type of the data to be stored, and data volume of the data to be stored;

[0118] The processing module 43 is configured to determine a target storage medium corresponding to the data to be stored from the storage medium set when the attribute information satisfies a preset condition;

[0119] The attribute information satisfies the preset conditions including at least one of the following: the time information belongs to the target time period; the data type belongs to the preset data type; the data volume is greater than or equal to the preset data volume.

[0120] Furthermore, the processing module 43 includes:

[0121] The acquisition submodule is used to obtain the random function corresponding to the data to be stored;

[0122] A calculation submodule, used to calculate the random number corresponding to the data to be stored according to the random function;

[0123] The query submodule is used to determine the target storage medium corresponding to the data to be stored from the storage medium set according to the random number.

[0124] Furthermore, the query submodule includes:

[0125] an acquisition unit, configured to determine an upper limit of the storage capacity per unit time of the first candidate storage medium within a target time period;

[0126] an analyzing unit, configured to determine, based on the random number, the amount of data stored per unit time on the first candidate storage medium within the target time period;

[0127] a processing unit, configured to determine the first candidate storage medium as the target storage medium when the amount of stored data is less than the storage capacity upper limit;

[0128] The processing unit is further configured to select a second candidate storage medium corresponding to the first candidate storage medium from the storage medium set as the target storage medium when the amount of stored data is greater than or equal to the storage upper limit, wherein the second candidate storage medium is of a different type from the first candidate storage medium.

[0129] Furthermore, the acquisition unit is configured to acquire a range of random numbers and a storage ratio; and calculate an upper limit of the storage capacity per unit time of the first candidate storage medium within a target time period according to the range of random numbers and the storage ratio.

[0130] Furthermore, the acquisition unit in the query submodule in the embodiment of the present application is also used to obtain historical data storage records, which include historical data storage volumes for multiple time periods; and the time period in which the historical data storage volume is greater than or equal to a preset threshold is used as the target time period.

[0131] Furthermore, the acquisition unit is used to obtain the target historical data storage volume per unit time within the target time period based on the historical data storage records; obtain the storage performance information of the first candidate storage medium; and calculate the storage volume upper limit corresponding to the first candidate storage medium per unit time based on the target historical data storage volume and the storage performance information.

[0132] The present application also provides an electronic device, such as Figure 5 As shown, the electronic device may include: a processor 1501 , a communication interface 1502 , a memory 1503 and a communication bus 1504 , wherein the processor 1501 , the communication interface 1502 , and the memory 1503 communicate with each other via the communication bus 1504 .

[0133] Memory 1503, used for storing computer programs;

[0134] The processor 1501 is configured to implement the steps of the above embodiment when executing the computer program stored in the memory 1503 .

[0135] The communication bus mentioned in the terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or only one type of bus.

[0136] The communication interface is used for communication between the above terminal and other devices.

[0137] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.

[0138] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.

[0139] In another embodiment provided in the present application, a computer-readable storage medium is also provided, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the data dynamic storage method described in any of the above embodiments.

[0140] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the data dynamic storage method described in any one of the above embodiments.

[0141] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive SolidState Disk).

[0142] The above description is only a preferred embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the scope of protection of the present application.

[0143] The foregoing is merely a list of specific embodiments of the present application, intended to enable those skilled in the art to understand or implement the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the broadest scope consistent with the principles and novel features of the present application.

Claims

1. A method for dynamic data storage, characterized in that: include: Obtain a data storage request, wherein the data storage request carries the data to be stored; Determining attribute information corresponding to the data to be stored, wherein the attribute information includes: time information of the data to be stored; Determining the target storage medium corresponding to the data to be stored from the storage medium set according to the attribute information, including: when the attribute information meets a preset condition, determining the target storage medium corresponding to the data to be stored from the storage medium set; the attribute information meeting the preset condition includes: the time information belongs to a target time period; the storage medium set includes at least two different types of candidate storage media; determining the target storage medium corresponding to the data to be stored from the storage medium set, including: obtaining a random function corresponding to the data to be stored; calculating a random number corresponding to the data to be stored according to the random function; determining the target storage medium corresponding to the data to be stored from the storage medium set according to the random number, including: obtaining a historical data storage record, the historical data storage record including a historical data storage amount for multiple time periods; storing the historical data storage amount greater than or a time period equal to a preset threshold as a target time period; determining an upper limit of the storage capacity per unit time of the first candidate storage medium within the target time period, including: obtaining the number of the random numbers and the storage ratio, and calculating the upper limit of the storage capacity per unit time of the first candidate storage medium within the target time period according to the number of the random numbers and the storage ratio; determining the amount of data stored in the first candidate storage medium within the target time period according to the random numbers; when the amount of stored data is less than the upper limit of the storage capacity, determining the first candidate storage medium as the target storage medium; when the amount of stored data is greater than or equal to the upper limit of the storage capacity, selecting a second candidate storage medium corresponding to the first candidate storage medium from the storage medium set as the target storage medium, the second candidate storage medium being of a different type from the first candidate storage medium; The data to be stored is stored in the target storage medium.

2. The method according to claim 1, characterized in that The storage medium set includes at least two candidate storage media of the same type, and when it is determined that the data to be stored corresponds to at least two target storage media of the same type, storing the data to be stored in the target storage media includes: Obtaining a data identifier of the data to be stored; Performing a hash calculation based on the data identifier to obtain a target hash value; Obtaining a target storage address corresponding to the target hash value; Determining a storage address corresponding to the target storage medium; The data to be stored is stored in a target storage medium where the storage address matches the target storage address.

3. A data dynamic storage device, characterized in that: include: An acquisition module, configured to acquire a data storage request, wherein the data storage request carries data to be stored; A determination module, configured to determine attribute information corresponding to the data to be stored, wherein the attribute information includes: time information of the data to be stored; A processing module, for determining the target storage medium corresponding to the data to be stored from the storage medium set according to the attribute information, including: when the attribute information meets the preset conditions, determining the target storage medium corresponding to the data to be stored from the storage medium set; the attribute information meeting the preset conditions includes: the time information belongs to the target time period; the storage medium set includes at least two different types of candidate storage media; the determining the target storage medium corresponding to the data to be stored from the storage medium set includes: obtaining a random function corresponding to the data to be stored; calculating a random number corresponding to the data to be stored according to the random function; determining the target storage medium corresponding to the data to be stored from the storage medium set according to the random number, including: obtaining historical data storage records, the historical data storage records including the amount of historical data stored for multiple time periods; storing the historical data A time period in which the storage capacity is greater than or equal to a preset threshold is used as a target time period; an upper limit of the storage capacity per unit time of the first candidate storage medium within the target time period is determined, including: obtaining the number of random numbers and the storage ratio, and calculating the upper limit of the storage capacity per unit time of the first candidate storage medium within the target time period according to the number of random numbers and the storage ratio; determining the amount of data stored in the first candidate storage medium within the target time period according to the random numbers; when the amount of stored data is less than the upper limit of the storage capacity, determining the first candidate storage medium as the target storage medium; when the amount of stored data is greater than or equal to the upper limit of the storage capacity, selecting a second candidate storage medium corresponding to the first candidate storage medium from the storage medium set as the target storage medium, the second candidate storage medium being of a different type from the first candidate storage medium; The storage module is used to store the data to be stored in the target storage medium.

4. A storage medium, characterized in that The storage medium includes a stored program, wherein the program executes the method steps according to any one of claims 1 to 2 when the program is executed.

5. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory for storing computer programs; A processor, configured to execute the method steps according to any one of claims 1 to 2 by running a program stored in a memory.

Citation Information

Patent Citations

  • Method and device for processing data

    CN102968498A

  • Distributed data processing method and distributed data processing device

    CN105892953A

  • Time sequence data management method, equipment and device

    CN106776823A

  • Data caching method and device

    CN107273040A

  • Hierarchical storage method and device, electronic equipment and computer readable storage medium

    CN110018788A