Search

CN-116915778-B - Balanced distribution method, device, equipment and storage medium of network request resources

CN116915778BCN 116915778 BCN116915778 BCN 116915778BCN-116915778-B

Abstract

The invention discloses a method, a device, equipment and a storage medium for uniformly distributing network request resources. The method comprises the steps of receiving first information of at least one terminal request resource, determining first data corresponding to each terminal request resource in the at least one terminal according to the first information, wherein the first data at least comprise hash values corresponding to each terminal request resource and time for generating the hash values, determining the times of the same first hash values in preset time based on the first data, determining disturbance factors corresponding to the first hash values according to the times and a preset threshold value when the times are larger than or equal to the preset threshold value, adjusting the first hash values according to the disturbance factors to obtain second hash values corresponding to different positions of each first hash value in a preset hash ring, and distributing information of request resources corresponding to the second hash values to edge servers corresponding to the different positions.

Inventors

  • GE WEIFENG
  • ZHANG TINGTING
  • LI CHANGXIN

Assignees

  • 中移(杭州)信息技术有限公司
  • 中国移动通信集团有限公司

Dates

Publication Date
20260505
Application Date
20221212

Claims (10)

  1. 1. A method for balanced distribution of network request resources, the method comprising: Receiving first information of at least one terminal request resource, and determining first data corresponding to each terminal request resource in the at least one terminal according to the first information, wherein the first data at least comprises a hash value corresponding to each terminal request resource and the time for generating the hash value; Determining the number of times that the same first hash value exists in a preset time based on the first data; Determining a disturbance factor corresponding to the first hash value according to the times and a preset threshold value when the times are larger than or equal to the preset threshold value; adjusting the first hash values according to the disturbance factors to obtain second hash values corresponding to different positions of each first hash value in a preset hash ring; And distributing the information of the request resource corresponding to the second hash value to the edge servers corresponding to the different positions.
  2. 2. The method of claim 1, wherein the determining, according to the first information, first data corresponding to each terminal request resource in the at least one terminal comprises: Performing pre-mapping processing on the first information by adopting a preset hash function to obtain a hash value corresponding to each terminal request resource and the time for generating the hash value; And taking the hash value corresponding to each terminal request resource and the time for generating the hash value as the first data.
  3. 3. The method according to claim 2, wherein the method further comprises: Acquiring a first identifier corresponding to each edge server in at least one edge server, and generating a third hash value according to the first identifier; Determining a first position of the third hash value in the preset hash ring and a second position of a fourth hash value corresponding to a preset request resource in the preset hash ring; And associating the first position with the second position to obtain a first relation between the third hash value and the fourth hash value, wherein the first relation is used for determining an edge server corresponding to the hash value corresponding to each terminal request resource.
  4. 4. A method according to claim 3, characterized in that the method further comprises: matching the hash value corresponding to each terminal request resource with the fourth hash value to obtain a fourth hash value matched with the hash value corresponding to each terminal request resource; and determining an edge server corresponding to the hash value corresponding to each terminal request resource based on the first relation and the matched fourth hash value.
  5. 5. The method according to claim 1, wherein the method further comprises: Determining a fifth hash value outside the preset time based on the time of generating the hash value; Deleting the fifth hash value in the middle of the first data.
  6. 6. The method according to claim 1, wherein the determining the perturbation factor corresponding to the first hash value according to the number of times and the preset threshold value comprises: determining a second relation between the times and the preset threshold value; And determining a disturbance factor corresponding to the first hash value based on the second relation.
  7. 7. The method of claim 1, wherein the perturbation factor comprises at least a perturbation parameter, wherein the adjusting the plurality of first hash values according to the perturbation factor to obtain the second hash value corresponding to each first hash value at different positions in a preset hash ring comprises: determining random parameters corresponding to the disturbance parameters; And adjusting the plurality of first hash values based on the random parameters to obtain second hash values corresponding to different positions of each first hash value in a preset hash ring.
  8. 8. A balanced distribution device of network request resources is characterized by comprising a receiving unit, a determining unit, an adjusting unit and a distribution unit, wherein, The receiving unit is used for receiving first information of at least one terminal request resource, and determining first data corresponding to each terminal request resource in the at least one terminal according to the first information, wherein the first data at least comprises a hash value corresponding to each terminal request resource and time for generating the hash value; The determining unit is used for determining the times of the same first hash value existing in preset time based on the first data, and determining a disturbance factor corresponding to the first hash value according to the times and the preset threshold value when the times are larger than or equal to the preset threshold value; The adjusting unit is used for adjusting the plurality of first hash values according to the disturbance factors to obtain second hash values corresponding to different positions of each first hash value in a preset hash ring; The distribution unit is configured to distribute information of the requested resource corresponding to the second hash value to the edge servers corresponding to the different positions.
  9. 9. An electronic device, comprising: a memory for storing executable instructions; a processor configured to implement the method for balanced distribution of network request resources of any one of claims 1 to 7 when executing executable instructions stored in the memory.
  10. 10. A storage medium storing executable instructions for implementing the method of balanced distribution of network request resources of any one of claims 1 to 7 when executed by a processor.

