Data storage method, apparatus and electronic device
Patent Information
- Application Number
- CN202211619279.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-14
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2042-12-14
AI Technical Summary
[0006]本发明实施例提供了一种数据存储方法、装置及电子设备,以至少解决现有技术中在数据存储时存在的节点数据量分布不均的技术问题
[0019]在本发明实施例中,采用基于目标模型从多个存储节点中确定目标存储节点进行数据存储的方式,首先通过获取多个存储节点的节点信息,其中,节点信息至少包括多个存储节点的参数信息、数据存储量信息以及状态信息,多个存储节点用于存储数据;其次基于目标模型对多个存储节点的节点信息进行处理,得到每个存储节点的存储概率值,其中,目标模型是基于多个存储节点的历史节点信息以及当前节点信息进行训练得到的,每个存储节点的存储概率值表征每个存储节点的数据存储量;然后基于每个存储节点的存储概率值从多个存储节点中确定目标存储节点;最后将待存储数据存储至目标存储节点中。
Smart Images

Figure CN116088756B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and more specifically, to a data storage method, apparatus, and electronic device. Background Technology
[0002] As the number of fund of funds (FOFs) within asset custody platforms gradually increases, the corresponding portfolio returns also rise exponentially. Storing all data in a centralized database carries the risk of data corruption due to excessive data traffic or database system failures.
[0003] To circumvent such problems, distributed databases are commonly used in existing technologies. The advantage of this approach is that it allows data to be distributed across different physical locations. Currently, distributed storage methods based on hashing are commonly employed, such as simple hashing and consistent hashing. The advantage of these two methods is that if some nodes fail, only a portion of the data stored on those nodes needs to be moved to the next valid node after removing the failed node, demonstrating good scalability and fault tolerance.
[0004] While simple hashing and consistent hashing offer advantages in terms of simplicity and speed when partitioning and storing a large number of combinations, the master node does not consider the node's own state or other factors when determining which node to store the result of a combination. Furthermore, when there are few nodes, data skew can occur due to uneven node distribution, and it is impossible to improve storage methods and increase efficiency by drawing on historical storage information.
[0005] There is currently no effective solution to the above problems. Summary of the Invention
[0006] This invention provides a data storage method, apparatus, and electronic device to at least solve the technical problem of uneven distribution of node data volume in the prior art during data storage.
[0007] According to one aspect of the present invention, a data storage method is provided, comprising: acquiring node information of a plurality of storage nodes, wherein the node information includes at least parameter information, data storage volume information, and status information of the plurality of storage nodes, and the plurality of storage nodes are used to store data; processing the node information of the plurality of storage nodes based on a target model to obtain a storage probability value for each storage node, wherein the target model is trained based on historical node information and current node information of the plurality of storage nodes, and the storage probability value of each storage node represents the data storage volume of each storage node; determining a target storage node from the plurality of storage nodes based on the storage probability value of each storage node; and storing the data to be stored in the target storage node.
[0008] Furthermore, after obtaining the node information of multiple storage nodes, the data storage volume of each storage node is determined based on the node information of multiple storage nodes; the variance of the data storage volume of multiple storage nodes is calculated to obtain the first variance value.
[0009] Furthermore, after storing the data to be stored in the target storage node, the current data storage volume of multiple storage nodes is obtained; the variance of the current data storage volume of multiple storage nodes is calculated to obtain the second variance value; the difference between the first variance value and the second variance value is calculated to obtain the return value, wherein the return value represents the data storage fluctuation of multiple storage nodes.
[0010] Furthermore, before storing the data to be stored in the target storage node, the method further includes: Step 1, detecting whether the data to be stored has been successfully stored in the target storage node; Step 2, if the data to be stored has not been successfully stored in the target storage node, determining a negative feedback value, and calculating the sum of the negative feedback value and the reward value to obtain a target reward value, and repeating Step 1-Step 2 until the data to be stored is successfully stored in the target storage node, or when the number of unsuccessful storage attempts exceeds a first preset threshold, storing the data to be stored in a candidate storage node, wherein the candidate storage node is a storage node among multiple storage nodes whose data storage volume is greater than or equal to a second preset threshold, the target reward value is used to update the target model, and the negative feedback value is positively correlated with the number of unsuccessful storage attempts.
[0011] Furthermore, after storing the data to be stored in the target storage node, it is detected whether the amount of experience data in the first cache is greater than or equal to a third preset threshold, wherein the experience data consists of historical node information, current node information, and target reward value of multiple storage nodes; when the amount of experience data is greater than a second preset threshold, the experience data is sent to the computing node and the experience data in the first cache is cleared, wherein the computing node is used to train the target model.
[0012] Furthermore, when the amount of experience data exceeds a second preset threshold, the experience data is sent to the computing node, including: monitoring the running status of the computing node; storing the experience data in a second cache when the computing node is in the computing state; and storing the experience data in an experience replay pool when the computing node is in the computing completed state, wherein the experience replay pool is used to store the updated data of the target model.
[0013] Furthermore, the target model is updated through the following steps: obtaining model update parameters based on computing nodes; and updating the target model based on the model update parameters.
[0014] Furthermore, before obtaining model update parameters based on computing nodes, a preset amount of empirical data is obtained based on computing nodes; the objective function of the target model is determined based on the preset amount of empirical data; and the model update parameters are determined based on the objective function, wherein the model update parameters are the model parameters of the trained target model.
[0015] According to another aspect of the present invention, a data storage device is also provided, comprising: an acquisition module, configured to acquire node information of a plurality of storage nodes, wherein the node information includes at least parameter information, data storage volume information, and status information of the plurality of storage nodes, and the plurality of storage nodes are used to store data; a processing module, configured to process the node information of the plurality of storage nodes based on a target model to obtain a storage probability value for each storage node, wherein the target model is trained based on historical node information and current node information of the plurality of storage nodes, and the storage probability value of each storage node represents the data storage volume of each storage node; a determination module, configured to determine a target storage node from the plurality of storage nodes based on the storage probability value of each storage node; and a storage module, configured to store the data to be stored in the target storage node.
[0016] According to another aspect of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer-readable storage medium, and the computer program is configured to execute the above-described data storage method at runtime.
[0017] According to another aspect of the present invention, an electronic device is also provided, the electronic device including one or more processors; a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors are configured to run the programs, wherein the programs are configured to execute the above-described data storage method during runtime.
[0018] According to another aspect of the present invention, a computer program product is also provided, including a computer program / instructions that, when executed by a processor, implement the data storage method described above.
[0019] In this embodiment of the invention, a method for determining a target storage node from multiple storage nodes based on a target model for data storage is adopted. First, node information of multiple storage nodes is obtained, wherein the node information includes at least parameter information, data storage volume information, and status information of multiple storage nodes, and the multiple storage nodes are used to store data. Second, the node information of multiple storage nodes is processed based on the target model to obtain the storage probability value of each storage node, wherein the target model is trained based on the historical node information and current node information of multiple storage nodes, and the storage probability value of each storage node represents the data storage volume of each storage node. Then, the target storage node is determined from multiple storage nodes based on the storage probability value of each storage node. Finally, the data to be stored is stored in the target storage node.
[0020] In the above process, the target storage node for storing the data is determined by processing the node information of multiple storage nodes based on the target model, so that the data can be evenly distributed across each storage node, thereby solving the problem of uneven distribution of node data during data storage. In addition, the target model is trained based on the historical node information and current node information of multiple storage nodes, and can be updated according to the data storage level of multiple storage nodes, improving the accuracy of the model in processing data, thereby improving the accuracy of determining the target storage node.
[0021] Therefore, the solution provided in this application achieves the goal of determining the target storage node from multiple storage nodes based on the target model for data storage, thereby realizing the technical effect of uniform distribution of node data volume during data storage, and thus solving the technical problem of uneven distribution of node data volume in the prior art during data storage. Attached Figure Description
[0022] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:
[0023] Figure 1 This is a schematic diagram of an optional data storage method according to an embodiment of the present invention;
[0024] Figure 2 This is a schematic diagram of an optional data storage process according to an embodiment of the present invention;
[0025] Figure 3 A schematic diagram of an optional process for sending empirical data to a computing node according to an embodiment of the present invention;
[0026] Figure 4A schematic diagram of an optional master node updating a policy network after receiving parameters, according to an embodiment of the present invention;
[0027] Figure 5 A schematic diagram of an optional computation node model training process according to an embodiment of the present invention;
[0028] Figure 6 A schematic diagram of an optional data storage device according to an embodiment of the present invention;
[0029] Figure 7 A schematic diagram of an optional electronic device according to an embodiment of the present invention. Detailed Implementation
[0030] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0031] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0032] It should be noted that all relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) involved in this invention are information and data authorized by the user or fully authorized by all parties. For example, this system has an interface with the relevant user or organization. Before obtaining relevant information, it needs to send an acquisition request to the aforementioned user or organization through the interface, and obtain the relevant information after receiving consent from the aforementioned user or organization.
[0033] Example 1
[0034] According to an embodiment of the present invention, an embodiment of a data storage method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0035] Figure 1 This is a schematic diagram of a data storage method according to an embodiment of the present invention, such as... Figure 1 As shown, the method includes the following steps:
[0036] Step S101: Obtain node information of multiple storage nodes, wherein the node information includes at least parameter information, data storage volume information and status information of multiple storage nodes, and the multiple storage nodes are used to store data.
[0037] In step S101, node information of multiple storage nodes can be obtained based on devices such as systems, servers, and electronic devices. In this embodiment, node information of multiple storage nodes can be obtained through the system.
[0038] Optionally, node information includes parameter information for multiple storage nodes, such as performance parameters, data storage capacity, and status information, such as the real-time status of each storage node. Figure 2 The diagram illustrates the data storage process. The system obtains the real-time status, data storage volume, and performance parameters of multiple storage nodes by sending requests to them, and then stores the data in the storage record table.
[0039] Optionally, in this embodiment, in addition to the existing storage nodes used for storing data, at least two backup storage nodes are added to back up the data.
[0040] Step S102: Process the node information of multiple storage nodes based on the target model to obtain the storage probability value of each storage node. The target model is trained based on the historical node information and current node information of multiple storage nodes, and the storage probability value of each storage node represents the data storage volume of each storage node.
[0041] In step S102, the target model of the system master node is a deep reinforcement learning model. In this embodiment, the reinforcement learning model adopts the SAC (Soft Actor Critic) algorithm. This algorithm has stronger exploration capabilities than traditional algorithms and is also an offline policy algorithm, which has higher sample efficiency and is easier to find the optimal policy than online policies. In addition, the deep reinforcement learning model includes three neural networks: a policy network model, a value network model, and a target value network model corresponding to the value network model. The value network model and the target value network model are isomorphic and have the same parameters during initialization.
[0042] Optional, such as Figure 2 The diagram shown illustrates the data storage process, using the real-time status of multiple storage nodes in the storage record table, data storage volume information, and performance parameters as input vectors s. t The target model is input, and it processes the above data to obtain the storage probability value of each storage node.
[0043] Optionally, historical node information refers to the node information of multiple storage nodes after the last time data was stored, while current node information refers to the node information of multiple storage nodes after the current data storage was successfully performed.
[0044] It should be noted that by training the target model based on the historical node information and current node information of multiple storage nodes, the target model can be updated according to the data storage level of multiple storage nodes, which improves the accuracy of the model in processing data and thus improves the accuracy of determining the target storage node.
[0045] Step S103: Determine the target storage node from multiple storage nodes based on the storage probability value of each storage node.
[0046] Step S104: Storing the data to be stored into the target storage node.
[0047] In steps S103-S104, as follows Figure 2 The diagram illustrates the data storage process. After acquiring the data to be stored, the system samples and determines the target storage node based on the storage probability value of each storage node, and determines the node_Id of the target storage node, denoted as line a. t Then, the data to be stored is stored based on the target storage node.
[0048] Optionally, in this embodiment, the data to be stored is the rate of return data of the portfolio returns.
[0049] Based on the scheme defined in steps S101 to S104 above, it can be understood that in this embodiment of the invention, the method of determining the target storage node from multiple storage nodes for data storage based on a target model is adopted. First, the node information of multiple storage nodes is obtained, wherein the node information includes at least the parameter information, data storage volume information, and status information of multiple storage nodes, and the multiple storage nodes are used to store data; second, the node information of multiple storage nodes is processed based on the target model to obtain the storage probability value of each storage node, wherein the target model is trained based on the historical node information and current node information of multiple storage nodes, and the storage probability value of each storage node represents the data storage volume of each storage node; then, the target storage node is determined from multiple storage nodes based on the storage probability value of each storage node; finally, the data to be stored is stored in the target storage node.
[0050] It is noteworthy that in the above process, the target storage node for storing the data is determined by processing the node information of multiple storage nodes based on the target model, so that the data can be evenly distributed across each storage node, thereby solving the problem of uneven distribution of node data during data storage. In addition, the target model is trained based on the historical node information and current node information of multiple storage nodes, and can be updated according to the data storage level of multiple storage nodes, improving the accuracy of the model in processing data, thereby improving the accuracy of determining the target storage node.
[0051] Therefore, the solution provided in this application achieves the goal of determining the target storage node from multiple storage nodes based on the target model for data storage, thereby realizing the technical effect of uniform distribution of node data volume during data storage, and thus solving the technical problem of uneven distribution of node data volume in the prior art during data storage.
[0052] In one optional embodiment, after obtaining the node information of multiple storage nodes, the system determines the data storage volume of each storage node based on the node information of the multiple storage nodes; and calculates the variance of the data storage volume of the multiple storage nodes to obtain a first variance value.
[0053] Optionally, in this embodiment, after obtaining the node information of multiple storage nodes, the system calculates the variance of the amount of data stored by all storage nodes before storing the data to obtain the first variance value s. t .
[0054] Furthermore, after storing the data to be stored in the target storage node, the system obtains the current data storage volume of multiple storage nodes; calculates the variance of the current data storage volume of multiple storage nodes to obtain the second variance value; calculates the difference between the first variance value and the second variance value to obtain the return value, wherein the return value represents the data storage fluctuation of multiple storage nodes.
[0055] Optionally, after storing the data to be stored in the target storage node, such as Figure 2 The diagram illustrates the data storage process. The system modifies the data storage volume of the target storage node in the storage record table, and then calculates the variance of the data storage volumes of multiple storage nodes after storing the data to obtain the second variance value s. t+1 The return value r is obtained by calculating the difference between the first variance value and the second variance value. t+1 The return value represents the data storage fluctuation across multiple storage nodes.
[0056] It should be noted that the return value is obtained by calculating the difference between the variance of the data storage volume of all storage nodes before storing the data and the variance of the data storage volume of multiple storage nodes after storing the data, which prepares for subsequent updates to the target model.
[0057] Furthermore, before storing the data to be stored in the target storage node, the system stores the data in the target storage node through the following steps:
[0058] Step 1: Check whether the data to be stored has been successfully stored in the target storage node;
[0059] Step 2: If the data to be stored is not successfully stored in the target storage node, determine the negative feedback value, and calculate the sum of the negative feedback value and the reward value to obtain the target reward value. Repeat steps 1-2 until the data to be stored is successfully stored in the target storage node, or when the number of unsuccessful storage attempts exceeds the first preset threshold, store the data to be stored in the candidate storage node. The candidate storage node is a storage node among multiple storage nodes whose data storage volume is greater than or equal to the second preset threshold. The target reward value is used to update the target model, and the negative feedback value is positively correlated with the number of unsuccessful storage attempts.
[0060] Optionally, before storing the data to be stored in the target storage node, the system may, for example... Figure 2The diagram illustrates the data storage process. When data to be stored fails to be stored in the target storage node, a negative feedback value is determined, and the sum of the negative feedback value and the reward value is calculated to obtain the target reward value. The negative feedback value is a fixed negative value set by the developers and is positively correlated with the number of unsuccessful storage attempts. That is, a negative feedback value is determined and the sum of the negative feedback value and the reward value is calculated every time storage fails. For example, if the negative feedback value is -20 when data to be stored fails to be stored in the target storage node, and the reward value is 200, then the target reward value is 180. If the data to be stored fails to be stored in the target storage node again in the next test, the sum of the negative feedback value and the reward value is calculated again, resulting in a target reward value of 160. Optionally, in this application, a higher reward value indicates a higher data storage capacity of the storage node.
[0061] Optionally, if the data to be stored is not successfully stored in the target storage node within a preset time, a negative feedback value is determined, and the sum of the negative feedback value and the reward value is calculated to obtain the target reward value.
[0062] Optionally, if the number of unsuccessful storage attempts exceeds a first preset threshold, the data to be stored is transferred to the storage node with the smallest data storage volume among multiple storage nodes. For example, if the number of unsuccessful storage attempts exceeds 5, the data to be stored needs to be transferred to the storage node with the smallest data storage volume among multiple storage nodes.
[0063] It should be noted that by calculating the sum of the negative feedback value and the reward value determined when the data to be stored fails to be stored in the target storage node, preparation is made for subsequent updates to the target model. By storing the data to be stored in the storage node with the smallest data storage volume among multiple storage nodes when the number of unsuccessful storage attempts exceeds a first preset threshold, it is possible to achieve a more even distribution of data across the storage nodes.
[0064] Furthermore, after storing the data to be stored in the target storage node, the system detects whether the amount of experience data in the first cache is greater than or equal to a third preset threshold. The experience data includes historical node information, current node information, and target reward value of multiple storage nodes. When the amount of experience data is greater than a second preset threshold, the experience data is sent to the computing node, and the experience data in the first cache is cleared. The computing node is used to train the target model.
[0065] Optionally, after storing the data to be stored in the target storage node, the historical node information of multiple storage nodes can be stored. t Current node information s t+1 and target return value r t+1 Experience data is stored in the first cache, for example, such as Figure 2The diagram shown illustrates the data storage process. The action of recording and determining the node_Id of the target storage node is designated as 'a'. t Timely return value r t+1 The system sends requests to multiple storage nodes to obtain their latest real-time status and records it. This data, along with the updated storage record table containing the data storage volume, performance, and latest real-time status of all storage nodes, is used as the input vector s. t+1 , will a t r t+1 s t+1 s t Store in the first cache. Then, as follows: Figure 3 The diagram illustrates the process of sending experience data to the computing node. When the amount of data in the first buffer is greater than or equal to a third preset threshold, the system master node sends the experience data to the computing node and clears the data in the first buffer. For example, if there are more than 200 pieces of experience data in the first buffer, these 200 pieces of experience data are sent to the computing node, and the 200 pieces of experience data in the first buffer are cleared.
[0066] Furthermore, the system monitors the running status of computing nodes; when a computing node is in the computing state, it stores the experience data in the second cache; when a computing node is in the computing completed state, it stores the experience data in the experience replay pool, where the experience replay pool is used to store the updated data of the target model.
[0067] Optional, such as Figure 3 The diagram shows the process of sending experience data to the computing node. When the computing node is in the computing state, the experience data sent by the master node is stored in the second buffer. When the computing is completed and the state is completed, if there is data in the temporary storage area, it is moved to the experience replay pool and the temporary storage area is cleared. Otherwise, it is directly stored in the experience replay pool.
[0068] Furthermore, the target model is updated through the following steps: the system obtains model update parameters based on computing nodes; and updates the target model based on the model update parameters.
[0069] Optionally, since model training and updating consumes significant resources, model training is performed on the computing nodes. The system master node obtains the model update parameters from the trained model on the computing nodes and updates the target model based on these parameters. For example, ... Figure 4 The diagram shows how the master node updates the policy network model after receiving parameters. The master node receives parameters sent by the compute nodes and updates the parameters of the policy network model based on the parameters sent by the compute nodes after completing the storage node partitioning.
[0070] It should be noted that updating the target model based on the model update parameters does not consume a large amount of resources, reducing the training time of the target model and improving the system's resource utilization and data storage efficiency. The updated model master node can temporarily store the new portfolio return data in shards without relying on computing nodes. If a majority of nodes fail, or if storage nodes are replaced, training can still be restarted to adapt to the new environment.
[0071] Furthermore, before obtaining model update parameters based on computing nodes, the system obtains a preset amount of empirical data based on computing nodes; determines the objective function of the target model based on the preset amount of empirical data; and determines the model update parameters based on the objective function, wherein the model update parameters are the model parameters of the trained target model.
[0072] Optional, such as Figure 5 The diagram illustrates the training process of the computing node model. When the amount of experience in the experience replay pool is greater than or equal to a preset amount, the computing node begins training the model and obtains the preset amount of experience data from the experience replay pool. If the amount of experience is B|, the current node information s is calculated using the following formula. t+1 Value V(s) t+1 ):
[0073] V(s t+1 ) = π φ (s t+1 ) T [Q θ′ (s t+1 )-αlog(π φ (s t+1 ))]
[0074] Where φ represents the model update parameters of the policy network model, θ represents the model update parameters of the value network model, and π represents the model update parameters of the value network model. φ (s t+1 Q is the parameter for calculating the policy value network. θ′ (s t+1 ) represents the parameters calculated based on the target value network model, and α represents the update step size.
[0075] Furthermore, calculate s t With a t The behavioral value is obtained, and the objective function for updating the model update parameters θ of the updated value network model is derived:
[0076]
[0077] Where y(r) t+1 ,s t+1 ,d)=r t+1 +γ(1-d)V(s t+1), Q θ The parameters are calculated based on the value network model, where d represents the data insertion state (1 for data insertion completed, 0 for data insertion not yet completed), and γ is the discount factor.
[0078] Furthermore, the objective function for the model update parameter φ of the updated policy network model is calculated:
[0079]
[0080] Furthermore, the gradients of the two objective functions are calculated, and gradient descent is performed on each function to update its parameters and determine the model update parameters. The model update parameters of the target value network model are updated every j iterations.
[0081] θ′←τθ′+(1-τ)θ
[0082] Where τ is the update step size with a step size of 0.005.
[0083] Optionally, every j training iterations, the compute node sends the model update parameters of the trained policy network model to the master node.
[0084] It should be noted that training the model through computing nodes does not require a large amount of resources, reduces the training time of the target model, and improves the system's resource utilization and data storage efficiency.
[0085] Therefore, this invention provides a novel data storage method. This method analyzes the characteristics of portfolio yield storage and uses deep reinforcement learning to determine the storage nodes, thus solving the problem that traditional methods do not consider the state of each storage node during partitioning. By designing a reasonable reward function, it alleviates the data skew problem caused by uneven distribution of node data during data storage. By using an offline reinforcement learning algorithm, it effectively utilizes past sharded historical data, solving the problem of low sample utilization.
[0086] Example 2
[0087] According to an embodiment of the present invention, an embodiment of a data storage device is provided, wherein, Figure 6 A schematic diagram of an optional data storage device according to an embodiment of the present invention, such as... Figure 6 As shown, the device includes:
[0088] The acquisition module 601 is used to acquire node information of multiple storage nodes, wherein the node information includes at least parameter information, data storage capacity information, and status information of multiple storage nodes, and the multiple storage nodes are used to store data; the processing module 602 is used to process the node information of multiple storage nodes based on a target model to obtain a storage probability value for each storage node, wherein the target model is trained based on the historical node information and current node information of multiple storage nodes, and the storage probability value of each storage node represents the data storage capacity of each storage node; the determination module 603 is used to determine the target storage node from multiple storage nodes based on the storage probability value of each storage node; and the storage module 604 is used to store the data to be stored into the target storage node.
[0089] It should be noted that the above-mentioned acquisition module 601, processing module 602, determination module 603 and storage module 604 correspond to steps S101 to S104 in the above embodiments. The four modules and the corresponding steps implement the same examples and application scenarios, but are not limited to the content disclosed in the above embodiment 1.
[0090] Optionally, the data storage device further includes a first determining module and a first calculating module. The first determining module is used to determine the data storage volume of each storage node based on the node information of the multiple storage nodes after obtaining the node information of the multiple storage nodes; the first calculating module is used to calculate the variance of the data storage volume of the multiple storage nodes to obtain a first variance value.
[0091] Optionally, the data storage device further includes: a first acquisition module, a second calculation module, and a third calculation module. The first acquisition module is used to acquire the current data storage volume of multiple storage nodes after storing the data to be stored into the target storage node; the second calculation module is used to calculate the variance of the current data storage volume of multiple storage nodes to obtain a second variance value; the third calculation module is used to calculate the difference between the first variance value and the second variance value to obtain a return value, wherein the return value represents the data storage fluctuation of multiple storage nodes.
[0092] Optionally, the data storage device further includes a detection module and a first storage module. The detection module is used to detect whether the data to be stored has been successfully stored in the target storage node before storing the data to be stored in the target storage node. The first storage module is used to determine a negative feedback value if the data to be stored is not successfully stored in the target storage node, and calculate the sum of the negative feedback value and the reward value to obtain the target reward value. Steps 1 and 2 are repeated until the data to be stored is successfully stored in the target storage node, or when the number of unsuccessful storage attempts exceeds a first preset threshold, the data to be stored is stored in a candidate storage node. The candidate storage node is a storage node among multiple storage nodes whose data storage volume is greater than or equal to a second preset threshold. The target reward value is used to update the target model, and the negative feedback value is positively correlated with the number of unsuccessful storage attempts.
[0093] Optionally, the data storage device further includes a second detection module and a sending module. The second detection module is used to detect whether the amount of experience data in the first cache is greater than or equal to a third preset threshold after storing the data to be stored in the target storage node, wherein the experience data includes historical node information, current node information, and target reward value of multiple storage nodes; the sending module is used to send the experience data to the computing node and clear the experience data in the first cache when the amount of experience data is greater than the second preset threshold, wherein the computing node is used to train the target model.
[0094] Optionally, the sending module also includes a monitoring module, a second storage module, and a third storage module. The monitoring module is used to monitor the running status of the computing nodes; the second storage module is used to store experience data in a second cache when the computing node is in the computing state; the third storage module is used to store experience data in an experience replay pool when the computing node is in the computing completed state, wherein the experience replay pool is used to store the updated data of the target model.
[0095] Optionally, the data storage device further includes a second acquisition module and a model update module. The second acquisition module is used to acquire model update parameters based on the computing nodes; the model update module is used to update the target model based on the model update parameters.
[0096] Optionally, the data storage device further includes: a third acquisition module, a second determination module, and a third determination module. The third acquisition module is used to acquire a preset amount of empirical data based on the computing nodes; the second determination module is used to determine the objective function of the target model based on the preset amount of empirical data; the third determination module is used to determine the model update parameters based on the objective function, wherein the model update parameters are the model parameters of the trained target model.
[0097] Example 3
[0098] According to another aspect of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer-readable storage medium, and the computer program is configured to execute the above-described data storage method at runtime.
[0099] Example 4
[0100] According to another aspect of the present invention, an electronic device is also provided, wherein, Figure 7 This is a schematic diagram of an optional electronic device according to an embodiment of the present invention, such as... Figure 7 As shown, the electronic device includes one or more processors; and a memory for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to run the programs, wherein the programs are configured to execute the data storage method described above during runtime.
[0101] Example 5
[0102] According to another aspect of the present invention, a computer program product is also provided, including a computer program / instructions that, when executed by a processor, implement the data storage method described above.
[0103] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0104] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0105] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between units or modules may be electrical or other forms.
[0106] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0107] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0108] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0109] The above are merely preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A data storage method, characterized in that, include: Obtain node information for multiple storage nodes, wherein the node information includes at least parameter information, data storage volume information, and status information of the multiple storage nodes, and the multiple storage nodes are used to store data; The node information of the multiple storage nodes is processed based on the target model to obtain the storage probability value of each storage node. The target model is trained based on the historical node information and current node information of the multiple storage nodes. The storage probability value of each storage node represents the data storage volume of each storage node. The target model adopts an offline strategy algorithm. The target storage node is determined from the plurality of storage nodes based on the storage probability value of each storage node; The data to be stored is stored in the target storage node; Before storing the data to be stored in the target storage node, the method further includes: Step 1: Detect whether the data to be stored has been successfully stored in the target storage node; Step 2: If the data to be stored is not successfully stored in the target storage node, determine the negative feedback value, and calculate the sum of the negative feedback value and the reward value to obtain the target reward value. Repeat steps 1-2 until the data to be stored is successfully stored in the target storage node, or when the number of unsuccessful storage attempts exceeds a first preset threshold, store the data to be stored in a candidate storage node. The candidate storage node is a storage node among the plurality of storage nodes whose data storage volume is greater than or equal to a second preset threshold. The target reward value is used to update the target model. The negative feedback value is positively correlated with the number of unsuccessful storage attempts. The reward value represents the data storage fluctuation of the plurality of storage nodes.
2. The method according to claim 1, characterized in that, After obtaining the node information of multiple storage nodes, the method further includes: The data storage volume of each storage node is determined based on the node information of the multiple storage nodes; Calculate the variance of the data storage volume of the multiple storage nodes to obtain the first variance value.
3. The method according to claim 2, characterized in that, After storing the data to be stored in the target storage node, the method further includes: Obtain the current data storage volume of the multiple storage nodes; Calculate the variance of the current data storage volume of the multiple storage nodes to obtain the second variance value; The difference between the first variance value and the second variance value is calculated to obtain the return value.
4. The method according to claim 1, characterized in that, After storing the data to be stored in the target storage node, the method further includes: The system detects whether the amount of experience data in the first cache is greater than or equal to a third preset threshold, wherein the experience data includes historical node information of the multiple storage nodes, current node information, and the target reward value. When the amount of experience data exceeds the second preset threshold, the experience data is sent to the computing node, and the experience data in the first cache is cleared, wherein the computing node is used to train the target model.
5. The method according to claim 4, characterized in that, When the amount of experience data exceeds the second preset threshold, the experience data is sent to the computing node, including: Monitor the operating status of the computing nodes; When the computing node is in computing state, the experience data is stored in the second cache area; When the computing node is in the computing completed state, the experience data is stored in the experience replay pool, wherein the experience replay pool is used to store the updated data of the target model.
6. The method according to claim 5, characterized in that, The target model is updated through the following steps: Obtain model update parameters based on the computing nodes; The target model is updated based on the model update parameters.
7. The method according to claim 6, characterized in that, Before obtaining model update parameters based on the computing node, the method further includes: A preset amount of empirical data is obtained based on the computing nodes; The objective function of the target model is determined based on the preset amount of empirical data. The model update parameters are determined based on the objective function, wherein the model update parameters are the model parameters of the trained target model.
8. A data storage device, characterized in that, include: The acquisition module is used to acquire node information of multiple storage nodes, wherein the node information includes at least parameter information, data storage volume information and status information of the multiple storage nodes, and the multiple storage nodes are used to store data; The processing module is used to process the node information of the multiple storage nodes based on the target model to obtain the storage probability value of each storage node. The target model is trained based on the historical node information and current node information of the multiple storage nodes. The storage probability value of each storage node represents the data storage volume of each storage node. The target model adopts an offline strategy algorithm. The determination module is used to determine the target storage node from the plurality of storage nodes based on the storage probability value of each storage node; The storage module is used to store the data to be stored into the target storage node; The device further includes: a detection module, used to detect whether the data to be stored has been successfully stored in the target storage node before storing the data to be stored in the target storage node; a first storage module, used to determine a negative feedback value if the data to be stored is not successfully stored in the target storage node, and calculate the sum of the negative feedback value and the reward value to obtain a target reward value, and repeat steps 1-2 until the data to be stored is successfully stored in the target storage node, or when the number of unsuccessful storage is greater than a first preset threshold, store the data to be stored in a candidate storage node, wherein the candidate storage node is a storage node among multiple storage nodes whose data storage volume is greater than or equal to a second preset threshold, the target reward value is used to update the target model, the negative feedback value is positively correlated with the number of unsuccessful storage, wherein the reward value characterizes the data storage fluctuation of the multiple storage nodes.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the data storage method according to any one of claims 1 to 7 when it is run.
10. An electronic device, characterized in that, Electronic devices include one or more processors; A memory for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to be configured to run the programs, wherein the programs are configured to execute the data storage method of any one of claims 1 to 7 at runtime.
11. A computer program product, comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the data storage method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Distributed cluster storage method, system and device and computer readable storage medium
CN110650208A
