Resource sharing method, server and resource sharing system
Patent Information
- Application Number
- CN202510546922.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-28
- Publication Date
- 2026-10-30
AI Technical Summary
[0047]本申请实施方式的有益效果是:区别于现有技术的情况,本申请实施方式提供一种资源共享方法,该方法通过获取每一个电子设备发送的性能参数;根据性能参数,构建设备关系网,其中,设备关系网包括多个电子设备之间的连接关系;在向第一电子设备下发资源时,通过设备关系网广播资源对应的信息,以确定资源是否存在于设备关系网中的第二电子设备;若资源存在于设备关系网中的第二电子设备,则基于第二电子设备,向第一电子设备传输资源。
Smart Images

Figure CN123020566A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this application relate to the field of communication technology, and in particular to a resource sharing method, server, and resource sharing system. Background Technology
[0002] In the field of computer networks, servers and clients often need to transfer large amounts of resources, such as application packages, script push, application push, wallpaper push, and so on.
[0003] In existing technologies, resources are typically distributed from the server to the client. Since the server is the provider of the resource, when multiple clients send requests for the same resource to the server, the server needs to distribute the same resource to different clients multiple times. When the network is unstable, transmission interruptions may occur, leading to duplicate distributions and increasing the server's transmission load. Summary of the Invention
[0004] To address the aforementioned technical problems, embodiments of this application provide a resource sharing method, server, and resource sharing system, which can share download tasks through electronic devices, reduce the transmission pressure on the server, and improve the speed of resource acquisition.
[0005] To address the aforementioned technical problems, the embodiments of this application provide the following technical solutions:
[0006] In a first aspect, embodiments of this application provide a resource sharing method applied to a server, wherein the server is communicatively connected to multiple electronic devices, and the method includes:
[0007] Obtain the performance parameters sent by each electronic device;
[0008] Based on performance parameters, a device relationship network is constructed, which includes the connection relationships between multiple electronic devices;
[0009] When issuing resources to the first electronic device, the information corresponding to the resources is broadcast through the device relationship network to determine whether the resources exist in the second electronic device in the device relationship network.
[0010] If the resource exists in a second electronic device in the device network, then the resource is transmitted to the first electronic device based on the second electronic device.
[0011] In some embodiments, prior to constructing the device relationship network, the method includes:
[0012] Share the performance parameters of other electronic devices with each electronic device;
[0013] Based on the hole punching service, the device list sent by each electronic device is obtained, and the device list is used to determine the connection relationship between each electronic device and other electronic devices.
[0014] In some embodiments, constructing a device relationship network based on performance parameters includes:
[0015] Based on performance parameters, each electronic device is identified as an intermediate node or an edge node;
[0016] Based on the device list, multiple intermediate and edge nodes are connected to obtain a device relationship network.
[0017] In some embodiments, each electronic device is identified as an intermediate node or an edge node based on performance parameters, including:
[0018] Electronic devices whose performance parameters meet the parameter conditions are identified as intermediate nodes;
[0019] Electronic devices whose performance parameters do not meet the parameter conditions are identified as edge nodes.
[0020] In some embodiments, the method further includes, prior to constructing the device relationship network:
[0021] Obtain the spatial information of each electronic device, including its network address;
[0022] Based on network addresses, multiple regions are divided, and each region includes multiple electronic devices. The network address includes a network prefix, and electronic devices in the same region have the same network prefix.
[0023] Building a network of device relationships includes:
[0024] The performance parameters of electronic devices in the same region are obtained to construct multiple sub-relationship networks, where each region corresponds to one sub-relationship network, and each sub-relationship network includes the connection relationships between multiple electronic devices;
[0025] An electronic device in one sub-relationship network is connected to an electronic device in another sub-relationship network to obtain a device relationship network, wherein the device relationship network includes multiple sub-relationship networks.
[0026] In some embodiments, the performance parameters include at least one of processor utilization, memory utilization, graphics processor utilization, and network interface card bandwidth.
[0027] The parameter conditions include processor utilization being less than a first utilization threshold, and / or graphics processor utilization being less than a second utilization threshold, and / or memory utilization being less than a utilization threshold, and / or network card bandwidth utilization being less than a utilization threshold.
[0028] In some embodiments, when distributing resources to an electronic device, the method further includes:
[0029] Real-time acquisition of performance parameters for each electronic device in the device relationship network;
[0030] If the performance parameters of a certain current electronic device do not meet the parameter conditions, then disconnect one of the electronic devices connected to the current electronic device and connect the disconnected electronic device to another electronic device, wherein the performance parameters of the other electronic device meet the parameter conditions.
[0031] In some embodiments, when the resource exists in at least two second electronic devices, the method further includes:
[0032] Obtain performance parameters for at least two second electronic devices;
[0033] Based on the performance parameters of the second electronic device, a download device is determined, wherein the download device is one of at least two second electronic devices;
[0034] Resources are obtained from the download device and transmitted to the first electronic device.
[0035] In some embodiments, the method further includes:
[0036] If the resource does not exist in the second electronic device in the device relationship network, then obtain the resource requested by the first electronic device from the server;
[0037] After the resources requested by the first electronic device are distributed to the first electronic device, the method further includes:
[0038] Based on the resource requested by the first electronic device, a seed file is generated, wherein the seed file includes the content of the resource, the size of the resource, and the electronic device where the resource is located;
[0039] Share the seed file to the device network.
[0040] Secondly, embodiments of this application provide a server, including:
[0041] At least one processor; and,
[0042] A memory that is communicatively connected to at least one processor; wherein,
[0043] The memory stores instructions that can be executed by at least one processor, such that the instructions are executed by at least one processor to enable the at least one processor to perform the method as described in the first aspect.
[0044] Thirdly, embodiments of this application provide a resource sharing system, including:
[0045] Such as the server in the second aspect;
[0046] Multiple electronic devices are connected to the server.
[0047] The beneficial effects of the embodiments of this application are as follows: Unlike the prior art, the embodiments of this application provide a resource sharing method. This method obtains the performance parameters sent by each electronic device; constructs a device relationship network based on the performance parameters, wherein the device relationship network includes the connection relationships between multiple electronic devices; when sending resources to a first electronic device, broadcasts the information corresponding to the resources through the device relationship network to determine whether the resources exist in a second electronic device in the device relationship network; if the resources exist in a second electronic device in the device relationship network, then the resources are transmitted to the first electronic device based on the second electronic device.
[0048] By acquiring the performance parameters sent by electronic devices, a device relationship network is constructed. When resources are distributed to the first electronic device, the information corresponding to the resources is broadcast through the device relationship network to determine whether the resources exist in the second electronic device in the device relationship network. If the resources exist in the second electronic device in the device relationship network, the resources are transmitted to the first electronic device based on the second electronic device. This can share the download task through electronic devices, reduce the transmission pressure on the server, and improve the speed of resource acquisition. Attached Figure Description
[0049] One or more embodiments are illustrated by way of example with reference to the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements having the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.
[0050] Figure 1 This is a schematic diagram of an application environment provided in an embodiment of this application;
[0051] Figure 2 This is a flowchart illustrating a resource sharing method provided in an embodiment of this application;
[0052] Figure 3 This is a schematic diagram of a process for obtaining a device list provided in an embodiment of this application;
[0053] Figure 4 This is a schematic diagram illustrating the connection relationship between different electronic devices provided in an embodiment of this application;
[0054] Figure 5 yes Figure 2 A detailed flowchart of step S202 in the process;
[0055] Figure 6 yes Figure 5 A detailed flowchart of step S2201 in the process;
[0056] Figure 7 This is a schematic diagram illustrating an example of a device relationship network provided in an embodiment of this application;
[0057] Figure 8 This is a schematic diagram of a process for dividing regions based on network addresses, provided in an embodiment of this application.
[0058] Figure 9 yes Figure 2 A detailed flowchart of step S202 in the process;
[0059] Figure 10 This is a schematic diagram illustrating another example of a device relationship network provided in an embodiment of this application;
[0060] Figure 11 This is a schematic diagram of a process for obtaining resources provided in an embodiment of this application;
[0061] Figure 12 This is a schematic diagram of a process for broadcasting resources provided in an embodiment of this application;
[0062] Figure 13 This is a schematic diagram of a process for updating a device relationship network provided in an embodiment of this application;
[0063] Figure 14 This is a schematic diagram illustrating an example of updating a device relationship network according to an embodiment of this application;
[0064] Figure 15 This is a timing diagram of a resource sharing method provided in an embodiment of this application;
[0065] Figure 16 This is a schematic diagram of the structure of a resource sharing system provided in an embodiment of this application;
[0066] Figure 17 This is a schematic diagram of the structure of a resource sharing device provided in an embodiment of this application;
[0067] Figure 18 This is a schematic diagram of the structure of a server provided in an embodiment of this application.
[0068] Explanation of icon numbers:
[0069] label name label name 1000 Application Environment 1700 Resource sharing device 100 server 1701 Acquisition Unit 101 processor 1702 Building blocks 102 memory 1703 Resource determination unit 200 electronic devices 1704 Transmission unit 1600 Resource sharing system Detailed Implementation
[0070] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this invention, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0071] It should be noted that, unless there is a conflict, the various features in the embodiments of this application can be combined with each other, all of which are within the protection scope of this application. In addition, the terms "first" and "second" used in this application do not limit the data, but only distinguish the same or similar items with basically the same function and effect.
[0072] Before introducing the embodiments of this application, a brief introduction will be given to the resource sharing methods known to the inventors of this application, so as to facilitate the understanding of the embodiments of this application later.
[0073] When sharing resources, the server typically distributes the resources to the device. However, this method has the following drawbacks:
[0074] (1) Since the resources are all downloaded from the server, when different devices request the same resource, the server needs to repeatedly send the same resource to different clients. Since the bandwidth of the computer network is limited, transmitting a large amount of resources at the same time results in high traffic costs.
[0075] (2) In complex network environments with multiple nodes (such as device terminals), there are performance differences between different device terminals. When multiple resources are distributed at the same time, data loss is likely to occur, the failure rate of distribution will increase, and multiple re-distribution is required, which will lead to the instability of the system function.
[0076] (3) When transmitting large file types of resources, such as videos, in complex network environments, it is impossible to perform online playback, online parsing and other operations, which limits the functionality of the system.
[0077] In summary, having the server distribute resources to the device can easily lead to high traffic costs, system instability, or limited system functionality.
[0078] To address the aforementioned issues, this application provides a resource sharing method. This method constructs a device relationship network by acquiring performance parameters sent by electronic devices. When resources are distributed to a first electronic device, the information corresponding to the resource is broadcast through the device relationship network to determine if the resource exists in a second electronic device within the network. If the resource exists in a second electronic device within the network, the resource is transmitted to the first electronic device based on the second electronic device. This method can share the download task among electronic devices, reducing the transmission pressure on the server and improving the speed of resource acquisition.
[0079] The technical solution of this application will be described in detail below with reference to the accompanying drawings:
[0080] Please see Figure 1 , Figure 1 This is a schematic diagram of an application environment provided in an embodiment of this application.
[0081] like Figure 1As shown, the application environment 1000 includes: a server 100 and multiple electronic devices 200. The server 100 is connected to the electronic devices 200 via a wired network or a wireless network. The wireless network includes 2G, 3G, 4G, 5G, wireless LAN, Bluetooth and other wireless networks. The wired network includes serial cables, network cables and other wired networks.
[0082] Server 100 is used to store performance information of resources and electronic devices 200. Server 100 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0083] Electronic device 200 is used to request resources from a server or from other electronic devices. Electronic device 200 includes, but is not limited to, network-enabled devices or apparatuses such as tablet computers and computer terminals.
[0084] In this embodiment, server 100 obtains performance information of multiple electronic devices 200 and generates a device relationship network based on the performance information of the electronic devices 200. The device relationship network includes the connection relationships between the multiple electronic devices 200. When an electronic device 200 needs to download resources, it broadcasts a resource message to the device relationship network to determine whether the resource corresponding to the download request exists in the device relationship network. If the resource exists on an electronic device in the device relationship network, the resource is obtained based on the device relationship network. If the resource does not exist on an electronic device in the device relationship network, a resource download request is sent to the server to obtain the resource from the server.
[0085] Please see Figure 2 , Figure 2 This is a flowchart illustrating a resource sharing method provided in an embodiment of this application.
[0086] This resource sharing method is applied to a server; specifically, the execution subject of this resource sharing method is one or at least two processors of the server.
[0087] The server communicates with multiple electronic devices.
[0088] like Figure 2 As shown, the resource sharing method includes:
[0089] Step S201: Obtain the performance parameters sent by each electronic device.
[0090] Specifically, electronic devices actively report performance parameters to obtain the performance parameters sent by each electronic device. These performance parameters include at least one of the following: processor utilization, memory usage, graphics processor utilization, and network card bandwidth.
[0091] In the embodiments of this application, performance parameters are indicators used to measure the performance, functions, and efficiency of electronic devices. For example, the lower the memory usage of an electronic device, the faster the electronic device processes resources.
[0092] In this embodiment of the application, by obtaining the performance parameters of each electronic device, the connection relationship between an electronic device and other electronic devices is determined based on the performance parameters of the electronic devices, so as to construct a device relationship network.
[0093] In this embodiment of the application, before constructing the device relationship network, other electronic devices that each electronic device can connect to are pre-determined to avoid invalid connections and improve the construction speed of the device relationship network.
[0094] Please see Figure 3 , Figure 3 This is a schematic diagram of a process for obtaining a device list provided in an embodiment of this application.
[0095] like Figure 3 As shown, the process for obtaining the device list includes:
[0096] Step S301: Share the performance parameters of other electronic devices with each electronic device.
[0097] In this embodiment of the application, the efficiency of system resource scheduling is improved by sharing the performance parameters of other electronic devices with each electronic device.
[0098] Step S302: Based on the hole punching service, obtain the device list sent by each electronic device.
[0099] In this application embodiment, different electronic devices may use different communication protocols. If the protocols do not match, the electronic devices cannot communicate with each other. Therefore, before establishing the connection between electronic devices, it is necessary to confirm which electronic devices can communicate directly, which electronic devices cannot communicate directly, and which electronic devices can establish a communication connection through the hole punching service.
[0100] In this application embodiment, hole punching service is a network technology used for network address translation or to establish a direct communication channel between devices behind a firewall. Hole punching service includes, but is not limited to, STUN service (SessionTraversal Utilities for NAT).
[0101] The STUN service is used to discover the public IP address and port of electronic devices in order to determine the network location of the electronic devices.
[0102] Specifically, based on the performance parameters of electronic devices, the system uses a hole punching service to determine which electronic devices each electronic device can directly communicate with, which electronic devices each electronic device can connect to after hole punching, and which electronic devices cannot connect. This process generates a connection relationship between each electronic device and other devices, resulting in a device list for each electronic device. The device list for each electronic device is then sent to a server, where the device list includes the connection relationship between each electronic device and other devices.
[0103] For example, please see Figure 4 , Figure 4 This is a schematic diagram illustrating the connection relationship between different electronic devices provided in an embodiment of this application, such as... Figure 4 As shown, there are four electronic devices, namely electronic devices A, B, C, and D. After the server shares the performance parameters of the other electronic devices with each of them, it uses the hole-punching service to detect that electronic devices A and B can communicate directly, electronic devices B and C can communicate directly, electronic devices C and D cannot communicate directly, but electronic devices C and D can establish a connection through the hole-punching service, electronic devices A and C cannot communicate directly, but electronic devices A and C can establish a connection through the hole-punching service, electronic devices A and D cannot establish a connection, and electronic devices B and D cannot establish a connection.
[0104] In this embodiment of the application, a device list corresponding to each electronic device is obtained based on the hole punching service in order to determine the connection relationship between each electronic device and other electronic devices.
[0105] Step S202: Construct a device relationship network based on performance parameters.
[0106] Specifically, based on performance parameters, a device relationship network is constructed, which includes the connection relationships between multiple electronic devices.
[0107] Please see Figure 5 , Figure 5 yes Figure 2 A detailed flowchart of step S202 in the process.
[0108] like Figure 5 As shown, step S202 includes:
[0109] Step S2201: Based on performance parameters, determine each electronic device as an intermediate node or an edge node.
[0110] In this embodiment, based on the performance parameters of each electronic device, it is determined whether the performance parameters of each electronic device meet the parameter conditions, so as to identify each electronic device as an intermediate node or an edge node. For details, please refer to [link to relevant documentation]. Figure 6 .
[0111] Please see Figure 6 , Figure 6 yes Figure 5 A detailed flowchart of step S2201 is shown.
[0112] like Figure 5 As shown, step S2201 includes:
[0113] Step S2211: Determine whether the performance parameters of the electronic device meet the parameter conditions.
[0114] In the embodiments of this application, the performance parameters of the electronic device include at least one of the following: processor utilization, memory occupancy, graphics processor utilization, and network card bandwidth. The parameter conditions include processor utilization being less than a first utilization threshold, and / or graphics processor utilization being less than a second utilization threshold, and / or memory occupancy being less than an occupancy threshold, and / or network card bandwidth utilization being less than a utilization threshold.
[0115] Specifically, determine whether the performance parameters of the electronic device meet the parameter conditions. If the performance parameters of the electronic device meet the parameter conditions, proceed to step S2212; if the performance parameters of the electronic device do not meet the parameter conditions, proceed to step S2213.
[0116] Step S2212: Identify electronic devices whose performance parameters meet the parameter conditions as intermediate nodes.
[0117] Specifically, when the performance parameters of an electronic device meet the parameter conditions, the electronic device whose performance parameters meet the parameter conditions is determined as an intermediate node.
[0118] Step S2213: Identify electronic devices whose performance parameters do not meet the parameter conditions as edge nodes.
[0119] Specifically, when the performance parameters of an electronic device do not meet the parameter conditions, the electronic device whose performance parameters do not meet the parameter conditions is identified as an edge node.
[0120] In this embodiment of the application, the optimal performance of the electronic device is when the processor utilization is less than a first utilization threshold, the graphics processor utilization is less than a second utilization threshold, the memory occupancy is less than an occupancy threshold, and the network card bandwidth utilization is less than an occupancy threshold.
[0121] In the embodiments of this application, the performance parameters of the electronic device do not meet the parameter conditions, namely, the parameter conditions include the processor utilization rate being greater than or equal to a first utilization rate threshold, and / or the graphics processor utilization rate being greater than or equal to a second utilization rate threshold, and / or the memory occupancy rate being greater than or equal to an occupancy rate threshold, and / or the network card bandwidth utilization rate being greater than or equal to an occupancy rate threshold.
[0122] It can be understood that the first utilization rate threshold, the second utilization rate threshold, the occupancy rate threshold, and the usage rate threshold are set according to the specific circumstances.
[0123] Step S2202: Based on the device list, connect multiple intermediate nodes and edge nodes to obtain a device relationship network.
[0124] The device list includes the connection relationships between each electronic device and other devices.
[0125] Specifically, based on the connection relationship between each electronic device and other devices, multiple intermediate nodes and edge nodes are connected to obtain a device relationship network.
[0126] For example, please see Figure 7 , Figure 7 This is an example schematic diagram of a device relationship network provided in an embodiment of this application, such as... Figure 7 As shown, if electronic devices B and C are determined to have better performance, they are designated as intermediate nodes. If electronic devices A, D, and E are determined to have worse performance than other electronic devices, they are designated as edge nodes. Based on the device list corresponding to each electronic device, it is determined that electronic device A can only connect to electronic device B, electronic device B can connect to electronic devices A, C, and E, and electronic device C can connect to electronic devices B and D. Based on the device list, multiple electronic devices are connected to obtain a device relationship network.
[0127] In this embodiment of the application, each electronic device corresponds to a device list, which includes electronic devices that the electronic device can connect to and electronic devices that cannot connect to. After determining the central node and the edge node, the device list corresponding to the central node and the device list corresponding to the edge node are obtained. Based on the electronic devices that can connect to the device list, the central node and the edge node are connected to obtain the device relationship network.
[0128] In this embodiment of the application, electronic devices in the device relationship network are connected through a peer-to-peer (P2P) network. P2P is a network model in which each electronic device has equal capabilities and responsibilities, such as acting as both a receiver and a sender. Each electronic device in the P2P network can communicate and exchange data directly without going through a server for relay.
[0129] In this embodiment, a device relationship network can also be constructed based on network addresses. For example, multiple regions can be divided based on network addresses, and multiple sub-relationship networks can be constructed based on the electronic devices corresponding to each region. By connecting these sub-relationship networks, a device relationship network can be obtained. For details, please refer to [link to relevant documentation]. Figure 8 .
[0130] Please see Figure 8 , Figure 8 This is a schematic diagram of a process for dividing regions based on network addresses, provided in an embodiment of this application.
[0131] like Figure 8 As shown, the steps for dividing regions based on network addresses include:
[0132] Step S801: Obtain spatial information for each electronic device.
[0133] In this embodiment of the application, the spatial information of the electronic device includes a network address, which includes an IP address. The IP address includes a network prefix and a host portion. The network prefix is used to identify a network or subnet, and the host portion is used to identify a specific electronic device in the network. All devices in the same subnet have the same network prefix, and the host portion of each electronic device is unique.
[0134] Step S802: Divide the network into multiple regions based on the network address.
[0135] Specifically, network addresses in spatial information are used to divide regions. Electronic devices with the same network prefix are grouped into one region to obtain multiple regions. Each region includes multiple electronic devices, and the network prefixes of electronic devices in the same region are the same. For example, a building includes multiple rooms, and each room is a region. Each room includes multiple electronic devices, and the network prefixes of the IP addresses of electronic devices in different rooms are different.
[0136] In this embodiment of the application, the spatial information also includes geographical location. Based on the geographical location, multiple regions are divided, and each region includes multiple electronic devices. For example, Guangzhou is one region and Shenzhen is another region. The network addresses of the electronic devices are then obtained for more detailed division.
[0137] Please see Figure 9, Figure 9 yes Figure 2 A detailed flowchart of step S202 in the process.
[0138] like Figure 9 As shown, step S202 includes:
[0139] Step S2203: Obtain the performance parameters of electronic devices in the same area to construct multiple sub-relationship networks.
[0140] Specifically, the performance parameters of each electronic device in the same region are obtained. Based on the hole punching service, the device list sent by each electronic device in the same region is obtained. Based on the performance parameters of each electronic device in the same region, each electronic device in the same region is determined as an intermediate node or edge node in that region. Based on the device list corresponding to the electronic device, the electronic devices in each region are connected to obtain multiple sub-relationship networks. Each region corresponds to one sub-relationship network, and each sub-relationship network includes the connection relationships between multiple electronic devices.
[0141] For specific steps on determining intermediate or edge nodes, please refer to [link to relevant documentation]. Figure 6 .
[0142] Step S2204: Connect an electronic device in one sub-relationship network to an electronic device in another sub-relationship network to obtain a device relationship network.
[0143] Specifically, a device network is obtained by connecting an electronic device in one sub-network to an electronic device in another sub-network through a hole punching service. This device network includes multiple sub-networks.
[0144] For example, please see Figure 10 , Figure 10 This is a schematic diagram illustrating another example of a device relationship network provided in an embodiment of this application, such as... Figure 10 As shown, multiple regions are divided based on network addresses, such as region 1, region 2, ... region X. Each region includes multiple electronic devices, such as region 1 including electronic device 1 ... electronic device X. The multiple electronic devices in each region are connected to form a sub-relationship network, where X is greater than or equal to 2.
[0145] Step S203: When issuing resources to the first electronic device, broadcast the information corresponding to the resources through the device relationship network.
[0146] The first electronic device is an electronic device in the device relationship network.
[0147] Specifically, after the device relationship network is constructed, the first electronic device sends a resource acquisition request. When resources are distributed to the first electronic device, the information corresponding to the resource is broadcast through the device relationship network, that is, the information corresponding to the resource is sent to each electronic device in the device relationship network to confirm whether other devices in the device relationship network have the resource requested by the first electronic device.
[0148] Step S204: Determine whether the resource exists in the second electronic device in the device relationship network.
[0149] The second electronic device is an electronic device in the device relationship network.
[0150] Specifically, determine whether the resource exists in the second electronic device in the device relationship network. If the resource exists in the second electronic device in the device relationship network, proceed to step S205; if the resource does not exist in the second electronic device in the device relationship network, proceed to step S206.
[0151] Step S205: Based on the second electronic device, transmit resources to the first electronic device.
[0152] Specifically, if the resource exists in the second electronic device in the device relationship network, the resource requested by the first electronic device is obtained from the second electronic device and the resource is transmitted to the first electronic device.
[0153] In this embodiment, when at least two second electronic devices possess the resource requested by the first electronic device, one of the at least two second electronic devices is selected as the download device. For details, please refer to [link to relevant documentation]. Figure 11 .
[0154] Please see Figure 11 , Figure 11 This is a schematic diagram of a process for obtaining resources provided in an embodiment of this application.
[0155] like Figure 11 As shown, the acquisition of resources includes:
[0156] Step S1101: Obtain performance parameters of at least two second electronic devices.
[0157] Step S1102: Determine the download device based on the performance parameters of the second electronic device.
[0158] Specifically, based on the performance parameters of the second electronic device, the electronic device with the best performance among at least two second electronic devices is determined, and the electronic device with the best performance is determined as the download device, wherein the download device is one of the at least two second electronic devices.
[0159] The performance parameters include at least one of the following: processor utilization, memory usage, graphics processor utilization, and network card bandwidth.
[0160] Specifically, the electronic device with the best performance is the second electronic device whose processor utilization is less than a first utilization threshold, graphics processor utilization is less than a second utilization threshold, memory usage is less than a usage threshold, and network card bandwidth usage is less than a usage threshold.
[0161] Step S1103: Obtain resources from the download device to the first electronic device.
[0162] Specifically, resources are obtained from the download device and transmitted to the first electronic device.
[0163] In this embodiment of the application, resources are preferentially obtained from the device relationship network, which can reduce the transmission pressure on the server. When resources exist in the device relationship network, they only need to be transmitted between electronic devices without going through the server, thus decentralizing the server and improving the speed of resource acquisition.
[0164] Step S206: Obtain the resource requested by the first electronic device from the server.
[0165] Specifically, if the resource does not exist in the second electronic device in the device relationship network, the resource requested by the first electronic device is obtained from the server.
[0166] In this embodiment of the application, after the first electronic device obtains the resources issued by the server, it needs to broadcast its resource information to the device relationship network to notify other electronic devices in the device relationship network that the resource exists in the first electronic device. When other electronic devices need the resource, they send a resource download request to the first electronic device through the device relationship network to obtain the resource from the other electronic devices.
[0167] Please see Figure 12 , Figure 12 This is a schematic diagram of a process for broadcasting resources provided in an embodiment of this application.
[0168] like Figure 12 As shown, this resource broadcast includes:
[0169] Step S1201: Generate a seed file based on the resources requested by the first electronic device.
[0170] Specifically, based on the resource requested by the first electronic device, a seed file corresponding to the resource requested by the first electronic device is generated using seed technology. The seed file includes the content of the resource, the size of the resource, and the electronic device where the resource is located.
[0171] Step S1202: Share the seed file to the device relationship network.
[0172] Specifically, the seed file is shared to the device network, that is, the seed file is sent to each electronic device in the device network to notify other electronic devices of the resources stored in the first electronic device. When other electronic devices need to download the resources stored in the first electronic device, they send a resource download request to the first electronic device through the seed file.
[0173] In this embodiment of the application, the availability of resources can be improved by distributing and storing resources in electronic devices instead of centrally storing them in servers.
[0174] In this embodiment, when resources exist in the device relationship network, and during the resource distribution process, if one of the electronic devices experiences insufficient performance, the device relationship network needs to be updated. For details, please refer to [link to relevant documentation]. Figure 13 .
[0175] Please see Figure 13 , Figure 13 This is a schematic diagram of a process for updating a device relationship network provided in an embodiment of this application.
[0176] like Figure 13 As shown, the updated device relationship network includes:
[0177] Step S1301: Obtain the performance parameters of each electronic device in the device relationship network in real time.
[0178] Specifically, when resources exist in the device relationship network, the performance parameters of each electronic device in the device relationship network are obtained in real time during the resource distribution process.
[0179] The performance parameters include at least one of the following: processor utilization, memory usage, graphics processor utilization, and network card bandwidth.
[0180] Step S1302: Determine whether the performance parameters of a certain electronic device meet the parameter conditions.
[0181] The parameter conditions include processor utilization being less than a first utilization threshold, and / or graphics processor utilization being less than a second utilization threshold, and / or memory utilization being less than a utilization threshold, and / or network card bandwidth utilization being less than a utilization threshold.
[0182] Specifically, it is determined whether the performance parameters of a certain electronic device meet the parameter conditions. If the performance parameters of a certain electronic device do not meet the parameter conditions, the process jumps to step S1303. If the performance parameters of all electronic devices meet the parameter conditions, the process jumps to step S1304.
[0183] Step S1303: Disconnect one of the electronic devices currently connected to the electronic device and connect the disconnected electronic device to another electronic device.
[0184] Specifically, when the performance parameters of an electronic device do not meet the parameter conditions, the device is disconnected from one of the electronic devices currently connected to it, and the disconnected electronic device is connected to another electronic device. The performance parameters of the other electronic device meet the parameter conditions, and the performance parameters of the other electronic device still meet the parameter conditions after it is connected to the disconnected electronic device.
[0185] For example, please see Figure 14 , Figure 14 This is an example schematic diagram of an embodiment of the present application providing an update of the device relationship network, such as... Figure 14 As shown, during the resource distribution process, if the performance of electronic device B is insufficient, one of the electronic devices will be disconnected, for example, electronic device E will be disconnected. At this time, electronic device E is not connected to any electronic device, so the electronic device with the better performance among electronic devices A, C, and D will be selected as the connected electronic device, for example, electronic device D will be selected to connect to electronic device E.
[0186] Step S1304: Continue to transmit resources based on the connection relationships of electronic devices in the current device relationship network.
[0187] Specifically, when the performance parameters of all electronic devices meet the parameter conditions, resources will continue to be transmitted based on the connection relationships of electronic devices in the current device relationship network.
[0188] In this embodiment of the application, by updating the device relationship network in real time, the failure to acquire resources due to insufficient performance of electronic devices can be avoided, and the connection relationship of electronic devices in the device relationship network can be dynamically adjusted to improve the speed of resource acquisition.
[0189] Please see Figure 15 , Figure 15 This is a timing diagram of a resource sharing method provided in an embodiment of this application.
[0190] like Figure 15 As shown, the timing of this resource sharing method includes:
[0191] Step S1501: Broadcast resources.
[0192] Specifically, after the server obtains a new resource, it broadcasts the resource to the device relationship network to determine whether the electronic devices in the device relationship network have the resource.
[0193] Step S1502: Query the existence status of the resource.
[0194] Specifically, the system queries each electronic device in the device relationship network to determine whether the resource exists, thereby identifying the electronic devices that possess the resource.
[0195] Step S1503: Return the hash verification value.
[0196] Specifically, when it is determined that an electronic device in the device relationship network has resources, a hash check value is returned to confirm the integrity of the resources. The hash check value includes an Md5 check value.
[0197] Step S1504: Send the seed file generation command.
[0198] Specifically, when it is determined that an electronic device in the device relationship network has resources, a seed file generation instruction is sent to instruct the electronic device with the resources to generate a seed file based on the resources.
[0199] Step S1505: Broadcast the seed file.
[0200] Specifically, after an electronic device with resources generates a seed file corresponding to the resources, it broadcasts the seed file to the device network. When other devices need the resources, they download the resources from the electronic device with the resources based on the seed file.
[0201] In this embodiment of the application, when the resource does not exist in the electronic device in the device relationship network, a 404 status is returned to determine that the resource does not exist in the device relationship network.
[0202] Step S1506: Negotiate the allocation of download tasks.
[0203] Specifically, when a resource does not exist in the device network, the download task is assigned to an electronic device in the device network.
[0204] Step S1507: Request to download resources.
[0205] Specifically, when a resource does not exist in the device network, the electronic device requests the resource from the server.
[0206] Step S1508: Return resources.
[0207] Specifically, the server sends the requested resource to the electronic device corresponding to the download request.
[0208] Step S1509: Broadcast download progress.
[0209] Specifically, during the download process, electronic devices broadcast the current download progress of the resources to other electronic devices in the device network in real time.
[0210] Step S1510: Submit the complete verification code.
[0211] Specifically, once the resource has been downloaded, a complete verification code is submitted to the server to confirm the integrity and accuracy of the resource.
[0212] Step S1511: Broadcast the seed file.
[0213] Specifically, after an electronic device downloads a resource, it generates a seed file based on that resource and broadcasts the seed file to all electronic devices in the device network.
[0214] Step S1512: Initiate resource transfer.
[0215] Specifically, when other devices send resource download requests, if the device relationship network confirms that the resource corresponding to the resource download request exists, then the resource is obtained from the electronic device that has the resource in the device relationship network.
[0216] In this embodiment of the application, resource distribution is implemented in the device relationship network, avoiding centralized storage of resources in the server, thereby enabling fast and efficient distribution of resources and reducing the transmission pressure on the server.
[0217] Please see Figure 16 , Figure 16 This is a schematic diagram of the structure of a resource sharing system provided in an embodiment of this application.
[0218] like Figure 16 As shown, the resource sharing system 1600 includes: a server 100 and multiple electronic devices 200.
[0219] Server 100 is communicatively connected to multiple electronic devices 200. Server 100 is used to store resources and performance information of each electronic device 200. Based on the performance information of each electronic device 200, a device relationship network is constructed, wherein the device relationship network includes the connection relationships between the multiple electronic devices 200.
[0220] Electronic device 200 is communicatively connected to server 100. Electronic device 200 is used to obtain resources from server 100 or from other electronic devices in the device relationship network. After obtaining resources, electronic device 200 broadcasts the seed file corresponding to the resources to other electronic devices in the device relationship network.
[0221] Please see Figure 17 , Figure 17 This is a schematic diagram of the structure of a resource sharing device provided in an embodiment of this application.
[0222] like Figure 17 As shown, the resource sharing device 1700 includes:
[0223] The acquisition unit 1701 is used to acquire the performance parameters sent by each electronic device.
[0224] The construction unit 1702 is used to construct a device relationship network based on performance parameters, wherein the device relationship network includes the connection relationships between multiple electronic devices.
[0225] The resource determination unit 1703 is used to broadcast information corresponding to the resource through the device relationship network when the resource is issued to the first electronic device, so as to determine whether the resource exists in the second electronic device in the device relationship network.
[0226] The transmission unit 1704 is used to transmit resources to the first electronic device based on the second electronic device if the resources exist in the device network.
[0227] In this embodiment, the resource sharing device can be a software module, which includes several instructions stored in a memory. The processor can access the memory and execute the instructions to complete the resource sharing methods of the above embodiments.
[0228] In the embodiments of this application, the resource sharing device can also be constructed from hardware devices. For example, the resource sharing device can be constructed from one or more chips, and the chips can work together to complete the resource sharing method described in the above embodiments. Furthermore, the resource sharing device can also be constructed from various logic devices, such as general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), microcontrollers, ARM (Acorn RISC Machine) or other programmable logic devices, discrete gate or transistor logic, discrete hardware components, or any combination of these components.
[0229] The resource sharing device in this application embodiment can be a device, or a component, integrated circuit, or chip in a terminal. The system can be a mobile electronic device or a non-mobile electronic device. For example, mobile electronic devices can be mobile phones, tablets, laptops, PDAs, in-vehicle electronic devices, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc., while non-mobile electronic devices can be servers, network attached storage (NAS), personal computers (PCs), televisions (TVs), ATMs, or self-service machines, etc. This application embodiment does not impose specific limitations.
[0230] The resource sharing device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.
[0231] The resource sharing device provided in this application embodiment can achieve... Figure 2 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.
[0232] It should be noted that the above-described apparatus can execute the resource sharing method provided in the embodiments of this application, and has the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in the apparatus embodiments can be found in the resource sharing method provided in the embodiments of this application.
[0233] In this embodiment of the application, the various units of the resource sharing device cooperate with each other, enabling electronic devices to share the download task, reducing the transmission pressure on the server, and improving the speed of resource acquisition.
[0234] Please see Figure 18 , Figure 18 This is a schematic diagram of the structure of a server provided in an embodiment of this application.
[0235] like Figure 18 As shown, the server 100 includes one or more processors 101 and a memory 102. Wherein, Figure 18 Take a processor 101 as an example.
[0236] Processor 101 and memory 102 can be connected via a bus or other means. Figure 18 Taking the example of a connection between China and Israel via a bus.
[0237] A processor is configured to execute the resource sharing method in any embodiment of this application, comprising: acquiring performance parameters sent by each electronic device; constructing a device relationship network based on the performance parameters, wherein the device relationship network includes connection relationships between multiple electronic devices; when distributing resources to a first electronic device, broadcasting information corresponding to the resources through the device relationship network to determine whether the resources exist in a second electronic device in the device relationship network; if the resources exist in a second electronic device in the device relationship network, then transmitting the resources to the first electronic device based on the second electronic device.
[0238] By acquiring the performance parameters sent by electronic devices, a device relationship network is constructed. When resources are distributed to the first electronic device, the information corresponding to the resources is broadcast through the device relationship network to determine whether the resources exist in the second electronic device in the device relationship network. If the resources exist in the second electronic device in the device relationship network, the resources are transmitted to the first electronic device based on the second electronic device. This can share the download task through electronic devices, reduce the transmission pressure on the server, and improve the speed of resource acquisition.
[0239] The memory 102, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the program instructions / modules corresponding to the resource sharing method in the embodiments of the present invention. The processor 101 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions, and modules stored in the memory 102, thereby implementing the resource sharing method of the above-described method embodiments.
[0240] Memory 102 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 102 may optionally include memory remotely located relative to processor 101. Examples of the above-described networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0241] One or more modules are stored in memory 102. When executed by one or more processors 101, they perform the resource sharing method in any of the above method embodiments, for example, the method described above. Figure 2 The steps shown.
[0242] This application also provides a computer program product, which includes one or more lines of program code stored in a non-volatile computer-readable storage medium. The server's processor reads the program code from the non-volatile computer-readable storage medium and executes the program code to complete the steps of the resource sharing method provided in the above embodiments.
[0243] Based on the above description of the embodiments, those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware, or by a program or program code related to hardware. The program can be stored in a non-volatile computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0244] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software plus a general-purpose hardware platform, or of course, using hardware. Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The non-volatile computer-readable storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0245] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and not to limit them; under the concept of this application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations as described above in different aspects of this application, which are not provided in detail for the sake of brevity; although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A resource sharing method, characterized in that, Applied to a server that communicatively connects to multiple electronic devices, the method includes: Obtain the performance parameters sent by each electronic device; Based on the performance parameters, a device relationship network is constructed, wherein the device relationship network includes the connection relationships between multiple electronic devices; When a resource is issued to the first electronic device, the information corresponding to the resource is broadcast through the device relationship network to determine whether the resource exists in the second electronic device in the device relationship network. If the resource exists in a second electronic device in the device network, then the resource is transmitted to the first electronic device based on the second electronic device.
2. The method according to claim 1, characterized in that, Before constructing the device relationship network, the method includes: Share the performance parameters of other electronic devices with each of the aforementioned electronic devices; Based on the hole punching service, a device list sent by each electronic device is obtained, wherein the device list is used to determine the connection relationship between each electronic device and other electronic devices.
3. The method according to claim 2, characterized in that, The step of constructing the device relationship network based on the performance parameters includes: Based on the performance parameters, each electronic device is identified as an intermediate node or an edge node; Based on the device list, multiple intermediate nodes and edge nodes are connected to obtain a device relationship network.
4. The method according to claim 3, characterized in that, The step of determining each electronic device as an intermediate node or an edge node based on the performance parameters includes: Electronic devices whose performance parameters meet the parameter conditions are identified as intermediate nodes; Electronic devices whose performance parameters do not meet the parameter conditions are identified as edge nodes.
5. The method according to claim 4, characterized in that, Before constructing the device relationship network, the method further includes: Obtain spatial information for each electronic device, wherein the spatial information includes a network address; Based on the network address, multiple regions are divided, wherein each region includes multiple electronic devices, and the network address includes a network prefix, and the electronic devices in the same region have the same network prefix; The construction of the device relationship network includes: The performance parameters of electronic devices in the same region are obtained to construct multiple sub-relationship networks, wherein each region corresponds to one sub-relationship network, and each sub-relationship network includes the connection relationships between multiple electronic devices; An electronic device in one of the sub-relationship networks is connected to an electronic device in another sub-relationship network to obtain the device relationship network, wherein the device relationship network includes multiple sub-relationship networks.
6. The method according to claim 4, characterized in that, The performance parameters include at least one of the following: processor utilization, memory usage, graphics processor utilization, and network card bandwidth. The parameter conditions include processor utilization being less than a first utilization threshold, and / or graphics processor utilization being less than a second utilization threshold, and / or memory utilization being less than a utilization threshold, and / or network card bandwidth utilization being less than a utilization threshold.
7. The method according to claim 6, characterized in that, When distributing resources to electronic devices, the method further includes: Real-time acquisition of performance parameters for each electronic device in the device relationship network; If the performance parameters of a current electronic device do not meet the parameter conditions, then disconnect one of the electronic devices connected to the current electronic device and connect the disconnected electronic device to another electronic device, wherein the performance parameters of the other electronic device meet the parameter conditions.
8. The method according to claim 1, characterized in that, When the resource is present in at least two of the second electronic devices, the method further includes: Obtain at least two performance parameters of the second electronic device; Based on the performance parameters of the second electronic device, a download device is determined, wherein the download device is one of at least two second electronic devices; The resources are obtained from the download device and transferred to the first electronic device.
9. The method according to claim 1, characterized in that, The method further includes: If the resource does not exist in the second electronic device in the device relationship network, then the resource requested by the first electronic device is obtained from the server; After the resources requested by the first electronic device are distributed to the first electronic device, the method further includes: Based on the resource requested by the first electronic device, a seed file is generated, wherein the seed file includes the content of the resource, the size of the resource, and the electronic device where the resource is located; Share the seed file to the device network.
10. A server, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method as described in any one of claims 1-9.
11. A resource sharing system, characterized in that, include: The server as described in claim 10; Multiple electronic devices are connected to the server.
