Resource storage method and device, storage medium, electronic device and computer program product
By receiving storage requests in the FTTR network and obtaining real-time information from each slave gateway, and using intelligent algorithms to determine the optimal storage location, the problem of overloading of a single device when storing files in the FTTR network is solved, and the reasonable allocation of network resources and efficient data processing is achieved.
Patent Information
- Application Number
- CN202510688874.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-27
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2045-05-27
AI Technical Summary
In FTTR networks, storing files can easily lead to the problem of overloading a single device.
By receiving storage requests, the storage capacity, network load and device load information of each slave gateway are obtained, and the optimal storage gateway is determined in the FTTR network using intelligent algorithms to reasonably allocate storage resources and avoid device overload.
It realizes the rational allocation of storage resources and efficient data processing in the FTTR network, ensuring the stability and fluency of the network.
Smart Images

Figure CN120223699B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of communications, and in particular, to a resource storage method and device, a storage medium, an electronic device, and a computer program product. Background Art
[0002] With the widespread adoption of smart devices such as mobile phones, tablets, and smart TVs, modern households are increasingly demanding data storage and sharing, particularly the efficient management of large amounts of multimedia files such as photos, videos, documents, and music. Fiber to the Room (FTTR) technology, with its superior network performance, delivers fiber directly into the home, pioneering higher bandwidth and lower latency communications compared to traditional networks. This creates a first-class network experience for home users. Data storage solutions enabled by FTTR technology are particularly important when multiple devices are simultaneously engaged in high-bandwidth applications such as online gaming, HD video streaming, and remote working.
[0003] In an FTTR system architecture, whether using external or built-in storage, family members can seamlessly access storage resources over the FTTR network, enabling convenient uploading and downloading of photos, videos, and files. This not only improves data access speed but also ensures the stability and smoothness of the home network. However, existing technologies can easily overload a single device when storing files on an FTTR network.
[0004] In the prior art, in FTTR networks, when storing files, a single device is prone to overload, and no effective solution has yet been proposed.
[0005] Therefore, it is necessary to improve the related technology to overcome the above-mentioned defects in the related technology. Summary of the Invention
[0006] Embodiments of the present invention provide a resource storage method and apparatus, a storage medium, an electronic device, and a computer program product to at least solve the problem in related technologies that a single device is easily overloaded when storing files in an FTTR network.
[0007] According to one embodiment of the present invention, a resource storage method is provided, comprising: receiving a storage request sent by a target object, wherein the storage request is used to request that a first resource be stored in a gateway; obtaining gateway information of each slave gateway in a target network, wherein the gateway information includes at least storage capacity, network load, and device load, wherein the target network includes a master gateway and the slave gateway; determining a first storage gateway in the target network based on the gateway information, so as to store the first resource in the first storage gateway.
[0008] According to another embodiment of the present invention, a resource storage device is provided, including: a receiving module for receiving a storage request sent by a target object, wherein the storage request is used to request that a first resource of the target object be stored in a gateway; an acquisition module for acquiring gateway information of each slave gateway in a target network, wherein the gateway information includes at least storage capacity, network load, and device load, wherein the target network includes a master gateway and the slave gateway; a determination module for determining a first storage gateway in the target network according to the gateway information, so as to store the first resource in the first storage gateway.
[0009] According to yet another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is configured to execute the steps of any one of the above method embodiments when run.
[0010] According to another embodiment of the present invention, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any one of the above method embodiments.
[0011] According to yet another embodiment of the present invention, a computer program product is provided, including a computer program, which implements the steps of any of the above method embodiments when executed by a processor.
[0012] Through the above-mentioned embodiment of the present invention, a storage request sent by a target object is received, wherein the storage request is used to request that a first resource be stored in a gateway; gateway information of each slave gateway in the target network is obtained, wherein the gateway information includes at least: storage capacity, network load and device load, wherein the target network includes: a master gateway and the slave gateway; a first storage gateway is determined in the target network according to the gateway information to store the first resource in the first storage gateway, that is, in the embodiment of the present application, by comprehensively collecting real-time information of each slave gateway in the FTTR network and making intelligent storage decisions based on this information, the problem of single device overload that is easily encountered when storing files in the FTTR network is solved, thereby ensuring the reasonable allocation of network resources and the high efficiency of data processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 It is a hardware structure block diagram of a computer device for the resource storage method of an embodiment of the present application;
[0014] Figure 2 This is a system architecture diagram of a resource storage method according to an embodiment of the present application;
[0015] Figure 3 is a flowchart of a method for storing resources according to an embodiment of the present application;
[0016] Figure 4 This is a schematic diagram of the FTTR home storage device network according to an embodiment of the present application;
[0017] Figure 5 is a flowchart of a data storage decision method according to an embodiment of the present application;
[0018] Figure 6 is a flowchart of a data synchronization decision method according to an embodiment of the present application;
[0019] Figure 7 This is a flowchart of a method for powering on and off a gateway according to an embodiment of the present application;
[0020] Figure 8 It is a structural block diagram of a resource storage device according to an embodiment of the present application. DETAILED DESCRIPTION
[0021] Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings and in combination with embodiments.
[0022] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0023] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a computer terminal as an example, Figure 1 This is a hardware block diagram of a computer terminal running the method embodiment of the present invention. Figure 1 As shown, the computer terminal may include one or more ( Figure 1 Only one is shown) a processor 102 (the processor 102 may include but is not limited to a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. The computer terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. For example, the computer terminal may also include Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.
[0024] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the resource storage method in the embodiment of the present invention. The processor 102 executes the computer program stored in the memory 104 to perform various functional applications and data processing, that is, to implement the above-mentioned method. The memory 104 may include a high-speed random access memory and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0025] Transmission device 106 is used to receive or transmit data via a network. A specific example of the aforementioned network may include a wireless network provided by a computer terminal's communications provider. In one embodiment, transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0026] The embodiment of the present application can be run on Figure 2 As shown in the system architecture, Figure 2 As shown, the system architecture includes: a user terminal, a master gateway and a slave gateway, wherein the user terminal is connected to the master gateway via UDP / TCP, the user terminal is connected to the slave gateway via SMB, and the slave gateway and the master gateway transmit information via internal messages.
[0027] The slave gateway, when integrated with storage capabilities, can report its status to the master gateway.
[0028] The master gateway includes storage management and storage synchronization modules. The storage management module records detailed information about all slave devices and maintains a heartbeat mechanism with the slave gateways. When a user initiates a data upload request, this module selects the optimal storage path based on the real-time status of the storage device (including storage capacity, network, and device load).
[0029] The storage synchronization module is used to synchronize data that has not been backed up in time and actively copy it to other healthy devices outside the primary storage device.
[0030] In this embodiment, a method for storing resources running on a computer terminal or the above system architecture is provided. Figure 3is a flow chart of resource storage according to an embodiment of the present invention, such as Figure 3 As shown, the process includes the following steps:
[0031] Step S302: receiving a storage request sent by a target object, wherein the storage request is used to request to store the first resource in the gateway;
[0032] The primary gateway listens for and receives storage requests from target objects (such as user devices, applications, etc.).
[0033] Step S304: Acquire gateway information of each slave gateway in the target network, wherein the gateway information includes at least storage capacity, network load, and device load, wherein the target network includes a master gateway and the slave gateways;
[0034] After receiving the storage request, the master gateway collects the real-time status information of all slave gateways in the target network, including but not limited to key indicators such as storage capacity, network load, and device load. The target network refers to an FTTR network environment composed of a master gateway and multiple slave gateways, where the slave gateways may or may not have storage functions. The target network diagram is shown in the figure below. Figure 4 shown.
[0035] Step S306: Determine a first storage gateway in the target network according to the gateway information, so as to store the first resource in the first storage gateway.
[0036] Based on the detailed gateway information collected in step S304, the master gateway uses an intelligent algorithm to determine the data storage location. Specifically, it determines a primary storage gateway to store the primary resource, taking into account the storage capacity of the slave gateways and the current load of the network and devices. This avoids imbalanced resource storage and prevents overloading of a single gateway, thereby ensuring efficient operation of the entire FTTR network and smooth data transmission.
[0037] Through the above steps, a storage request sent by the target object is received, wherein the storage request is used to request that the first resource be stored in the gateway; gateway information of each slave gateway in the target network is obtained, wherein the gateway information includes at least: storage capacity, network load and device load, wherein the target network includes: a master gateway and the slave gateway; a first storage gateway is determined in the target network according to the gateway information to store the first resource in the first storage gateway, that is, in an embodiment of the present application, by comprehensively collecting real-time information of each slave gateway in the FTTR network and making intelligent storage decisions based on this information, the problem of single device overload that is easily encountered when storing files in the FTTR network is solved, thereby ensuring the reasonable allocation of network resources and the high efficiency of data processing.
[0038] Optionally, determining the first storage gateway in the target network based on the gateway information includes: determining the resource size of the first resource, and determining a first slave gateway in the target network whose storage capacity is greater than or equal to the resource size of the first resource; determining a comprehensive score of each first slave gateway based on the network load and device load of each first slave gateway; and determining the first storage gateway in the target network based on the comprehensive score of each first slave gateway.
[0039] In an embodiment of the present application, the master gateway determines the precise resource size of a first resource (e.g., a file, media content, etc.) to be stored. Furthermore, in a target network (composed of the master gateway and multiple slave gateways), all slave gateways whose storage capacity is greater than or equal to the first resource size are selected, i.e., the first slave gateways.
[0040] For each selected first-tier slave gateway, the master gateway further calculates its comprehensive score. Using a pre-defined formula (for example, comprehensive score = α × network load + β × device load, where α and β are weights), the master gateway calculates the overall performance score of the slave gateway. A lower score indicates a lighter current load and a more suitable performance for data storage.
[0041] Finally, the master gateway selects the first storage gateway with the lowest score based on the comprehensive score of each first slave gateway, thereby effectively avoiding the concentrated overload of storage resources and realizing the intelligent allocation and balanced utilization of storage resources in the FTTR network.
[0042] Alternatively, as Figure 5 As shown in the figure, a data storage decision process is given, and the specific steps are as follows:
[0043] Step S501: The user initiates a storage request;
[0044] The user sends a storage request message to the main gateway through the client application, indicating that there is data to be uploaded or stored.
[0045] Step S502: The master gateway initiates an information acquisition request to the slave gateway;
[0046] After receiving the request, the storage management module of the master gateway starts the storage decision process based on the latest device information record (see Table 1) and sends decision information acquisition requests to all slave gateways with storage capabilities in the network to evaluate their current status.
[0047] Table 1
[0048] Device Identity (MAC) Device address (IP) MAC1 192.168.xx MAC2 192.168.xx MAC3 192.168.xx ... ...
[0049] Step S503: reporting from gateway information;
[0050] After receiving a request, each slave gateway first checks the MAC field in the request to ensure that the message originates from the master gateway and prevent unauthorized access. Once verified, the slave gateway's node management module feeds the master gateway real-time status information about the storage device, including storage capacity, network load, and device load.
[0051] Step S504: Comprehensive scoring evaluation of the main gateway;
[0052] After collecting feedback from all slave gateways, the master gateway records it in the device status information table (see Table 2). A pre-defined comprehensive score is then calculated using the formula: Comprehensive score = α × network load + β × device load. Network load represents the ratio of current bandwidth usage to total bandwidth, while device load reflects CPU utilization. α and β are weighting factors used to balance their impact. If network load and device load are considered equally important, both α and β can be set to 0.5. Devices with lower scores indicate better performance, more abundant bandwidth and CPU resources, and are therefore more suitable targets for data storage.
[0053] Table 2
[0054] Device Identity (MAC) Capacity (GB) Device load (0~1) Network load (0~1) Comprehensive load (0~100) MAC1 256 0.6 0.5 55 MAC2 256 0.8 0.8 80 MAC3 512 0.5 0.4 45 ... ... ... ... ...
[0055] Step S505: Return the optimal storage path to the user terminal;
[0056] The main gateway intelligently selects the most suitable storage device based on the comprehensive scoring results and feeds this decision back to the user or client.
[0057] Step S506: The user terminal connects to the selected storage device to upload data.
[0058] By dynamically selecting devices with low network load and small CPU burden for data storage, the response speed and storage reliability of the entire system are significantly improved, creating a smooth and stable user storage experience.
[0059] Optionally, obtaining the gateway information of each slave gateway in the target network includes: sending an information acquisition request to each slave gateway based on the stored device information, wherein the device information includes at least: identification information and address information of the slave gateway; and receiving the gateway information sent by each slave gateway based on the information acquisition request when each slave gateway verifies and passes the information acquisition request.
[0060] In the embodiment of the present application, the master gateway first sends an information acquisition request to each slave gateway based on the stored device information, wherein the device information at least includes the unique identification information (such as MAC address) and address information (such as IP address) of the slave gateway.
[0061] When a request for information is received from a gateway, it is first verified. This verification step ensures that the request originates from a legitimate source, namely, the primary gateway. This prevents unauthorized devices or third-party primary gateways from interfering with or tampering with network data, thereby ensuring the security of the entire FTTR network.
[0062] Once the verification is passed, the slave gateway will respond to the master gateway's information acquisition request and send back gateway information including storage capacity, network load, and device load.
[0063] Optionally, after determining the first storage gateway in the target network according to the gateway information, the method further includes: determining the backup status of the second resource stored in the primary gateway, and determining in the second resource that the backup status is a third resource that is not backed up; determining the second storage gateway in the target network according to the gateway information, and storing the third resource in the second storage gateway.
[0064] In FTTR networks, to ensure data security and persistence, data stored in the master gateway is backed up to other storage resources in the network, such as slave gateways. Therefore, the master gateway needs to regularly or based on specific events check whether the data stored in its internal resources has been correctly backed up, that is, to confirm whether the data exists in other designated storage locations or whether the backup process has been completed.
[0065] "Tertiary resources" refer to data stored on the primary gateway (secondary resource) but not yet successfully backed up elsewhere. In other words, this data is stored on the primary gateway but not on other secondary gateways. The primary gateway's storage synchronization module analyzes storage resource information to identify data (i.e., tertiary resources) that has not yet been backed up.
[0066] In this embodiment of the application, the master gateway not only manages its own storage capacity and data, but also ensures that this data is replicated (backed up) on other storage resources, thereby maintaining data integrity and availability across the entire network. If it detects that some data is not backed up, the master gateway will send a storage request to other slave gateways to ensure that all important data is properly backed up, reducing the risk of data loss.
[0067] Optionally, determining a second storage gateway in the target network based on the gateway information includes: determining the resource size of the third resource, and determining a second slave gateway in the target network whose storage capacity is greater than or equal to the resource size of the third resource; determining a comprehensive score of each second slave gateway based on the network load and device load of each second slave gateway; and determining a second storage gateway in the target network based on the comprehensive score of each second slave gateway.
[0068] In this embodiment of the present application, the master gateway selects all slave gateways in the target network whose storage capacity is greater than or equal to the size of the third resource as potential second storage gateway candidates. That is, by comparing the storage capacity of each slave gateway with the size of the resource to be stored, the selection range is narrowed down to only those slave gateways with sufficient space.
[0069] The master gateway further calculates the comprehensive scores of the selected second slave gateways. Finally, the master gateway compares and analyzes the comprehensive scores of each second slave gateway and selects a second storage gateway to store the third resource.
[0070] Optionally, determining the second storage gateway in the target network based on the comprehensive score of each second slave gateway includes: determining the size relationship between the comprehensive score of each second slave gateway and a preset comprehensive score; when any size relationship indicates that the comprehensive score is less than the preset comprehensive score, determining the slave gateway with the largest storage capacity among the second slave gateways whose comprehensive scores are less than the preset comprehensive score, and determining the slave gateway with the largest storage capacity as the second storage gateway; when each size relationship indicates that the comprehensive score is greater than or equal to the preset comprehensive score, determining the slave gateway with the smallest comprehensive score among the second slave gateways, and determining the slave gateway with the smallest comprehensive score as the second storage gateway.
[0071] First, the master gateway compares the comprehensive score of each slave gateway with a preset comprehensive score threshold. If the comprehensive score of any slave gateway is lower than the preset comprehensive score, the master gateway will prioritize the slave gateway with the largest storage capacity among these lower-scoring ones.
[0072] The secondary gateway with the largest storage capacity will be selected as the second storage gateway, which can utilize devices with larger storage space, helping to improve resource utilization efficiency.
[0073] If the comprehensive scores of all second slave gateways are not lower than the preset comprehensive score, the master gateway will select the slave gateway with the lowest comprehensive score as the second storage gateway.
[0074] Alternatively, as Figure 6 As shown in the figure, a data synchronization decision process is given. The specific steps are as follows:
[0075] Step S601: The primary gateway sends a request to obtain device information;
[0076] The storage synchronization module of the main gateway actively scans the storage data record information (as shown in Table 3) based on the predetermined time interval to identify any data that has not been backed up across devices.
[0077] Table 3
[0078] Storage file number Storage file name Device Identity (MAC) 1 aaa.jpg MAC2 2 bbb.mp4 MAC2 3 ccc.txt MAC3 ... ...
[0079] Step S602: Obtain relevant information from the gateway and return;
[0080] When a slave gateway receives a synchronization request from the master gateway, it first verifies the MAC address in the request to confirm that it is from a legitimate master gateway. Once verified, the slave gateway's node management module returns information including storage capacity, network load, and device load.
[0081] Step S603: The master gateway determines the device to be synchronized;
[0082] After receiving responses from the slave gateways, the master gateway consolidates this status information and updates it to the device status information table. Then, based on a balance between storage capacity and the overall score (less than 0.8), the device with the largest storage capacity is selected for data synchronization upload. If the overall score of all slave gateways is higher than 0.8, indicating relatively high network and device loads, the standard selection process is used to select the most suitable device for data backup. This prevents overuse of individual devices and ensures balanced and efficient use of storage resources.
[0083] Step S604: issuing synchronization instructions and executing data migration;
[0084] After determining the optimal storage path, the master gateway sends a synchronization command to the selected storage device, including the specific backup data and target device information. The storage device that receives the command responds quickly and executes the data synchronization process, immediately migrating the unbacked-up data to the designated slave gateway device.
[0085] Optionally, before receiving the storage request sent by the target object, the method also includes at least one of the following: obtaining status information of each slave gateway in the target network; determining whether to update the device information stored in the master gateway based on the status information; sending heartbeat information to each slave gateway in the target network, and determining whether to update the device information stored in the master gateway based on the response information of the heartbeat information.
[0086] Before receiving a storage request from a target client (a user or application), the master gateway obtains the latest status information for each slave gateway in the target network, including but not limited to fault status and normal status information. By obtaining this information periodically or in real time, the accuracy and efficiency of storage decisions are improved.
[0087] To enhance the real-time and reliability of device information, the master gateway also sends a heartbeat message to each slave gateway in the target network before accepting a storage request. This heartbeat message confirms the slave's current online status and response speed. Upon receiving the heartbeat message, the slave gateway quickly provides feedback on its status, including but not limited to whether it is online and operating normally. Based on the received response, the master gateway determines whether its stored device information needs to be updated. For example, if a slave gateway fails to respond to a heartbeat message, it may be offline or malfunctioning. In this case, the master gateway should update the device information and exclude the device from storage allocation decisions.
[0088] Through the above steps, the efficiency, stability and security of data storage are ensured.
[0089] Alternatively, as Figure 7 The figure shows a process for powering on and off the gateway. The specific steps are as follows:
[0090] Step S701: Power on the gateway and self-check storage capacity;
[0091] When the slave gateway device is started or powered on, its storage node module immediately executes a self-test program to check whether the device is configured with storage media and its availability.
[0092] Step S702: Report storage capacity and status from the gateway;
[0093] Once storage capabilities are confirmed, the secondary gateway will proactively send a storage capacity report to the primary gateway, indicating its eligibility as a storage node. The node management module continuously monitors the health of local storage devices. If a storage anomaly (such as a disk failure or insufficient storage space) is detected, it immediately notifies the primary gateway of the anomaly, triggering a timely response mechanism.
[0094] Step S703: Heartbeat message interaction between devices;
[0095] After receiving reports from slave gateways, the master gateway updates or modifies the device information table (see Table 1) based on storage capacity and abnormal status information to ensure the accuracy of recorded device status. The master gateway's storage management module establishes continuous heartbeat communication with slave gateways within the network. By sending heartbeat packets every three minutes and waiting for a response within five seconds, with a maximum of three attempts, this effectively monitors and maintains device connections, preventing information loss due to power outages or network failures.
[0096] Step S704: In response to an abnormal heartbeat between devices, the master gateway dynamically adjusts the device information table;
[0097] During the heartbeat keepalive period, if the master gateway detects that any slave gateway does not respond to the heartbeat signal within the specified number of retries, it will be regarded as a disconnected or abnormal device, and its record will be removed from the device information table (such as Table 1) to prevent invalid data from affecting subsequent storage decisions and data synchronization operations.
[0098] Through the description of the above embodiments, those skilled in the art will clearly understand that the methods according to the above embodiments can be implemented using software plus the necessary general-purpose hardware platform. Of course, hardware can also be used, but in many cases the former is a more preferred embodiment. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, or optical disk) and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in various embodiments of the present invention.
[0099] In this embodiment, a resource storage device is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments. Details already described will not be repeated here. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.
[0100] Figure 8 is a structural block diagram of a resource storage device according to an embodiment of the present invention, such as Figure 8 As shown, the device includes:
[0101] A receiving module 82 is configured to receive a storage request sent by a target object, wherein the storage request is used to request that a first resource of the target object be stored in a gateway;
[0102] an acquisition module 84 for acquiring gateway information of each slave gateway in a target network, wherein the gateway information includes at least storage capacity, network load, and device load, wherein the target network includes a master gateway and the slave gateways;
[0103] The determination module 86 is configured to determine a first storage gateway in the target network according to the gateway information, so as to store the first resource in the first storage gateway.
[0104] Through the above-mentioned device, a storage request sent by the target object is received, wherein the storage request is used to request that the first resource be stored in the gateway; the gateway information of each slave gateway in the target network is obtained, wherein the gateway information at least includes: storage capacity, network load and device load, wherein the target network includes: a master gateway and the slave gateway; according to the gateway information, a first storage gateway is determined in the target network to store the first resource in the first storage gateway, that is, in an embodiment of the present application, by comprehensively collecting real-time information of each slave gateway in the FTTR network and making intelligent storage decisions based on this information, the problem of single device overload that is easily encountered when storing files in the FTTR network is solved, thereby ensuring the reasonable allocation of network resources and the high efficiency of data processing.
[0105] In an exemplary embodiment, a determination module is used to determine the resource size of the first resource, and to determine a first slave gateway in the target network whose storage capacity is greater than or equal to the resource size of the first resource; to determine a comprehensive score of each first slave gateway based on the network load and device load of each first slave gateway; and to determine a first storage gateway in the target network based on the comprehensive score of each first slave gateway.
[0106] In an exemplary embodiment, the acquisition module is used to send an information acquisition request to each of the slave gateways based on stored device information, wherein the device information includes at least: identification information and address information of the slave gateway; and receive gateway information sent by each slave gateway based on the information acquisition request when each slave gateway verifies the information acquisition request.
[0107] In an exemplary embodiment, a determination module is used to determine the backup status of a second resource stored in the primary gateway, and to determine in the second resource that the backup status is a third resource that is not backed up; determine a second storage gateway in the target network based on the gateway information, and store the third resource in the second storage gateway.
[0108] In an exemplary embodiment, a determination module is used to determine the resource size of the third resource, and to determine a second slave gateway in the target network whose storage capacity is greater than or equal to the resource size of the third resource; to determine a comprehensive score of each second slave gateway based on the network load and device load of each second slave gateway; and to determine a second storage gateway in the target network based on the comprehensive score of each second slave gateway.
[0109] In an exemplary embodiment, a determination module is used to determine the size relationship between the comprehensive score of each second slave gateway and a preset comprehensive score; when any size relationship indicates that the comprehensive score is less than the preset comprehensive score, determine the slave gateway with the largest storage capacity among the second slave gateways whose comprehensive score is less than the preset comprehensive score, and determine the slave gateway with the largest storage capacity as the second storage gateway; when each size relationship indicates that the comprehensive score is greater than or equal to the preset comprehensive score, determine the slave gateway with the smallest comprehensive score among the second slave gateways, and determine the slave gateway with the smallest comprehensive score as the second storage gateway.
[0110] In an exemplary embodiment, the determination module is used to perform at least one of the following: obtaining status information of each slave gateway in the target network; determining whether to update the device information stored in the master gateway based on the status information; sending heartbeat information to each slave gateway in the target network, and determining whether to update the device information stored in the master gateway based on the response information of the heartbeat information.
[0111] It should be noted that the above modules can be implemented through software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0112] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any one of the above method embodiments when running.
[0113] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0114] An embodiment of the present invention further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0115] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0116] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail here.
[0117] Obviously, those skilled in the art will appreciate that the various modules or steps of the present invention described above can be implemented using a general-purpose computing device, can be centralized on a single computing device, or can be distributed across a network of multiple computing devices. They can be implemented using program code executable by the computing device, and thus, can be stored in a storage device and executed by the computing device. In some cases, the steps shown or described herein can be performed in a different order than that shown, or can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0118] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the principles of the present invention are intended to be within the scope of protection of the present invention.
Claims
1. A method for storing resources, characterized in that: include: Receive a storage request sent by a target object, wherein the storage request is used to request to store the first resource in the gateway; Obtaining gateway information of each slave gateway in a target network, wherein the gateway information includes at least storage capacity, network load, and device load, wherein the target network includes a master gateway and the slave gateways; Determining a first storage gateway in the target network according to the gateway information, so as to store the first resource in the first storage gateway; Among them, after determining the first storage gateway in the target network according to the gateway information, the method also includes: determining the backup status of the second resource stored in the master gateway, and determining the third resource whose backup status is not backed up in the second resource; determining the resource size of the third resource, and determining a second slave gateway in the target network whose storage capacity is greater than or equal to the resource size of the third resource; determining the comprehensive score of each second slave gateway according to the network load and device load of each second slave gateway; determining the size relationship between the comprehensive score of each second slave gateway and the preset comprehensive score; when any size relationship indicates that the comprehensive score is less than the preset comprehensive score, determining the slave gateway with the largest storage capacity among the second slave gateways whose comprehensive score is less than the preset comprehensive score, and determining the slave gateway with the largest storage capacity as the second storage gateway; when each size relationship indicates that the comprehensive score is greater than or equal to the preset comprehensive score, determining the slave gateway with the smallest comprehensive score among the second slave gateways, and determining the slave gateway with the smallest comprehensive score as the second storage gateway; storing the third resource to the second storage gateway.
2. The method according to claim 1, characterized in that Determining a first storage gateway in the target network according to the gateway information includes: Determining a resource size of the first resource, and determining a first slave gateway in the target network having a storage capacity greater than or equal to the resource size of the first resource; Determining a comprehensive score of each first slave gateway according to the network load and device load of each first slave gateway; A first storage gateway is determined in the target network according to the comprehensive score of each first slave gateway.
3. The method according to claim 1, characterized in that Before receiving the storage request sent by the target object, the method further includes at least one of the following: Obtaining status information of each slave gateway in the target network; determining whether to update device information stored in the master gateway based on the status information; Sending heartbeat information to each slave gateway in the target network, and determining whether to update the device information stored in the master gateway according to response information of the heartbeat information.
4. A resource storage device, characterized in that: include: A receiving module, configured to receive a storage request sent by a target object, wherein the storage request is used to request that a first resource of the target object be stored in a gateway; An acquisition module, configured to acquire gateway information of each slave gateway in a target network, wherein the gateway information includes at least storage capacity, network load, and device load, wherein the target network includes a master gateway and the slave gateways; a determining module, configured to determine a first storage gateway in the target network according to the gateway information, so as to store the first resource in the first storage gateway; Among them, the determination module is also used to determine the backup status of the second resource stored in the master gateway, and to determine the third resource in the second resource whose backup status is not backed up; determine the resource size of the third resource, and determine the second slave gateway in the target network whose storage capacity is greater than or equal to the resource size of the third resource; determine the comprehensive score of each second slave gateway based on the network load and device load of each second slave gateway; determine the size relationship between the comprehensive score of each second slave gateway and the preset comprehensive score; when any size relationship indicates that the comprehensive score is less than the preset comprehensive score, determine the slave gateway with the largest storage capacity among the second slave gateways whose comprehensive score is less than the preset comprehensive score, and determine the slave gateway with the largest storage capacity as the second storage gateway; when each size relationship indicates that the comprehensive score is greater than or equal to the preset comprehensive score, determine the slave gateway with the smallest comprehensive score among the second slave gateways, and determine the slave gateway with the smallest comprehensive score as the second storage gateway; store the third resource to the second storage gateway.
5. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 3 when executed by a processor.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 3 are implemented.
7. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 3 are implemented.
Citation Information
Patent Citations
Storage gateway resource allocation method based on streaming storage
CN112383628A
Data processing method and device, computer equipment and computer readable storage medium
CN115729693A