Description

Balanced distribution method, device, equipment and storage medium of network request resources Technical Field The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a storage medium for uniformly distributing network request resources. Background In an information system of a large-scale service, a service cluster with a plurality of service units is often required to meet the requirements of a large number of users, and under some specific service scenarios, the requirement of hash distribution of the service units in the service cluster according to content independence and exclusivity is required to be realized based on content consistency hash. At this time, there is a problem of uneven load distribution caused by a short time of high concentration of the contents requested by the user. There is currently no effective solution to this problem. Disclosure of Invention In order to solve the related technical problems, the embodiment of the invention provides a method, a device, equipment and a storage medium for uniformly distributing network request resources. In order to achieve the above object, the technical solution of the embodiment of the present invention is as follows: in a first aspect, an embodiment of the present invention provides a method for evenly distributing network request resources, where the method includes: Receiving first information of at least one terminal request resource, and determining first data corresponding to each terminal request resource in the at least one terminal according to the first information, wherein the first data at least comprises a hash value corresponding to each terminal request resource and the time for generating the hash value; Determining the number of times that the same first hash value exists in a preset time based on the first data; Determining a disturbance factor corresponding to the first hash value according to the times and a preset threshold value when the times are larger than or equal to the preset threshold value; adjusting the first hash values according to the disturbance factors to obtain second hash values corresponding to different positions of each first hash value in a preset hash ring; And distributing the information of the request resource corresponding to the second hash value to the edge servers corresponding to the different positions. In the above solution, the determining, according to the first information, first data corresponding to the request resource of each terminal 5 in the at least one terminal includes: Performing pre-mapping processing on the first information by adopting a preset hash function to obtain a hash value corresponding to each terminal request resource and the time for generating the hash value; And taking the hash value corresponding to each terminal request resource and the time for generating the hash value as the first data. 0 In the above aspect, the method further comprises: Acquiring a first identifier corresponding to each edge server in at least one edge server, and generating a third hash value according to the first identifier; Determining a first position of the third hash value in the preset hash ring and a second position of a fourth hash value corresponding to a preset request resource in the preset hash ring; And 5, associating the first position with the second position to obtain a first relation between the third hash value and the fourth hash value, wherein the first relation is used for determining an edge server corresponding to the hash value corresponding to each terminal request resource. In the above scheme, the method further comprises: matching the hash value corresponding to each terminal request resource with the fourth hash value to obtain a fourth hash value of which 0 is matched with the hash value corresponding to each terminal request resource; and determining an edge server corresponding to the hash value corresponding to each terminal request resource based on the first relation and the matched fourth hash value. In the above scheme, the method further comprises: Determining a fifth hash value outside the preset time based on the time of generating the hash value; and 5 deleting the fifth hash value in the middle of the first data. In the above solution, the determining, according to the number of times and the preset threshold, a disturbance factor corresponding to the first hash value includes: determining a second relation between the times and the preset threshold value; And determining a disturbance factor corresponding to the first hash value based on the second relation. In the above scheme, the disturbance factor at least comprises a disturbance parameter, and the adjusting the plurality of first hash values according to the disturbance factor to obtain second hash values corresponding to different positions of each first hash value in a preset hash ring comprises: determining rando