Data distribution method, device, electronic device and storage medium
By building a target distribution tree and merging the data distribution path, the problem of bandwidth consumption and slow response speed in cross-region data transmission is solved, and efficient data distribution and server pressure are achieved.
Patent Information
- Application Number
- CN202210761908.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-29
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2042-06-29
AI Technical Summary
In the prior art, data distribution based on p2p networks leads to problems such as large-scale bandwidth consumption, resource waste and slow service response speed during cross-region transmission.
By building a target distribution tree, determine the terminal node with the largest data cache range as the parent node, reduce cross-region data transmission, reduce server bandwidth pressure, and add terminals with a smaller data cache range than the parent node as child nodes during the distribution tree merging process, optimized Data distribution path.
Effectively reduce cross-region bandwidth consumption, reduce server data distribution pressure, and improve data distribution efficiency and service response speed.
Smart Images

Figure CN115297175B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of Internet technology, and in particular to a data distribution method, device, electronic device and storage medium. Background Art
[0002] With the rapid development of Internet technology, the demand for various Internet-based business services is increasing, and large-scale business data distribution based on the Internet has become a severe challenge facing business services.
[0003] In the related art, data distribution is often performed based on a p2p (Peer to Peer) network, that is, a data distribution network is constructed by using the size of the data cache range between client nodes in the network, so that a client with a small data cache range can directly request data from a client with a large data cache range, thereby reducing the bandwidth pressure on the server. However, in the related art, client nodes in the data distribution network are often distributed in multiple regions. Constructing a data distribution network in combination with the size of the data cache range will generate a large amount of cross-regional traffic, consume a large amount of cross-regional network bandwidth, and result in high data transmission costs and low data transmission efficiency, which in turn brings about problems such as slow business response speed. Summary of the invention
[0004] The present disclosure provides a data distribution method, device, electronic device and storage medium to at least solve the problems of resource waste caused by large-scale cross-regional network bandwidth consumption, low data transmission efficiency, and slow service response speed in related technologies. The technical solution of the present disclosure is as follows:
[0005] According to a first aspect of an embodiment of the present disclosure, there is provided a data distribution method, comprising:
[0006] In response to a data distribution request of a first terminal, a target terminal identifier in a parent node corresponding to the first terminal is determined based on a target distribution tree, the target distribution tree being obtained by merging distribution trees corresponding to a plurality of preset areas; the distribution tree corresponding to the target area is constructed based on a data cache range corresponding to a terminal identifier in a target terminal identifier set, and is a tree with a first terminal identifier in a terminal identifier set of terminals located in the target area as a root node; the target area is any preset area among the plurality of preset areas, the first terminal identifier is a terminal identifier with the largest corresponding data cache range in the terminal identifier set, the target terminal identifier set includes the terminal identifier set, or includes the terminal identifier set and first terminal identifiers corresponding to other areas among the plurality of preset areas except the target area; the first terminal is any terminal among the terminals located in the plurality of preset areas;
[0007] The target terminal identifier is sent to the first terminal, where the target terminal identifier is used to instruct the first terminal to obtain the target service data corresponding to the data distribution request from the target terminal corresponding to the target terminal identifier.
[0008] In an optional embodiment, the method further includes:
[0009] Based on the data cache range corresponding to the terminal identifier in the current terminal identifier set and the data cache range corresponding to the terminal identifier in the preset identifier set, a first distribution tree with the first terminal identifier in the current terminal identifier set as the root node is constructed; the current terminal identifier set is any terminal identifier set in multiple terminal identifier sets that is not added to the first distribution tree; the multiple terminal identifier sets are terminal identifier sets of terminals located in the multiple preset areas; the preset identifier set includes the first terminal identifier with the largest data cache range corresponding to each terminal identifier set;
[0010] Deleting, from the preset identification set, a first terminal identification that has been added to the first distribution tree and does not belong to a root node of the first distribution tree, and re-determining a current terminal identification set from the multiple terminal identification sets;
[0011] Based on the current preset identifier set and the data cache range corresponding to the re-determined current terminal identifier set, construct a second distribution tree with the first terminal identifier in the re-determined current terminal identifier set as the root node;
[0012] Based on a first root node of the first distribution tree and a second root node of the second distribution tree, merging the second distribution tree into the first distribution tree;
[0013] In the case where the terminal identifiers in the plurality of terminal identifier sets are added to the first distribution tree, the first distribution tree is used as the target distribution tree.
[0014] In an optional embodiment, the method further includes:
[0015] If any terminal identification set among the multiple terminal identification sets is not added to the first distribution tree, the process proceeds to the step of deleting the first terminal identification that has been added to the first distribution tree and does not belong to the root node of the first distribution tree from the preset identification set.
[0016] In an optional embodiment, constructing a first distribution tree with the first terminal identifier in the current terminal identifier set as the root node based on the data cache range corresponding to the terminal identifier in the current terminal identifier set and the data cache range corresponding to the terminal identifier in the preset identifier set includes:
[0017] constructing a root node of a third distribution tree based on the first terminal identifier in the current terminal identifier set;
[0018] sequentially acquiring a second terminal identifier from the current terminal identifier set and the preset identifier set, the second terminal identifier being a terminal identifier that is not added to the third distribution tree and has the largest corresponding data cache range in the current terminal identifier set and the preset identifier set;
[0019] In the third distribution tree, searching for a target node whose data cache range satisfies a preset condition, wherein the preset condition is that the node where the terminal identifier is located in the current terminal identifier set, and there is an overlap between the data cache range corresponding to the second terminal identifier and the data cache range upper limit is greater than the data cache range upper limit corresponding to the second terminal identifier;
[0020] When the target node is found, adding the second terminal identifier as a child node of the target node to the third distribution tree;
[0021] When the terminal identifier in the current terminal identifier set and the third terminal identifier in the preset identifier set are added to the third distribution tree, the third distribution tree is used as the first distribution tree, and the third terminal identifier is a terminal identifier whose corresponding data cache range in the preset identifier set is smaller than the data cache range corresponding to the first terminal identifier in the current terminal identifier set.
[0022] In an optional embodiment, the merging the second distribution tree into the first distribution tree based on the first root node of the first distribution tree and the second root node of the second distribution tree includes:
[0023] When the data cache range corresponding to the first root node is larger than the data cache range corresponding to the second root node, searching the first distribution tree for the terminal identifier in the second root node;
[0024] When the terminal identifier in the second root node is found, the second distribution tree is merged into the first distribution tree according to the node where the terminal identifier in the second root node in the first distribution tree is located.
[0025] In an optional embodiment, the merging the second distribution tree into the first distribution tree based on the first root node of the first distribution tree and the second root node of the second distribution tree includes:
[0026] When the data cache range corresponding to the first root node is smaller than the data cache range corresponding to the second root node, searching the second distribution tree for the terminal identifier in the first root node;
[0027] When the terminal identifier in the first root node is found, the second distribution tree is merged into the first distribution tree according to the node where the terminal identifier in the first root node is located in the second distribution tree.
[0028] In an optional embodiment, before constructing a first distribution tree with the first terminal identifier in the current terminal identifier set as a root node based on the data cache range corresponding to the terminal identifier in the current terminal identifier set and the data cache range corresponding to the terminal identifier in the preset identifier set, the method further includes:
[0029] Acquire the plurality of terminal identification sets and data cache ranges corresponding to the terminal identifications in the plurality of terminal identification sets;
[0030] The preset identification set is constructed based on the first terminal identification with the largest data cache range corresponding to each terminal identification set.
[0031] In an optional embodiment, the method further includes:
[0032] According to the lower limit of the data cache range corresponding to the terminal identifier in each terminal identifier set, each terminal identifier set is sorted in descending order to obtain an initial terminal identifier sequence corresponding to each terminal identifier set;
[0033] According to the upper limit of the data cache range corresponding to the terminal identifier in each terminal identifier set, the terminal identifiers in the initial terminal identifier sequence corresponding to each terminal identifier set are sorted in descending order to obtain the terminal identifier sequence corresponding to each terminal identifier set;
[0034] The constructing the preset identification set based on the first terminal identification with the largest data cache range corresponding to each terminal identification set includes:
[0035] The terminal identification that is sorted first in the terminal identification sequence corresponding to each terminal identification set is used as the first terminal identification corresponding to each terminal identification set;
[0036] The preset identification set is constructed based on the first terminal identification corresponding to the multiple terminal identification sets.
[0037] In an optional embodiment, the method further includes:
[0038] When the data cache range of any terminal in the plurality of preset areas is updated, the data cache range information is updated based on the data cache range of the second terminal; the data cache range information includes the data cache range of the terminal in the plurality of preset areas, and the second terminal is the terminal in the plurality of preset areas whose data cache range is updated;
[0039] Based on the updated data cache range information, the target distribution tree is updated.
[0040] In an optional embodiment, the method further includes:
[0041] When receiving the data cache range of the newly added terminal sent by the newly added terminal, updating the data cache range information based on the data cache range of the newly added terminal; the data cache range information includes the data cache ranges of the terminals located in the multiple preset areas;
[0042] Based on the updated data cache range information, the target distribution tree is updated.
[0043] In an optional embodiment, the method further includes:
[0044] When a data cache range of any terminal located in the multiple preset areas is expired, deleting a data cache range of a third terminal in the data cache range information, wherein the data cache range information includes data cache ranges of terminals located in the multiple preset areas, and the third terminal is a terminal whose data cache range has expired;
[0045] Based on the updated data cache range information, the target distribution tree is updated.
[0046] According to a second aspect of an embodiment of the present disclosure, there is provided a data distribution device, including:
[0047] A target terminal identification determination module is configured to execute a data distribution request in response to a first terminal, and determine a target terminal identification in a parent node corresponding to the first terminal based on a target distribution tree, wherein the target distribution tree is obtained by merging distribution trees corresponding to a plurality of preset areas; the distribution tree corresponding to the target area is constructed based on a data cache range corresponding to a terminal identification in a target terminal identification set, and is a tree with a first terminal identification in a terminal identification set of terminals located in the target area as a root node; the target area is any one of the plurality of preset areas, the first terminal identification is a terminal identification with the largest corresponding data cache range in the terminal identification set, the target terminal identification set includes the terminal identification set, or includes the terminal identification set and first terminal identifications corresponding to other areas of the plurality of preset areas except the target area; the first terminal is any one of the terminals located in the plurality of preset areas;
[0048] The target terminal identification sending module is configured to send the target terminal identification to the first terminal, wherein the target terminal identification is used to instruct the first terminal to obtain the target service data corresponding to the data distribution request from the target terminal corresponding to the target terminal identification.
[0049] In an optional embodiment, the device further comprises:
[0050] A first distribution tree construction module is configured to execute, based on a data cache range corresponding to a terminal identifier in a current terminal identifier set and a data cache range corresponding to a terminal identifier in a preset identifier set, construction of a first distribution tree with a first terminal identifier in the current terminal identifier set as a root node; the current terminal identifier set is any terminal identifier set in a plurality of terminal identifier sets that is not added to the first distribution tree; the plurality of terminal identifier sets are terminal identifier sets of terminals located in the plurality of preset areas; the preset identifier set includes a first terminal identifier with the largest data cache range corresponding to each terminal identifier set;
[0051] an updating module, configured to delete, from the preset identification set, first terminal identifications that have been added to the first distribution tree and do not belong to the root node of the first distribution tree, and to re-determine a current terminal identification set from the multiple terminal identification sets;
[0052] A second distribution tree construction module is configured to execute, based on the current preset identification set and the data cache range corresponding to the re-determined current terminal identification set, to construct a second distribution tree with the first terminal identification in the re-determined current terminal identification set as the root node;
[0053] a distribution tree merging module, configured to merge the second distribution tree into the first distribution tree based on a first root node of the first distribution tree and a second root node of the second distribution tree;
[0054] The target distribution tree determination module is configured to use the first distribution tree as the target distribution tree when a terminal identifier in the plurality of terminal identifier sets is added to the first distribution tree.
[0055] In an optional embodiment, the device further comprises:
[0056] The jump module is configured to execute the step of jumping to the step of deleting the first terminal identification that has joined the first distribution tree and does not belong to the root node of the first distribution tree from the preset identification set when any terminal identification set in the multiple terminal identification sets has not joined the first distribution tree.
[0057] In an optional embodiment, the first distribution tree construction module includes:
[0058] A root node construction unit, configured to construct a root node of a third distribution tree based on the first terminal identifier in the current terminal identifier set;
[0059] A second terminal identification acquisition unit is configured to acquire a second terminal identification from the current terminal identification set and the preset identification set in sequence, wherein the second terminal identification is a terminal identification that is not added to the third distribution tree and has the largest corresponding data cache range in the current terminal identification set and the preset identification set;
[0060] a target node search unit configured to execute in the third distribution tree, to search for a target node whose data cache range satisfies a preset condition, wherein the preset condition is that the node where the terminal identifier is located in the current terminal identifier set, and there is an overlap between the data cache range corresponding to the second terminal identifier and the data cache range upper limit is greater than the data cache range upper limit corresponding to the second terminal identifier;
[0061] a child node adding unit, configured to, when the target node is found, add the second terminal identifier as a child node of the target node to the third distribution tree;
[0062] The first distribution tree determination unit is configured to execute, when the terminal identifier in the current terminal identifier set and the third terminal identifier in the preset identifier set are added to the third distribution tree, using the third distribution tree as the first distribution tree, and the third terminal identifier is a terminal identifier whose corresponding data cache range in the preset identifier set is smaller than the data cache range corresponding to the first terminal identifier in the current terminal identifier set.
[0063] In an optional embodiment, the distribution tree merging module includes:
[0064] A first terminal identification searching unit is configured to search the first distribution tree for a terminal identification in the second root node when the data cache range corresponding to the first root node is larger than the data cache range corresponding to the second root node;
[0065] The first distribution tree merging unit is configured to, when the terminal identifier in the second root node is found, merge the second distribution tree into the first distribution tree according to the node where the terminal identifier in the second root node in the first distribution tree is located.
[0066] In an optional embodiment, the distribution tree merging module includes:
[0067] A second terminal identification searching unit is configured to search the terminal identification in the first root node from the second distribution tree when the data cache range corresponding to the first root node is smaller than the data cache range corresponding to the second root node;
[0068] The second distribution tree merging unit is configured to, when the terminal identifier in the first root node is found, merge the second distribution tree into the first distribution tree according to the node where the terminal identifier in the first root node in the second distribution tree is located.
[0069] In an optional embodiment, the device further comprises:
[0070] A data acquisition module is configured to acquire the multiple terminal identification sets and the data cache ranges corresponding to the terminal identifications in the multiple terminal identification sets before constructing a first distribution tree with the first terminal identification in the current terminal identification set as a root node based on the data cache range corresponding to the terminal identification in the current terminal identification set and the data cache range corresponding to the terminal identification in the preset identification set;
[0071] The preset identification set construction module is configured to execute construction of the preset identification set based on the first terminal identification with the largest data cache range corresponding to each terminal identification set.
[0072] In an optional embodiment, the device further comprises:
[0073] A first sorting module is configured to sort each terminal identification set in descending order according to a lower limit of a data cache range corresponding to a terminal identification in each terminal identification set, to obtain an initial terminal identification sequence corresponding to each terminal identification set;
[0074] A second sorting module is configured to perform descending sorting of the terminal identifiers in the initial terminal identifier sequence corresponding to each terminal identifier set according to an upper limit in the data cache range corresponding to the terminal identifier in each terminal identifier set, to obtain a terminal identifier sequence corresponding to each terminal identifier set;
[0075] The preset identification set construction module includes:
[0076] A first terminal identification determination unit is configured to execute the first terminal identification in the terminal identification sequence corresponding to each terminal identification set as the first terminal identification corresponding to each terminal identification set;
[0077] The preset identification set construction unit is configured to execute construction of the preset identification set based on the first terminal identification corresponding to the multiple terminal identification sets.
[0078] In an optional embodiment, the device further comprises:
[0079] A first data cache range information updating module is configured to update data cache range information based on a data cache range of a second terminal when a data cache range of any terminal among the terminals located in the multiple preset areas is updated; the data cache range information includes a data cache range of the terminal located in the multiple preset areas, and the second terminal is a terminal whose data cache range is updated among the terminals located in the multiple preset areas;
[0080] The first target distribution tree updating module is configured to update the target distribution tree based on the updated data cache range information.
[0081] In an optional embodiment, the device further comprises:
[0082] A second data cache range information updating module is configured to execute, when receiving the data cache range of the newly added terminal sent by the newly added terminal, updating the data cache range information based on the data cache range of the newly added terminal; the data cache range information includes the data cache ranges of the terminals located in the multiple preset areas;
[0083] The second target distribution tree updating module is configured to update the target distribution tree based on the updated data cache range information.
[0084] In an optional embodiment, the device further comprises:
[0085] A third data cache range information updating module is configured to execute, when the data cache range of any terminal located in the plurality of preset areas is expired, deleting the data cache range of the third terminal in the data cache range information, the data cache range information including the data cache range of the terminals located in the plurality of preset areas, the third terminal being a terminal whose data cache range has expired;
[0086] The third target distribution tree updating module is configured to update the target distribution tree based on the updated data cache range information.
[0087] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement a method as described in any one of the above-mentioned first aspects.
[0088] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute any method described in the first aspect of the embodiment of the present disclosure.
[0089] According to a fifth aspect of an embodiment of the present disclosure, there is provided a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute any one of the methods described in the first aspect of the embodiment of the present disclosure.
[0090] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0091] In the data distribution process, in combination with the target distribution tree obtained by merging the distribution trees corresponding to multiple preset areas, the target terminal identifier of the target terminal that can distribute data to the first terminal currently requesting data can be quickly located, which can reduce the situation of cross-regional data distribution and effectively avoid the waste of resources caused by the cross-regional bandwidth pressure. The distribution tree corresponding to each preset area is constructed according to the corresponding data cache range in combination with the terminal identifier set of the terminal in the preset area and the first terminal identifier with the largest data cache range in other areas. In the distribution tree corresponding to any preset area, other first terminal identifiers with a data cache range smaller than the first terminal identifier corresponding to the preset area can be added as child nodes, which can ensure that the number of terminals directly requesting data from the server can be reduced during the merging process, and the pressure on the server data distribution bandwidth can be reduced. Therefore, while alleviating the bandwidth pressure of data distribution, the waste of resources caused by the bandwidth pressure can be effectively avoided, the timeliness of data distribution scheduling can be greatly improved, and the data transmission delay can be effectively reduced, the data distribution efficiency can be improved, and the response speed of the corresponding business can be improved.
[0092] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0093] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0094] Figure 1 is a schematic diagram of a data distribution system according to an exemplary embodiment;
[0095] Figure 2 is a flow chart of a data distribution method according to an exemplary embodiment;
[0096] Figure 3 is a flowchart showing a method of constructing a target distribution tree according to an exemplary embodiment;
[0097] Figure 4 It is a schematic diagram of a data cache range corresponding to a terminal identification in a terminal identification set provided according to an exemplary embodiment;
[0098] Figure 5 It is a flowchart showing a method of constructing a first distribution tree with a first terminal identifier in a current terminal identifier set as a root node based on a data cache range corresponding to a terminal identifier in a current terminal identifier set and a data cache range corresponding to a terminal identifier in a preset identifier set according to an exemplary embodiment;
[0099] Figure 6 is a schematic diagram of constructing a first distribution tree according to an exemplary embodiment;
[0100] Figure 7 is a schematic diagram of constructing a second distribution tree according to an exemplary embodiment;
[0101] Figure 8 is a schematic diagram of another method of constructing a second distribution tree according to an exemplary embodiment;
[0102] Fig. 9 is a schematic diagram of merging a second distribution tree into a first distribution tree according to an exemplary embodiment;
[0103] Fig.10 is another schematic diagram of merging a second distribution tree into a first distribution tree according to an exemplary embodiment;
[0104] Fig.11 is a schematic diagram of a target distribution tree provided according to an exemplary embodiment;
[0105] Fig.12 is a block diagram of a data distribution device according to an exemplary embodiment;
[0106] Fig.13 It is a block diagram of an electronic device for data distribution according to an exemplary embodiment. DETAILED DESCRIPTION
[0107] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0108] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0109] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.
[0110] See also Figure 1 , Figure 1 is a schematic diagram showing a data distribution system according to an exemplary embodiment. The data distribution system may include terminals 100 and servers 200 located in multiple preset areas.
[0111] In a specific embodiment, the terminal 100 may be a client that provides business services to users. Optionally, the terminal may include but is not limited to electronic devices such as smart phones, desktop computers, tablet computers, laptops, smart speakers, digital assistants, augmented reality (AR) / virtual reality (VR) devices, smart wearable devices, etc., and may also be software running on the above electronic devices, such as applications, etc. Optionally, the operating system running on the electronic device may include but is not limited to Android system, IOS system, Linux, Windows, etc.
[0112] In an optional embodiment, the server 200 may provide background services for the terminal 100. Specifically, the server 200 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0113] In addition, it should be noted that Figure 1 What is shown is only one application environment provided by the present disclosure. In actual application, other application environments may also be included, for example, more terminals may be included.
[0114] In the embodiments of this specification, the above-mentioned terminals 100 and the terminal 100 and the server 200 may be directly or indirectly connected via wired or wireless communication, which is not limited in this disclosure.
[0115] Figure 2 is a flow chart of a data distribution method according to an exemplary embodiment. Figure 2 As shown, the data distribution method can be applied to a server, and includes the following steps.
[0116] In step S201, in response to a data distribution request of a first terminal, a target terminal identifier in a parent node corresponding to the first terminal is determined based on a target distribution tree.
[0117] In a specific embodiment, the target distribution tree may be obtained by merging distribution trees corresponding to multiple preset areas; the distribution tree corresponding to the target area may be constructed based on the data cache range corresponding to the terminal identifier in the target terminal identifier set, with the first terminal identifier in the terminal identifier set of the terminal located in the target area as the root node of the tree; the above-mentioned target area may be any preset area among the multiple preset areas, the first terminal identifier corresponding to any preset area is the terminal identifier with the largest data cache range corresponding to the terminal identifier set of the terminals located in the preset area, the target terminal identifier set includes the terminal identifier set of the terminals located in the target area, or includes the terminal identifier set of the terminals located in the target area and the first terminal identifier corresponding to other areas; other areas are preset areas other than the target area among the multiple preset areas; specifically, the node where the first terminal identifier corresponding to any preset area in the target distribution tree is located does not mount the node corresponding to the non-first terminal identifier of other areas. The first terminal may be any terminal located in the multiple preset areas. The multiple preset areas may be multiple different areas; for example, multiple different cities, multiple different provinces, multiple different countries, etc. The above-mentioned terminals located in the multiple preset areas may be multiple terminals that need to request the same data from the server. Optionally, the data in the server may vary depending on the actual business scenario. For example, in a model transmission scenario, the data in the server may be a model; in a streaming media transmission scenario, the data in the server may be streaming media.
[0118] In actual applications, due to the limited cache capacity of each terminal, it is impossible to cache all the data required from the server locally at one time. Accordingly, data can be requested from the server in batches, and when the data in the cache exceeds the cache capacity, the historical cache data in the cache can be overwritten based on the new data obtained from the server. Accordingly, the data cache range of any of the above terminals can be the range corresponding to the data stored in the cache (the cache of the terminal) at the current time. Specifically, the terminal can request data in sequence according to the time when the data is stored in the server; optionally, the data can be identified in combination with the time when the data is stored in the server, and accordingly, the above data cache range can be the timestamp (the time when the data is stored in the server) interval corresponding to the data stored in the cache at the current time; optionally, a preset character can be set in combination with the time when the data is stored in the server to identify the data, and optionally, the value of the preset character is positively correlated with the time sequence, for example, 0001, 0002, 0003, etc. in order from the first to the last time, and accordingly, the above data cache range can be the character interval corresponding to the data stored in the cache at the current time.
[0119] In a specific embodiment, terminals located in multiple preset areas can report the data cache range to the server after a certain interval or after obtaining data from the server a certain number of times. Accordingly, the above current time can be the time when the terminal reports the data cache range to the service.
[0120] In a specific embodiment, the data distribution request may include the terminal identifier of the first terminal. Accordingly, the server may determine the parent node corresponding to the first terminal from the target distribution tree in combination with the terminal identifier of the first terminal, and use the terminal identifier in the parent node as the target terminal identifier.
[0121] In an optional embodiment, the above method may further include: a step of constructing a target distribution tree, such as Figure 3 As shown, the steps of constructing the target distribution tree may include:
[0122] In step S301, based on the data cache range corresponding to the terminal identifier in the current terminal identifier set and the data cache range corresponding to the terminal identifier in the preset identifier set, a first distribution tree with the first terminal identifier in the current terminal identifier set as the root node is constructed;
[0123] In a specific embodiment, the above-mentioned current terminal identification set is any terminal identification set among multiple terminal identification sets that is not added to the first distribution tree; the multiple terminal identification sets are terminal identification sets of terminals located in multiple preset areas; any preset area can correspond to a terminal identification set; the preset identification set can include the first terminal identification with the largest data cache range corresponding to each terminal identification set.
[0124] In an optional embodiment, before constructing a first distribution tree with the first terminal identifier in the current terminal identifier set as the root node based on the data cache range corresponding to the terminal identifier in the current terminal identifier set and the data cache range corresponding to the terminal identifier in the preset identifier set, the method may further include:
[0125] Acquire multiple terminal identification sets and data cache ranges corresponding to the terminal identifications in the multiple terminal identification sets; and construct a preset identification set based on the first terminal identification with the largest data cache range corresponding to each terminal identification set.
[0126] In a specific embodiment, the data cache range corresponding to the terminal identifier may be the data cache range of the terminal corresponding to the terminal identifier (i.e., the data range cached in the terminal). Optionally, the server may store information on data cache ranges of terminals located in multiple preset areas (hereinafter referred to as data cache range information). When the data cache range information in the server is updated, the server may rebuild the target distribution tree in combination with the updated data cache range information.
[0127] In a specific embodiment, the size of the data cache range can be determined in combination with the upper and lower limits of the data cache range. Specifically, the larger the lower limit, the larger the data cache range; in the case of the same lower limit, the larger the corresponding upper limit, the larger the data cache range. Optionally, the terminal identifiers in each terminal identifier set can be sorted in combination with the data cache range, and the first terminal identifier can be determined in combination with the sorted terminal identifier sequence.
[0128] In the above embodiment, the data cache range corresponding to the terminal identifier of the terminal in each preset area is combined to screen out the first terminal identifier of the terminal corresponding to the maximum data cache range in each preset area, and a preset identifier set is constructed. This can facilitate the subsequent merging of distribution trees corresponding to multiple preset areas with the first terminal identifier in each preset area, thereby reducing the number of terminals that directly request data from the server and reducing the pressure on the server data distribution bandwidth.
[0129] In an optional embodiment, the above method may further include:
[0130] According to the lower limit of the data cache range corresponding to the terminal identifier in each terminal identifier set, each terminal identifier set is sorted in descending order to obtain an initial terminal identifier sequence corresponding to each terminal identifier set;
[0131] According to the upper limit of the data cache range corresponding to the terminal identifier in each terminal identifier set, the terminal identifiers in the initial terminal identifier sequence corresponding to each terminal identifier set are sorted in descending order to obtain a terminal identifier sequence corresponding to each terminal identifier set;
[0132] Correspondingly, the above-mentioned construction of the preset identification set based on the first terminal identification with the largest data cache range corresponding to each terminal identification set may include:
[0133] The terminal identification that is sorted first in the terminal identification sequence corresponding to each terminal identification set is used as the first terminal identification corresponding to each terminal identification set;
[0134] A preset identification set is constructed based on the first terminal identification corresponding to the plurality of terminal identification sets.
[0135] In actual applications, due to the differences in data reading capabilities and cache capacities of different terminals, the data cache ranges of different terminals are often different; optionally, the terminal identifiers in the terminal identifier set can be sorted in descending order based on the lower limits of the data cache ranges of multiple terminals to obtain an initial terminal identifier sequence; then, the terminal identifiers in the initial terminal identifier sequence can be sorted in descending order based on the upper limits of the data cache ranges of multiple terminals to obtain a terminal identifier sequence, and the terminal identifiers of terminals with faster cache progress can be placed in front, and the terminal identifiers corresponding to the same upper limit can also be sorted based on the corresponding lower limit.
[0136] In a specific embodiment, the terminal identifier that is ranked first in the above terminal identifier sequence may be the terminal identifier with the largest corresponding data cache range (i.e., the first terminal identifier). Optionally, the terminal identifier set may also be sorted in ascending order in combination with the upper and lower limits of the data cache ranges of multiple terminals, and accordingly, the terminal identifier that is ranked last in the terminal identifier sequence corresponding to the ascending order may be the terminal identifier with the largest corresponding data cache range.
[0137] In a specific embodiment, it is assumed that multiple terminal identification sets include terminal identification set A of terminals located in preset area A, terminal identification set B of terminals located in preset area B, terminal identification set C of terminals located in preset area C, and terminal identification set D of terminals located in preset area D. And assume that the range of data to be obtained from the server is [0,100]; the terminal identifiers in the terminal identifier set A include A1, A2, A3, A4, and A5, and the data cache range corresponding to A1 is [70,100], the data cache range corresponding to A2 is [60,75], the data cache range corresponding to A3 is [35,65], the data cache range corresponding to A4 is [15,65], and the data cache range corresponding to A5 is [0,20]; the terminal identifiers in the terminal identifier set B include B1, B2, B3, and B4, and the data cache range corresponding to B1 is [70,80], the data cache range corresponding to B2 is [50,75], the data cache range corresponding to B3 is [35,60], and the data cache range corresponding to B4 is [15, 55]; the terminal identifiers in the terminal identifier set C may include C1, C2, C3, C4, C5, and C6, and the data cache range corresponding to C1 is [70,90], the data cache range corresponding to C2 is [40,75], the data cache range corresponding to C3 is [27,50], the data cache range corresponding to C4 is [20,45], the data cache range corresponding to C5 is [12,21], and the data cache range corresponding to C6 is [0,15]; the terminal identifiers in the terminal identifier set D include D1, D2, D3, and D4, and the data cache range corresponding to D1 is [36,60], the data cache range corresponding to D2 is [30,55], the data cache range corresponding to D3 is [25,35], and the data cache range corresponding to D4 is [0,28]. Optionally, taking the terminal identifier set C as an example, Figure 4 As shown, Figure 4 This is a schematic diagram of a data cache range corresponding to a terminal identifier in a terminal identifier set provided according to an exemplary embodiment. After the lower limit and upper limit of the data cache range corresponding to C1, C2, C3, C4, C5 and C6 are sorted in descending order, a terminal identifier sequence can be obtained: C1, C2, C3, C4, C5, C6.
[0138] In the above embodiment, the terminal identifiers in the terminal identifier set are sorted in descending order by combining the lower limit and the upper limit in the data cache range corresponding to the terminal identifier in each terminal identifier set. The terminal identifiers corresponding to the same upper limit can be sorted in combination with the corresponding lower limit, and the terminal identifiers can be sorted according to the data cache progress, which is convenient for the subsequent construction of the target distribution tree according to the data cache progress, greatly improving the rationality and effectiveness of the constructed target distribution tree, and thus improving the data distribution efficiency.
[0139] In an optional embodiment, if Figure 5 As shown, the above-mentioned construction of a first distribution tree with the first terminal identifier in the current terminal identifier set as the root node based on the data cache range corresponding to the terminal identifier in the current terminal identifier set and the data cache range corresponding to the terminal identifier in the preset identifier set may include the following steps:
[0140] In step S501, a root node of a third distribution tree is constructed based on a first terminal identifier in a current terminal identifier set;
[0141] In step S503, a second terminal identifier is acquired from the current terminal identifier set and the preset identifier set in sequence;
[0142] In step S505, in the third distribution tree, a target node whose data cache range meets a preset condition is searched, the preset condition being that the node where the terminal identifier is located in the current terminal identifier set, and there is an overlap between the data cache range corresponding to the second terminal identifier, and the upper limit of the data cache range is greater than the upper limit of the data cache range corresponding to the second terminal identifier;
[0143] In step S507, when the target node is found, the second terminal identifier is added to the third distribution tree as a child node of the target node;
[0144] In step S509, when the terminal identifier in the current terminal identifier set and the third terminal identifier in the preset identifier set are added to the third distribution tree, the third distribution tree is used as the first distribution tree, and the third terminal identifier is a terminal identifier whose corresponding data cache range in the preset identifier set is smaller than the data cache range corresponding to the first terminal identifier in the current terminal identifier set.
[0145] In a specific embodiment, the second terminal identifier may be a terminal identifier that is not included in the third distribution tree in the current terminal identifier set and the preset identifier set and has the largest corresponding data cache range. Specifically, in combination with the data cache range, the terminal identifier with the largest corresponding data cache range may be obtained from the terminal identifiers that are not included in the third distribution tree in sequence as the currently obtained second terminal identifier.
[0146] In an optional embodiment, after sorting the upper and lower limits of the data cache range corresponding to the terminal identifiers in the current terminal identifier set and the preset identifier set, the second terminal identifier can be obtained from the current terminal identifier set and the preset identifier set in sequence in combination with the corresponding sorting information.
[0147] In an optional embodiment, in the third distribution tree, searching for a target node whose data cache range meets a preset condition may include: searching for the current node from the third distribution tree; and taking the current node as the target node when the data cache range corresponding to the current node meets the preset condition.
[0148] In a specific embodiment, the current node may be a node with the largest corresponding data cache range among the nodes that have not been searched.
[0149] In a specific embodiment, it is possible to identify whether the current node is the node where the terminal identifier in the current terminal identifier set is located, and to compare the overlap of the data cache range corresponding to the current node and the second terminal identifier, as well as the upper limit. Optionally, when the current node is the node where the terminal identifier in the current terminal identifier set is located, and there is an overlap between the data cache range corresponding to the current node and the second terminal identifier, and the upper limit of the data cache range corresponding to the current node is greater than the upper limit of the data cache range corresponding to the second terminal identifier, it can be determined that the data cache range corresponding to the current node meets the preset conditions. Specifically, when the data cache range corresponding to the current node meets the preset conditions, it can be determined that the terminal corresponding to the current node includes the data that the terminal corresponding to the current second terminal identifier needs to request.
[0150] In the above embodiment, in combination with the data cache range, the current node is searched from the third distribution tree, so that the child nodes can be mounted according to the cache progress from fast to slow, and when the data cache range corresponding to the current node meets the preset conditions, the current node is used as the target node that can be mounted by the second terminal identifier. This can ensure that the terminal corresponding to the parent node includes the data that the terminal corresponding to the child node needs to request, and improve the effectiveness and reliability of data distribution scheduling based on the distribution tree. It is possible to avoid mounting child nodes in other areas under the root node corresponding to a preset area, reduce cross-regional data distribution, and effectively avoid the waste of resources caused by cross-regional bandwidth pressure.
[0151] In an optional embodiment, in order to better improve the load balancing of the data distribution system, the above-mentioned use of the current node as the target node when the data cache range corresponding to the current node meets the preset conditions may include: determining the number of child nodes of the current node when the data cache range corresponding to the current node meets the preset conditions; when the number of child nodes is less than a preset threshold, using the current node as the target node.
[0152] In a specific embodiment, the preset threshold value may be the upper limit of the number of child nodes that can be mounted on the node. Specifically, the number of child nodes of the current node may be the number of child nodes that have been mounted on the current node. Accordingly, when the number of child nodes of the current node is less than the preset threshold value, it can be determined that the number of nodes that have been mounted on the current node has not reached the upper limit, and accordingly, the current node can be used as the target node.
[0153] In an optional embodiment, the above method may further include:
[0154] When the number of child nodes is not less than the preset threshold, the process jumps to the step of searching the current node from the third distribution tree.
[0155] In a specific embodiment, when the number of child nodes is not less than a preset threshold, it can be determined that the number of child nodes that can be mounted on the current node has reached the upper limit, and the current node can be re-determined from the first distribution tree.
[0156] In the above embodiment, in the process of determining the target node that the node corresponding to the second terminal identifier needs to mount, combined with the judgment of whether the number of child nodes of the current node is greater than the preset threshold, it is possible to ensure that the terminal corresponding to the parent node includes the data that the terminal corresponding to the child node needs to request, thereby ensuring the load balancing of the terminal and avoiding the problem of excessive terminal load caused by one terminal distributing data to multiple downstream terminals, thereby better improving the load balancing and data distribution efficiency of the entire data distribution system.
[0157] In an optional embodiment, the above method may further include:
[0158] When the data cache range corresponding to the current node does not meet the preset condition, the process jumps to the step of searching the current node from the third distribution tree.
[0159] In a specific embodiment, when the data cache range corresponding to the current node does not meet the preset conditions, it can be determined that the terminal corresponding to the current node does not include the data requested by the terminal corresponding to the current traversal identifier, and accordingly, the current node can be re-determined from the third distribution tree.
[0160] In the above embodiment, when the data cache range corresponding to the current node does not meet the preset conditions, re-determining the current node from the third distribution tree can effectively ensure that the terminal corresponding to the parent node includes the data that the terminal corresponding to the child node needs to request, thereby improving the effectiveness and reliability of data distribution scheduling based on the distribution tree.
[0161] In a specific embodiment, when a target node whose corresponding data cache range meets a preset condition is found in the third distribution tree, the currently acquired second terminal identifier may be added to the third distribution tree as a child node of the target node.
[0162] In a specific embodiment, when the target node corresponding to the second terminal identifier obtained in sequence from the current terminal identifier set and the preset identifier set is found, the second terminal identifier obtained in sequence can be added to a third distribution tree with the first terminal identifier in the current terminal identifier set as the root node. Accordingly, when the terminal identifier in the current terminal identifier set and the third terminal identifier in the preset identifier set (the terminal identifier whose corresponding data cache range in the preset identifier set is smaller than the data cache range corresponding to the first terminal identifier in the current terminal identifier set) are added to the third distribution tree, the third distribution tree is used as the first distribution tree.
[0163] In a specific embodiment, in combination with the embodiment in which the above-mentioned multiple terminal identification sets include terminal identification set A of terminals located in preset area A, terminal identification set B of terminals located in preset area B, terminal identification set C of terminals located in preset area C, and terminal identification set D of terminals located in preset area D, the terminal identifications in the preset identification set include A1, B1, C1, and D1, and it is assumed that the current terminal identification set is terminal identification set C including C1, C2, C3, C4, C5, and C6. Figure 6 As shown, Figure 6This is a schematic diagram of building a first distribution tree according to an exemplary embodiment. Specifically, in combination with the data cache ranges corresponding to C1, C2, C3, C4, C5, C6 in the current terminal identification set and A1, B1, C1 and D1 in the preset identification set, a third distribution tree with C1 as the root node can be created first, and then A1 can be determined to be the currently acquired second terminal identification, and the node corresponding to C1 in the third distribution tree is the current node; further, in combination with the data cache range [70,100] corresponding to A1 and the data cache range [70,90] corresponding to C1, it can be determined that since the upper limit of the data cache range corresponding to the current node C1 is not greater than the upper limit of the data cache range corresponding to the second terminal identification A1, C 1 cannot be the target node of the node corresponding to A1; accordingly, A1 does not join the third distribution tree; then, it can be determined that B1 is the currently acquired second terminal identifier; and the node corresponding to C1 in the third distribution tree is still the current node. Further, combined with the data cache range [70,80] corresponding to B1 and the data cache range [70,90] corresponding to C1, it can be determined that since the node corresponding to C1 is the node where the terminal identifier in the current terminal identifier set is located, and the data cache range corresponding to C1 coincides with the data cache range corresponding to the second terminal identifier B1, and the upper limit of the data cache range corresponding to C1 is greater than the second terminal identifier. The upper limit of the data cache range corresponding to B1 is identified (i.e., the preset condition is met), the node corresponding to C1 can be the target node of the node corresponding to B1, and accordingly, the child node of the node corresponding to C1 can be constructed based on B1; further, it can be determined that C2 is the second terminal identifier currently obtained, and the node corresponding to C1 in the first distribution tree is the current node. Combined with the data cache range [40,75] corresponding to C2 and the data cache range [70,90] corresponding to C1, and assuming that the upper limit of the number of child nodes that can be mounted on the node is 2, it can be determined that the node corresponding to C1 can be the target node of the node corresponding to C2, and accordingly, the child node of the node corresponding to C2 can be reconstructed based on C2. Create a child node of the node corresponding to C1; then, it can be determined that D1 is the second terminal identifier currently obtained, and since the number of mounted child nodes of the node corresponding to C1 with a larger data cache range has reached the upper limit, the node corresponding to B1 does not belong to the node where the terminal identifier in the current terminal identifier set is located, and the node corresponding to C2 in the first distribution tree can be used as the current node; accordingly, combined with the data cache range [36,60] corresponding to D1 and the data cache range [40,75] corresponding to C2, it can be determined that the node corresponding to C2 can be the target node of the node corresponding to D1, and accordingly, the child node of the node corresponding to C2 can be constructed based on D1;Next, it can be determined that C3 is the second terminal identifier currently obtained, and since the number of mounted child nodes of the node corresponding to C1 with a larger data cache range has reached the upper limit, the node corresponding to B1 does not belong to the node where the terminal identifier in the current terminal identifier set is located, the node corresponding to C2 in the first distribution tree can still be used as the current node. Further, combined with the data cache range [27,50] corresponding to C3 and the data cache range [40,75] corresponding to C2, it can be determined that the node corresponding to C2 can be used as the target node of the node corresponding to C3. Accordingly, the child node of the node corresponding to C2 can be constructed based on C3; and the second terminal identifier currently obtained is updated in sequence until the node corresponding to C6 is added to the third distribution tree. Accordingly, the third distribution tree including the node corresponding to C6 is used as the first distribution tree to achieve the construction of the distribution tree corresponding to the preset area C. ;
[0164] In the above embodiment, in the process of constructing the first distribution tree with the first terminal identifier corresponding to each preset area as the root node, the first distribution tree that can characterize the data distribution relationship between terminals is constructed in combination with the corresponding data cache range size, which can effectively ensure that the terminal corresponding to the parent node in the target distribution tree includes the data that the terminal corresponding to the child node needs to request, thereby reducing the server data distribution bandwidth pressure, and by mounting the child node only under the node where the terminal identifier is located in the current terminal identifier set, it can effectively avoid mounting the child nodes of other areas under the root node corresponding to a preset area, reduce cross-regional data distribution, effectively avoid the waste of resources caused by cross-regional bandwidth pressure, and greatly improve data distribution efficiency.
[0165] In an optional embodiment, the above method may further include:
[0166] When there is no target node satisfying the preset condition in the third distribution tree, a root node of a fourth distribution tree is constructed according to the second terminal identifier.
[0167] In a specific embodiment, if the target node whose corresponding data cache range meets the preset conditions is not found in the third distribution tree, a distribution tree (fourth distribution tree) can be constructed with the currently acquired second terminal identifier as the root node. Optionally, in the case of constructing the fourth distribution tree, the second terminal identifier can be a terminal identifier that is not included in the third distribution tree or the fourth distribution tree in the current terminal identifier set and the preset identifier set, and whose corresponding data cache range is the largest;
[0168] The above-mentioned searching for a target node whose data cache range satisfies a preset condition in the third distribution tree may include: searching for a target node whose data cache range satisfies a preset condition in the third distribution tree and the fourth distribution tree;
[0169] The above-mentioned case where the terminal identifier in the current terminal identifier set and the third terminal identifier in the preset identifier set are added to the third distribution tree, using the third distribution tree as the first distribution tree may include: when the terminal identifier in the current terminal identifier set and the third terminal identifier in the preset identifier set are added to the third distribution tree or the fourth distribution tree, using the third distribution tree and the fourth distribution tree as the first distribution tree.
[0170] Optionally, if the target node corresponding to the current second terminal identifier cannot be found in the third distribution tree or the fourth distribution tree during the construction of the first distribution tree, a new distribution tree can be constructed in combination with the second terminal identifier, and in the subsequent distribution tree node mounting process, the second terminal identifier can be acquired and the target node can be searched in combination with the newly constructed distribution tree, until the last second terminal identifier in the current terminal identifier set and the preset identifier set is acquired and added to the constructed distribution tree, and the constructed distribution tree is used as the first distribution tree.
[0171] In step S303, the first terminal identifier that has been added to the first distribution tree and does not belong to the root node of the first distribution tree is deleted from the preset identifier set, and the current terminal identifier set is re-determined from the multiple terminal identifier sets;
[0172] In step S305, based on the current preset identifier set and the data cache range corresponding to the re-determined current terminal identifier set, a second distribution tree with the first terminal identifier in the re-determined current terminal identifier set as the root node is constructed;
[0173] In a specific embodiment, the above-mentioned detailed steps of constructing a second distribution tree with the first terminal identifier in the re-determined current terminal identifier set as the root node based on the current preset identifier set and the data cache range corresponding to the re-determined current terminal identifier set can refer to the above-mentioned specific details of constructing the first distribution tree with the first terminal identifier in the current terminal identifier set as the root node based on the data cache range corresponding to the terminal identifier in the current terminal identifier set and the data cache range corresponding to the terminal identifier in the preset identifier set, which will not be repeated here.
[0174] In a specific embodiment, in combination with the above-mentioned multiple terminal identification sets including terminal identification set A of terminals located in preset area A, terminal identification set B of terminals located in preset area B, terminal identification set C of terminals located in preset area C, and terminal identification set D of terminals located in preset area D, the first terminal identifications in the preset identification set (A1, B1, C1, D1) that have been added to the first distribution tree and do not belong to the root node of the first distribution tree may be B1 and D1; accordingly, after deleting B1 and D1, the preset identification set is updated to (A1, C1); optionally, assuming that the re-determined current terminal identification set is terminal identification set B (B1, B2, B3, B4) of terminals located in preset area B; as Figure 7As shown, Figure 7 The diagram is a schematic diagram of building a second distribution tree according to an exemplary embodiment. A distribution tree (second distribution tree) corresponding to the preset area B can be built by combining the data cache ranges corresponding to B1, B2, B3, B4 in the terminal identification set B and A1, C1 in the preset identification set.
[0175] In another specific embodiment, in combination with the above-mentioned multiple terminal identification sets including terminal identification set A of terminals located in preset area A, terminal identification set B of terminals located in preset area B, terminal identification set C of terminals located in preset area C, and terminal identification set D of terminals located in preset area D, the first terminal identifications in the preset identification set (A1, B1, C1, D1) that have been added to the first distribution tree and do not belong to the root node of the first distribution tree may be B1 and D1; accordingly, after deleting B1 and D1, the preset identification set is updated to (A1, C1); optionally, assuming that the re-determined current terminal identification set is terminal identification set A (A1, A2, A3, A4, A5) of terminals located in preset area A; as Figure 8 As shown, Figure 8 The diagram is another schematic diagram of building a second distribution tree according to an exemplary embodiment. A distribution tree (second distribution tree) corresponding to the preset area A can be built by combining A1, A2, A3, A4, A5 in the terminal identification set A and the data cache range corresponding to A1 and C1 in the preset identification set.
[0176] In step S307, based on the first root node of the first distribution tree and the second root node of the second distribution tree, the second distribution tree is merged into the first distribution tree;
[0177] In a specific embodiment, the first root node can be the root node in the first distribution tree (the node with the largest corresponding data cache range in the first distribution tree), and the second root node can be the root node in the second distribution tree (the node with the largest corresponding data cache range in the second distribution tree).
[0178] In an optional embodiment, based on the first root node of the first distribution tree and the second root node of the second distribution tree, merging the second distribution tree into the first distribution tree may include:
[0179] When the data cache range corresponding to the first root node is larger than the data cache range corresponding to the second root node, searching the first distribution tree for the terminal identifier in the second root node;
[0180] When the terminal identifier in the second root node is found, the second distribution tree is merged into the first distribution tree according to the node where the terminal identifier in the second root node in the first distribution tree is located.
[0181] In an optional embodiment, when the data cache range corresponding to the first root node is larger than the data cache range corresponding to the second root node, the first distribution tree will include the terminal identifier in the second root node (the first terminal identifier); accordingly, the terminal identifier in the second root node can be searched from the first distribution tree; and when searching for the terminal identifier in the second root node, the second distribution tree is merged into the first distribution tree in combination with the node where the terminal identifier in the second root node in the first distribution tree is located.
[0182] In a specific embodiment, in combination with the above Figure 6 The corresponding first distribution tree and Figure 7 The corresponding second distribution tree, the second root node (the node where B1 is located) in the second distribution tree is a child node of the node corresponding to C1 in the first distribution tree. Accordingly, in the process of merging the second distribution tree into the first distribution tree, the second distribution tree can inherit the upstream node of the node where B1 is located in the first distribution tree, thereby obtaining a new first distribution tree.
[0183] In a specific embodiment, in combination Fig. 9 As shown, Fig. 9 It is a schematic diagram of merging a second distribution tree into a first distribution tree according to an exemplary embodiment, wherein 901 corresponds to the first distribution tree, 902 corresponds to the second distribution tree, and 903 corresponds to the first distribution tree (new first distribution tree) merged with the second distribution tree.
[0184] In the above embodiment, when the data cache range corresponding to the first root node is larger than the data cache range corresponding to the second root node, the terminal identifier in the second root node can be found from the first distribution tree, so that the second distribution tree can be merged by inheriting the upstream node of the node where the terminal identifier in the second root node in the first distribution tree is located, thereby reducing the number of terminals that directly request data from the server and reducing the pressure on the server's data distribution bandwidth. At the same time, it can also reduce cross-regional data distribution, effectively avoid the waste of resources caused by cross-regional bandwidth pressure, and greatly improve data distribution efficiency.
[0185] In an optional embodiment, based on the first root node of the first distribution tree and the second root node of the second distribution tree, merging the second distribution tree into the first distribution tree may include:
[0186] When the data cache range corresponding to the first root node is smaller than the data cache range corresponding to the second root node, searching the second distribution tree for the terminal identifier in the first root node;
[0187] When the terminal identifier in the first root node is found, the second distribution tree is merged into the first distribution tree according to the node where the terminal identifier in the first root node in the second distribution tree is located.
[0188] In an optional embodiment, when the data cache range corresponding to the first root node is smaller than the data cache range corresponding to the second root node, the second distribution tree will include the terminal identifier in the first root node; accordingly, the terminal identifier in the first root node can be searched from the second distribution tree; and when searching for the terminal identifier in the first root node, the second distribution tree is merged into the first distribution tree in combination with the node where the terminal identifier in the first root node is located in the second distribution tree.
[0189] In a specific embodiment, in combination with the above Figure 6 The corresponding first distribution tree and Figure 8 Correspondingly, the first root node (the node where C1 is located) in the first distribution tree is a child node of the node corresponding to A1 in the second distribution tree. Accordingly, in the process of merging the second distribution tree into the first distribution tree, the first distribution tree can inherit the upstream node of the node where C1 is located in the second distribution tree, thereby obtaining a new first distribution tree.
[0190] In a specific embodiment, in combination Fig.10 As shown, Fig.10 It is another schematic diagram of merging a second distribution tree into a first distribution tree according to an exemplary embodiment, wherein 1001 corresponds to the first distribution tree, 1002 corresponds to the second distribution tree, and 1003 corresponds to the first distribution tree (new first distribution tree) merged with the second distribution tree.
[0191] In the above embodiment, when the data cache range corresponding to the first root node is smaller than the data cache range corresponding to the second root node, the terminal identifier in the first root node can be found from the second distribution tree, so that the first distribution tree can be merged by inheriting the upstream node of the node where the terminal identifier in the first root node in the second distribution tree is located, thereby reducing the number of terminals that directly request data from the server and reducing the pressure on the server's data distribution bandwidth. At the same time, it can also reduce cross-regional data distribution, effectively avoid the waste of resources caused by cross-regional bandwidth pressure, and greatly improve data distribution efficiency.
[0192] In step S309, when the terminal identifiers in the plurality of terminal identifier sets are added to the first distribution tree, the first distribution tree is used as the target distribution tree.
[0193] In another optional embodiment, the above method may further include:
[0194] If any terminal identification set among the multiple terminal identification sets is not added to the first distribution tree, the process jumps to the step of deleting the first terminal identification that has been added to the first distribution tree and does not belong to the root node of the first distribution tree from the preset identification set.
[0195] In a specific embodiment, in combination with the above-mentioned multiple terminal identification sets including terminal identification set A of terminals located in preset area A, terminal identification set B of terminals located in preset area B, terminal identification set C of terminals located in preset area C, and terminal identification set D of terminals located in preset area D, as shown in FIG. Fig.11 As shown, Fig.11 is a schematic diagram of a target distribution tree provided according to an exemplary embodiment.
[0196] In the above embodiment, in the process of constructing the target distribution trees corresponding to multiple preset areas, the terminal identification set of the terminals in each preset area and the first terminal identification with the largest data cache range in other areas are combined to construct the distribution tree corresponding to each preset area according to the corresponding data cache range, which can reduce the cross-regional data distribution and effectively avoid the waste of resources caused by the cross-regional bandwidth pressure. In addition, in the distribution tree corresponding to any preset area, other first terminal identifications with a data cache range smaller than the first terminal identification corresponding to the preset area are added as child nodes, which can facilitate the subsequent merging of the distribution trees corresponding to different areas by inheriting the upstream nodes, thereby reducing the number of terminals that directly request data from the server, reducing the pressure on the server data distribution bandwidth, and greatly improving the data distribution efficiency.
[0197] In step S203, the target terminal identifier is sent to the first terminal.
[0198] In a specific embodiment, the target terminal identifier may be used to instruct the first terminal to obtain the target service data corresponding to the data distribution request from the target terminal corresponding to the target terminal identifier. Specifically, the target service data may be the data requested by the data distribution request.
[0199] In a specific embodiment, when the first terminal receives the target terminal identifier, it may request the target service data corresponding to the data distribution request from the target terminal corresponding to the target terminal identifier.
[0200] In an optional embodiment, the above method may further include:
[0201] When the data cache range of any terminal among the terminals located in the plurality of preset areas is updated, updating the data cache range information based on the data cache range of the second terminal;
[0202] Based on the updated data cache range information, the target distribution tree is updated.
[0203] In a specific embodiment, the data cache range information includes data cache ranges of terminals located in multiple preset areas, and the second terminal may be a terminal whose data cache range is updated among the terminals located in the multiple preset areas;
[0204] Specifically, when the second terminal re-uploads the data cache range, the data cache range of the second terminal in the data cache range information stored by the server can be updated to the re-uploaded data cache range, and the target distribution tree can be rebuilt in combination with the updated data cache range information to achieve the update of the target distribution tree.
[0205] Specifically, the specific details of updating the target distribution tree in combination with the updated data cache range information can refer to the above-mentioned details of the relevant steps in combination with building the target distribution tree, which will not be repeated here.
[0206] In the above embodiment, when the data cache range of any terminal located in multiple preset areas is updated, the data cache range can be updated in combination with the updated data cache range, and then the target distribution tree can be updated in combination with the updated data cache range to achieve dynamic adjustment of the target distribution tree, thereby greatly improving the effectiveness and reliability of data distribution scheduling while improving data distribution efficiency.
[0207] In an optional embodiment, the above method may further include:
[0208] When receiving the data cache range of the newly added terminal sent by the newly added terminal, updating the data cache range information based on the data cache range of the newly added terminal;
[0209] Based on the updated data cache range information, the target distribution tree is updated.
[0210] In a specific embodiment, the data cache range information may include data cache ranges of terminals located in multiple preset areas; the newly added terminal may be a newly added terminal. Specifically, when a terminal uploads a data cache range, if the terminal identifier of the terminal is not in the terminal identifiers of terminals in the data cache range stored on the server, it can be determined that the terminal is a newly added terminal. Accordingly, the data cache range of the newly added terminal can be added to the data cache range information to implement the update of the data cache range information in the server. Accordingly, the target distribution tree can be rebuilt in combination with the updated data cache range information to implement the update of the target distribution tree.
[0211] Specifically, the specific details of updating the target distribution tree in combination with the updated data cache range information can refer to the above-mentioned details of the relevant steps in combination with building the target distribution tree, which will not be repeated here.
[0212] In the above embodiment, when the data cache range of the newly added terminal is received from the newly added terminal, the data cache range can be updated in combination with the data cache range of the newly added terminal, and then the target distribution tree can be updated in combination with the updated data cache range to achieve dynamic adjustment of the target distribution tree, thereby greatly improving the effectiveness and reliability of data distribution scheduling while improving data distribution efficiency.
[0213] In an optional embodiment, the above method may further include:
[0214] When the data cache range of any terminal in the terminals located in the plurality of preset areas expires, deleting the data cache range of the third terminal in the data cache range information;
[0215] Based on the updated data cache range information, the target distribution tree is updated.
[0216] In a specific embodiment, the above data cache range information includes data cache ranges of terminals located in multiple preset areas, and the third terminal may be a terminal whose data cache range has expired. Optionally, the server may store the update time of the data cache range of each terminal. If the data cache range of a terminal has not been updated for more than a preset period of time, it can be determined that the data cache range of the terminal has expired. Accordingly, the data cache range of the terminal can be deleted to update the data cache range information in the server; accordingly, the target distribution tree can be rebuilt in combination with the updated data cache range information to update the target distribution tree.
[0217] Specifically, the specific details of updating the target distribution tree in combination with the updated data cache range information can refer to the above-mentioned details of the relevant steps in combination with building the target distribution tree, which will not be repeated here.
[0218] In the above embodiment, when the data cache range of any terminal located in multiple preset areas expires, the data cache range can be updated by deleting the expired data cache range, and then the target distribution tree can be dynamically adjusted in combination with the updated data cache range, thereby greatly improving the effectiveness and reliability of data distribution scheduling while improving data distribution efficiency.
[0219] In an optional embodiment, if the node whose terminal identifier is the first terminal in the target distribution tree is a root node, the corresponding server may directly send the target service data to the first terminal.
[0220] It can be seen from the technical solutions provided by the above embodiments of this specification that, in the process of data distribution, this specification, in combination with the target distribution tree obtained by merging the distribution trees corresponding to multiple preset areas, can quickly locate the target terminal identifier of the target terminal that can distribute data to the first terminal currently requesting data, which can reduce the situation of cross-regional data distribution and effectively avoid the waste of resources caused by bearing cross-regional bandwidth pressure. The distribution tree corresponding to each preset area is constructed according to the corresponding data cache range in combination with the terminal identifier set of the terminal in the preset area and the first terminal identifier with the largest data cache range in other areas. Other first terminal identifiers whose data cache range is smaller than the first terminal identifier corresponding to the preset area can be added as child nodes in the distribution tree corresponding to any preset area, which can ensure that the number of terminals directly requesting data from the server can be reduced during the merging process, and the pressure on the server data distribution bandwidth can be reduced. Therefore, while alleviating the bandwidth pressure of data distribution, the waste of resources caused by bearing bandwidth pressure can be effectively avoided, the timeliness of data distribution scheduling can be greatly improved, and the data transmission delay can be effectively reduced, the data distribution efficiency can be improved, and the response speed of the corresponding business can be improved.
[0221] Fig.12 is a block diagram of a data distribution device according to an exemplary embodiment. Fig.12 , the device comprises:
[0222] The target terminal identification determination module 1210 is configured to execute a data distribution request in response to the first terminal, and determine the target terminal identification in the parent node corresponding to the first terminal based on the target distribution tree, the target distribution tree is obtained by merging the distribution trees corresponding to the multiple preset areas; the distribution tree corresponding to the target area is constructed based on the data cache range corresponding to the terminal identification in the target terminal identification set, and takes the first terminal identification in the terminal identification set of the terminals located in the target area as the root node of the tree; the target area is any preset area among the multiple preset areas, the first terminal identification is the terminal identification with the largest corresponding data cache range in the terminal identification set, the target terminal identification set includes the terminal identification set, or includes the terminal identification set and the first terminal identification corresponding to other areas in the multiple preset areas except the target area; the first terminal is any terminal among the terminals located in the multiple preset areas;
[0223] The target terminal identifier sending module 1220 is configured to send the target terminal identifier to the first terminal, where the target terminal identifier is used to instruct the first terminal to obtain target service data corresponding to the data distribution request from the target terminal corresponding to the target terminal identifier.
[0224] In an optional embodiment, the above device further includes:
[0225] The first distribution tree construction module is configured to execute, based on the data cache range corresponding to the terminal identifier in the current terminal identifier set and the data cache range corresponding to the terminal identifier in the preset identifier set, to construct a first distribution tree with the first terminal identifier in the current terminal identifier set as the root node; the current terminal identifier set is any terminal identifier set in multiple terminal identifier sets that is not added to the first distribution tree; the multiple terminal identifier sets are terminal identifier sets of terminals located in multiple preset areas; the preset identifier set includes the first terminal identifier with the largest data cache range corresponding to each terminal identifier set;
[0226] An updating module is configured to delete, from a preset identification set, first terminal identifications that have been added to the first distribution tree and do not belong to the root node of the first distribution tree, and to re-determine a current terminal identification set from a plurality of terminal identification sets;
[0227] A second distribution tree construction module is configured to execute, based on the current preset identification set and the data cache range corresponding to the re-determined current terminal identification set, to construct a second distribution tree with the first terminal identification in the re-determined current terminal identification set as a root node;
[0228] a distribution tree merging module, configured to merge the second distribution tree into the first distribution tree based on a first root node of the first distribution tree and a second root node of the second distribution tree;
[0229] The target distribution tree determination module is configured to, when a terminal identifier in a plurality of terminal identifier sets is added to the first distribution tree, use the first distribution tree as the target distribution tree.
[0230] In an optional embodiment, the above device further includes:
[0231] The jump module is configured to execute the step of jumping to delete the first terminal identification that has been added to the first distribution tree and does not belong to the root node of the first distribution tree from the preset identification set when any terminal identification set among the multiple terminal identification sets is not added to the first distribution tree.
[0232] In an optional embodiment, the first distribution tree construction module includes:
[0233] A root node construction unit, configured to construct a root node of a third distribution tree based on a first terminal identifier in a current terminal identifier set;
[0234] A second terminal identification acquisition unit is configured to acquire a second terminal identification from a current terminal identification set and a preset identification set in sequence, the second terminal identification being a terminal identification that is not added to the third distribution tree and has a largest corresponding data cache range in the current terminal identification set and the preset identification set;
[0235] a target node search unit configured to execute in the third distribution tree, and search for a target node whose data cache range satisfies a preset condition, wherein the preset condition is that the node where the terminal identifier is located in the current terminal identifier set, and there is an overlap between the data cache range corresponding to the second terminal identifier, and the upper limit of the data cache range is greater than the upper limit of the data cache range corresponding to the second terminal identifier;
[0236] a child node adding unit, configured to add the second terminal identifier as a child node of the target node to the third distribution tree when the target node is found;
[0237] The first distribution tree determination unit is configured to execute, when the terminal identifier in the current terminal identifier set and the third terminal identifier in the preset identifier set are added to the third distribution tree, using the third distribution tree as the first distribution tree, and the third terminal identifier is a terminal identifier whose corresponding data cache range in the preset identifier set is smaller than the data cache range corresponding to the first terminal identifier in the current terminal identifier set.
[0238] In an optional embodiment, the distribution tree merging module includes:
[0239] A first terminal identification search unit is configured to search for a terminal identification in the second root node from the first distribution tree when the data cache range corresponding to the first root node is larger than the data cache range corresponding to the second root node;
[0240] The first distribution tree merging unit is configured to merge the second distribution tree into the first distribution tree according to the node where the terminal identifier in the second root node in the first distribution tree is located when the terminal identifier in the second root node is found.
[0241] In an optional embodiment, the distribution tree merging module includes:
[0242] A second terminal identification searching unit is configured to search the terminal identification in the first root node from the second distribution tree when the data cache range corresponding to the first root node is smaller than the data cache range corresponding to the second root node;
[0243] The second distribution tree merging unit is configured to merge the second distribution tree into the first distribution tree according to the node where the terminal identifier in the first root node in the second distribution tree is located when the terminal identifier in the first root node is found.
[0244] In an optional embodiment, the above device further includes:
[0245] a data acquisition module configured to acquire multiple terminal identification sets and data cache ranges corresponding to the terminal identifications in the multiple terminal identification sets before constructing a first distribution tree with the first terminal identification in the current terminal identification set as a root node based on the data cache range corresponding to the terminal identification in the current terminal identification set and the data cache range corresponding to the terminal identification in the preset identification set;
[0246] The preset identification set construction module is configured to construct the preset identification set based on the first terminal identification with the largest data cache range corresponding to each terminal identification set.
[0247] In an optional embodiment, the above device further includes:
[0248] A first sorting module is configured to perform descending sorting of each terminal identification set according to a lower limit of a data cache range corresponding to the terminal identification in each terminal identification set, to obtain an initial terminal identification sequence corresponding to each terminal identification set;
[0249] A second sorting module is configured to perform descending sorting of the terminal identifiers in the initial terminal identifier sequence corresponding to each terminal identifier set according to the upper limit of the data cache range corresponding to the terminal identifier in each terminal identifier set, so as to obtain a terminal identifier sequence corresponding to each terminal identifier set;
[0250] The above-mentioned preset identification set building modules include:
[0251] A first terminal identification determination unit is configured to execute the first terminal identification in the terminal identification sequence corresponding to each terminal identification set as the first terminal identification corresponding to each terminal identification set;
[0252] The preset identification set construction unit is configured to construct a preset identification set based on the first terminal identification corresponding to the plurality of terminal identification sets.
[0253] In an optional embodiment, the above device further includes:
[0254] A first data cache range information updating module is configured to update data cache range information based on a data cache range of a second terminal when a data cache range of any terminal among terminals located in a plurality of preset areas is updated; the data cache range information includes data cache ranges of terminals located in a plurality of preset areas, and the second terminal is a terminal whose data cache range is updated among terminals located in a plurality of preset areas;
[0255] The first target distribution tree updating module is configured to update the target distribution tree based on the updated data cache range information.
[0256] In an optional embodiment, the above device further includes:
[0257] A second data cache range information updating module is configured to execute, when receiving a data cache range of a newly added terminal sent by the newly added terminal, updating the data cache range information based on the data cache range of the newly added terminal; the data cache range information includes data cache ranges of terminals located in multiple preset areas;
[0258] The second target distribution tree updating module is configured to update the target distribution tree based on the updated data cache range information.
[0259] In an optional embodiment, the above device further includes:
[0260] A third data cache range information updating module is configured to execute, when a data cache range of any terminal among the terminals located in the plurality of preset areas expires, deleting a data cache range of a third terminal in the data cache range information, the data cache range information including data cache ranges of terminals located in the plurality of preset areas, the third terminal being a terminal whose data cache range has expired;
[0261] The third target distribution tree updating module is configured to update the target distribution tree based on the updated data cache range information.
[0262] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0263] Fig.13 is a block diagram of an electronic device for data distribution according to an exemplary embodiment. The electronic device may be a server, and its internal structure diagram may be as shown in FIG. Fig.13 As shown. The electronic device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data distribution method is implemented.
[0264] Those skilled in the art will understand that Fig.13 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present disclosure, and does not constitute a limitation on the electronic device to which the scheme of the present disclosure is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0265] In an exemplary embodiment, an electronic device is also provided, including: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the data distribution method as in the embodiment of the present disclosure.
[0266] In an exemplary embodiment, a computer-readable storage medium is also provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the data distribution method in the embodiment of the present disclosure.
[0267] In an exemplary embodiment, a computer program product containing instructions is also provided. When the computer program product is run on a computer, the computer is caused to execute the data distribution method in the embodiment of the present disclosure.
[0268] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0269] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0270] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A data distribution method, characterized in that: include: In response to a data distribution request of a first terminal, determining a target terminal identifier in a parent node corresponding to the first terminal based on a target distribution tree; The target distribution tree is obtained by: constructing a first distribution tree with the first terminal identifier in the current terminal identifier set as the root node based on the data cache range corresponding to the terminal identifier in the current terminal identifier set and the data cache range corresponding to the terminal identifier in the preset identifier set; the current terminal identifier set is any terminal identifier set in multiple terminal identifier sets that is not added to the first distribution tree; the multiple terminal identifier sets are terminal identifier sets of terminals located in multiple preset areas; The preset identification set includes the first terminal identification with the largest data cache range corresponding to each terminal identification set; Deleting, from the preset identification set, a first terminal identification that has been added to the first distribution tree and does not belong to the root node of the first distribution tree, and re-determining a current terminal identification set from the multiple terminal identification sets; constructing, based on the current preset identification set and the data cache range corresponding to the re-determined current terminal identification set, a second distribution tree with the first terminal identification in the re-determined current terminal identification set as the root node; Based on a first root node of the first distribution tree and a second root node of the second distribution tree, merging the second distribution tree into the first distribution tree; In a case where a terminal identifier in the plurality of terminal identifier sets is added to the first distribution tree, taking the first distribution tree as the target distribution tree; The target terminal identifier is sent to the first terminal, where the target terminal identifier is used to instruct the first terminal to obtain the target service data corresponding to the data distribution request from the target terminal corresponding to the target terminal identifier.
2. The data distribution method according to claim 1, characterized in that: The method further comprises: If any terminal identification set among the multiple terminal identification sets is not added to the first distribution tree, the process proceeds to the step of deleting the first terminal identification that has been added to the first distribution tree and does not belong to the root node of the first distribution tree from the preset identification set.
3. The data distribution method according to claim 1, characterized in that: The constructing, based on the data cache range corresponding to the terminal identifier in the current terminal identifier set and the data cache range corresponding to the terminal identifier in the preset identifier set, a first distribution tree with the first terminal identifier in the current terminal identifier set as the root node comprises: constructing a root node of a third distribution tree based on the first terminal identifier in the current terminal identifier set; sequentially acquiring a second terminal identifier from the current terminal identifier set and the preset identifier set, the second terminal identifier being a terminal identifier that is not added to the third distribution tree and has the largest corresponding data cache range in the current terminal identifier set and the preset identifier set; In the third distribution tree, searching for a target node whose data cache range satisfies a preset condition, wherein the preset condition is that the node where the terminal identifier is located in the current terminal identifier set, and there is an overlap between the data cache range corresponding to the second terminal identifier and the data cache range upper limit is greater than the data cache range upper limit corresponding to the second terminal identifier; When the target node is found, adding the second terminal identifier as a child node of the target node to the third distribution tree; When the terminal identifier in the current terminal identifier set and the third terminal identifier in the preset identifier set are added to the third distribution tree, the third distribution tree is used as the first distribution tree, and the third terminal identifier is a terminal identifier whose corresponding data cache range in the preset identifier set is smaller than the data cache range corresponding to the first terminal identifier in the current terminal identifier set.
4. The data distribution method according to claim 1, characterized in that: The merging the second distribution tree into the first distribution tree based on the first root node of the first distribution tree and the second root node of the second distribution tree comprises: When the data cache range corresponding to the first root node is larger than the data cache range corresponding to the second root node, searching the first distribution tree for the terminal identifier in the second root node; When the terminal identifier in the second root node is found, the second distribution tree is merged into the first distribution tree according to the node where the terminal identifier in the second root node in the first distribution tree is located.
5. The data distribution method according to claim 1, characterized in that: The merging the second distribution tree into the first distribution tree based on the first root node of the first distribution tree and the second root node of the second distribution tree comprises: When the data cache range corresponding to the first root node is smaller than the data cache range corresponding to the second root node, searching the second distribution tree for the terminal identifier in the first root node; When the terminal identifier in the first root node is found, the second distribution tree is merged into the first distribution tree according to the node where the terminal identifier in the first root node is located in the second distribution tree.
6. The data distribution method according to claim 1, characterized in that: Before constructing a first distribution tree with the first terminal identifier in the current terminal identifier set as a root node based on the data cache range corresponding to the terminal identifier in the current terminal identifier set and the data cache range corresponding to the terminal identifier in the preset identifier set, the method further includes: Acquire the plurality of terminal identification sets and data cache ranges corresponding to the terminal identifications in the plurality of terminal identification sets; The preset identification set is constructed based on the first terminal identification with the largest data cache range corresponding to each terminal identification set.
7. The data distribution method according to claim 6, characterized in that: The method further comprises: According to the lower limit of the data cache range corresponding to the terminal identifier in each terminal identifier set, each terminal identifier set is sorted in descending order to obtain an initial terminal identifier sequence corresponding to each terminal identifier set; According to the upper limit of the data cache range corresponding to the terminal identifier in each terminal identifier set, the terminal identifiers in the initial terminal identifier sequence corresponding to each terminal identifier set are sorted in descending order to obtain the terminal identifier sequence corresponding to each terminal identifier set; The constructing the preset identification set based on the first terminal identification with the largest data cache range corresponding to each terminal identification set includes: The terminal identification that is sorted first in the terminal identification sequence corresponding to each terminal identification set is used as the first terminal identification corresponding to each terminal identification set; The preset identification set is constructed based on the first terminal identification corresponding to the multiple terminal identification sets.
8. The data distribution method according to any one of claims 1 to 7, characterized in that: The method further comprises: When the data cache range of any terminal in the plurality of preset areas is updated, the data cache range information is updated based on the data cache range of the second terminal; the data cache range information includes the data cache range of the terminal in the plurality of preset areas, and the second terminal is the terminal in the plurality of preset areas whose data cache range is updated; Based on the updated data cache range information, the target distribution tree is updated.
9. The data distribution method according to any one of claims 1 to 7, characterized in that: The method further comprises: When receiving the data cache range of the newly added terminal sent by the newly added terminal, updating the data cache range information based on the data cache range of the newly added terminal; the data cache range information includes the data cache ranges of the terminals located in the multiple preset areas; Based on the updated data cache range information, the target distribution tree is updated.
10. The data distribution method according to any one of claims 1 to 7, characterized in that: The method further comprises: When a data cache range of any terminal located in the multiple preset areas is expired, deleting a data cache range of a third terminal in the data cache range information, wherein the data cache range information includes data cache ranges of terminals located in the multiple preset areas, and the third terminal is a terminal whose data cache range has expired; Based on the updated data cache range information, the target distribution tree is updated.
11. A data distribution device, characterized in that: include: A target terminal identification determination module is configured to execute, in response to a data distribution request of a first terminal, determining, based on a target distribution tree, a target terminal identification in a parent node corresponding to the first terminal, wherein the target distribution tree is obtained by using the following modules: a first distribution tree construction module is configured to execute, based on a data cache range corresponding to a terminal identification in a current terminal identification set and a data cache range corresponding to a terminal identification in a preset identification set, construction of a first distribution tree with the first terminal identification in the current terminal identification set as a root node; the current terminal identification set is any terminal identification set in a plurality of terminal identification sets that is not added to the first distribution tree; the plurality of terminal identification sets are terminal identification sets of terminals located in a plurality of preset areas; the preset identification set includes the first terminal identification with the largest data cache range corresponding to each terminal identification set; an updating module, configured to delete, from the preset identification set, first terminal identifications that have been added to the first distribution tree and do not belong to the root node of the first distribution tree, and to re-determine a current terminal identification set from the multiple terminal identification sets; A second distribution tree construction module is configured to execute, based on the current preset identification set and the data cache range corresponding to the re-determined current terminal identification set, to construct a second distribution tree with the first terminal identification in the re-determined current terminal identification set as the root node; a distribution tree merging module, configured to merge the second distribution tree into the first distribution tree based on a first root node of the first distribution tree and a second root node of the second distribution tree; a target distribution tree determination module, configured to execute, when a terminal identifier in the plurality of terminal identifier sets is added to the first distribution tree, taking the first distribution tree as the target distribution tree; The target terminal identification sending module is configured to send the target terminal identification to the first terminal, wherein the target terminal identification is used to instruct the first terminal to obtain the target service data corresponding to the data distribution request from the target terminal corresponding to the target terminal identification.
12. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the data distribution method according to any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the data distribution method as claimed in any one of claims 1 to 10.
14. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the data distribution method according to any one of claims 1 to 10 is implemented.
Citation Information
Patent Citations
Resource distribution method, device and system, electronic equipment and storage medium
CN113329231A
Data acquisition method and device, electronic equipment and storage medium
CN114239060A
