CN111464661A - Load balancing method and device, proxy equipment, cache equipment and service node - Google Patents

Load balancing method and device, proxy equipment, cache equipment and service node Download PDF

Info

Publication number
CN111464661A
CN111464661A CN202010555608.6A CN202010555608A CN111464661A CN 111464661 A CN111464661 A CN 111464661A CN 202010555608 A CN202010555608 A CN 202010555608A CN 111464661 A CN111464661 A CN 111464661A
Authority
CN
China
Prior art keywords
block
content
blocking
file
cache
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010555608.6A
Other languages
Chinese (zh)
Other versions
CN111464661B (en
Inventor
王永强
年彦东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jinxun Ruibo Network Technology Co Ltd
Beijing Kingsoft Cloud Network Technology Co Ltd
Original Assignee
Beijing Jinxun Ruibo Network Technology Co Ltd
Beijing Kingsoft Cloud Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jinxun Ruibo Network Technology Co Ltd, Beijing Kingsoft Cloud Network Technology Co Ltd filed Critical Beijing Jinxun Ruibo Network Technology Co Ltd
Priority to CN202010555608.6A priority Critical patent/CN111464661B/en
Publication of CN111464661A publication Critical patent/CN111464661A/en
Application granted granted Critical
Publication of CN111464661B publication Critical patent/CN111464661B/en
Priority to PCT/CN2021/080746 priority patent/WO2021253889A1/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • H04L67/5682Policies or rules for updating, deleting or replacing the stored data
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/63Routing a service request depending on the request content or context

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The method comprises the steps of carrying out block storage on files, and particularly relatively and uniformly scattering the file contents to different cache parties in a block form, mapping the content requests of the files into at least one block request when a requester requests the files, and obtaining at least one block content which can be used for forming a complete target file from at least one cache party based on the at least one block request so as to realize response to the requester. The size of the blocked content corresponding to each blocking request is relatively uniform, so that the flow of the requested file is balanced and distributed to different cache parties, the intranet flow of different cache parties is relatively balanced, a bottleneck cannot be brought to the use of extranet bandwidth, and the extranet service capacity of the network such as the CDN is improved.

Description

Load balancing method and device, proxy equipment, cache equipment and service node
Technical Field
The present application belongs to the field of computer technologies, and in particular, to a load balancing method and apparatus, a proxy device, a cache device, and a service node.
Background
A CDN (Content Delivery Network) provides multi-mirror caching of files running on a public Network, and the CDN is composed of a plurality of CDN nodes, and one CDN node is a cluster composed of a plurality of physical devices (servers). The CDN enables a user to obtain required content from a nearby server in the network through functions of load balancing, content distribution, scheduling and the like, so that network congestion is reduced, and the access response speed and the hit rate of the user are improved.
Each physical device in the CDN node includes a reverse proxy nginx and a cache storage, where the reverse proxy nginx is used to provide load balancing and request forwarding functions, and implement forwarding a content request of a file, such as a url (uniform resource locator) request, to the cache of the physical device in which the requested content is cached. Aiming at the same url request, the nginx processing of any equipment is forwarded to the cache of the same equipment for storage through a consistent hash algorithm, so that the content of one url can be guaranteed to be stored in the cache of the same equipment, and repeated storage is reduced. That is, in the current technology, the reverse proxy nginx can only disperse the contents of different urls (i.e., the contents of different files) to different caches for storage, and the contents of the same url (file) are stored in the same cache.
The flow between nginx and the cache is carried out through the intranet, but the content lengths corresponding to different urls are usually different, the access frequencies of the different urls are different, the corresponding cache hashed by the urls with large content length and high access frequency can consume a higher intranet bandwidth, and otherwise, only a lower intranet bandwidth is needed. Currently, in a CDN network, an intranet bandwidth and an extranet bandwidth consumed by one physical device are consistent, and unbalanced distribution of the intranet bandwidth in a CND node can limit the utilization rate of the extranet bandwidth, which brings a bottleneck to the use of the extranet bandwidth, so that the maximum bandwidth consumed by the extranet cannot reach the maximum saturation (different physical devices are configured with the same maximum available extranet bandwidth), and accordingly, extranet service capabilities of networks such as the CDN are reduced.
Disclosure of Invention
In view of this, the present application provides a load balancing method, device, proxy device, cache device, and service node, and aims to achieve balancing of intranet bandwidth (consumed bandwidth) between different cache parties (different caches) in a service node such as a CDN, break through a use bottleneck of an extranet bandwidth, and improve extranet service capability of a network such as the CDN.
The specific technical scheme is as follows:
a load balancing method is applied to a proxy side, and comprises the following steps:
acquiring a content request carrying a data resource address of a target file;
splitting the content request into at least one chunking request comprising respective chunking location information; wherein the block location information is determined by the agent according to the data resource address;
distributing the at least one blocking request to at least one cache party corresponding to the blocking position information in the at least one blocking request respectively;
obtaining at least one blocking content fed back by at least one cache party respectively receiving corresponding blocking requests in the at least one blocking request; the absolute difference value of the data lengths of different block contents is smaller than a preset threshold value, and under the condition that a plurality of block contents exist in the same file, the first number of cache sides for storing the plurality of block contents is multiple;
and feeding back the content of the at least one block to the requester.
Optionally, the splitting the content request into at least one blocking request including corresponding blocking location information includes:
determining the data length of the file body of the target file;
determining a second quantity of the blocked contents included in the file body of the target file according to a preset data length and the data length of the file body;
and determining the second number of the block position information according to the data resource address, and generating the second number of block requests respectively comprising different block position information.
Optionally, the determining the data length of the file body of the target file includes:
determining the file header intranet address and the file header position information of the target file according to the data resource address;
sending the file header position information to a cache party indicated by the intranet address in the file header;
and acquiring the file body data length of the target file determined and fed back by the cache according to the file header position information.
Optionally, the method further includes: determining the number of the blocked intranet addresses as a second number according to the data resource addresses;
the data resource address comprises a uniform resource locator of the target file;
determining the number of the blocked intranet addresses or the blocked position information of the second number according to the data resource addresses, wherein the method comprises the following steps:
determining the block number of each block content of a second quantity;
and generating the intranet addresses or the block position information of the block contents according to the uniform resource locators and the block numbers of the block contents to obtain the intranet addresses or the block position information of the second number.
Optionally, the generating of the intra-block network address or the block location information of the block content according to the uniform resource locator and the block number of the block content includes:
splicing the uniform resource locator and the block number of the block content to obtain splicing information;
calculating an information abstract corresponding to the splicing information by using a preset abstract algorithm;
carrying out consistent Hash operation on the information abstract to obtain a blocked intranet address of the blocked content;
and assembling the uniform resource locator with at least one of the block number of the block content and the corresponding content position of the block content in the target file to obtain the block position information of the block content.
Optionally, the distributing the at least one blocking request to at least one cache party respectively corresponding to the blocking location information in the at least one blocking request includes:
distributing the at least one blocking request to a cache party indicated by the intra-block network address corresponding to the corresponding blocking request;
after receiving the blocking request, the cache party acquires the blocking content indicated by the blocking position information in the blocking request and feeds the blocking content back to the agent party.
Optionally, the feeding back the content of the at least one block to the requesting party includes:
assembling the at least one block content to obtain the target file, and sending the target file to a requester; alternatively, the first and second electrodes may be,
and sending the at least one block content to a requester so that the requester can obtain the target file by assembling the at least one block content.
A load balancing method is applied to a cache side, and comprises the following steps:
acquiring a blocking request which is sent by an agent and comprises target blocking position information, wherein the target blocking position information is one of at least one piece of blocking position information determined by the agent according to a data resource address; the data resource address is carried in a content request which is received by an agent party and used for requesting a target file, and the blocking request is used for requesting blocking content corresponding to the target blocking position information in the target file;
acquiring block content according to the target block position information;
and sending the blocked content to the agent.
Optionally, the obtaining of the blocking content according to the target blocking position information includes:
determining whether the cache party locally has the block content indicated by the target block position information;
in the event that the determination is present, obtaining the chunked content from the local;
in a case where it is determined that there is no, predetermined back-to-source processing is performed, by which the blocking content corresponding to the blocking request is obtained.
Optionally, the executing the predetermined back-to-source processing includes:
determining a back-source cache party corresponding to the data resource address in the target block location information;
and acquiring the blocking content corresponding to the blocking request from the back-source cache party, and caching the blocking content in a corresponding position of the cache party indicated by the target blocking position information.
Optionally, the data resource address includes a uniform resource locator of the target file;
the determining a back-source cache party corresponding to the data resource address in the target block location information includes:
carrying out consistent Hash operation on the uniform resource locator of the target file to obtain an intranet address of the target file;
and determining a cache party indicated by the intranet address of the target file as the source returning cache party.
Optionally, the source-returning caching party obtains and caches the data content of the target file from a source station of the target file when the target file is not stored in each caching party; and when the cached target file meets the clearing condition, clearing the target file from the back source caching party.
Optionally, before acquiring the blocking request including the target blocking location information sent by the agent, the method further includes:
and if the file header position information of the target file sent by the agent is obtained, obtaining the file body data length of the target file according to the file header position information, and sending the file body data length to the agent.
Optionally, the obtaining of the blocking request including the target blocking location information sent by the agent side includes:
acquiring the blocking request sent by the agent side based on the corresponding blocking intranet address;
the corresponding intranet address is one of a second number of intranet addresses determined by the agent according to the data resource address; the process of determining the second number of intra-block network addresses comprises: determining, by the agent, a block number for a second number of each block content; and generating the intranet addresses of the blocked contents according to the uniform resource locators and the block numbers of the blocked contents to obtain the intranet addresses of the blocked contents with the second number.
A load balancing apparatus applied to a proxy side, the apparatus comprising:
the first acquisition unit is used for acquiring a content request carrying a data resource address of a target file;
a splitting unit configured to split the content request into at least one chunking request including corresponding chunking location information; wherein the block location information is determined by the agent according to the data resource address;
a distribution unit, configured to distribute the at least one blocking request to at least one cache party corresponding to the blocking location information in the at least one blocking request, respectively;
a second obtaining unit, configured to obtain at least one blocking content fed back by at least one cache party that receives a corresponding blocking request in the at least one blocking request respectively; the absolute difference value of the data lengths of different block contents is smaller than a preset threshold value, and under the condition that a plurality of block contents exist in the same file, the first number of cache sides for storing the plurality of block contents is multiple;
and the feedback unit is used for feeding back the content of the at least one block to the requester.
A load balancing device is applied to a cache side, and the device comprises:
a third obtaining unit, configured to obtain a blocking request that includes target blocking location information and is sent by an agent, where the target blocking location information is one of at least one piece of blocking location information determined by the agent according to a data resource address; the data resource address is carried in a content request which is received by an agent party and used for requesting a target file, and the blocking request is used for requesting blocking content corresponding to the target blocking position information in the target file;
a fourth obtaining unit, configured to obtain the blocking content according to the target blocking position information;
and the sending unit is used for sending the blocked content to the agent.
A proxy device, comprising:
a first memory for storing a first set of computer instructions;
the first processor is used for realizing the load balancing method applied to the agent side by executing the instruction set stored on the first memory.
A caching apparatus, comprising:
the magnetic disk is used for storing the data content of the file;
a second memory for storing a second set of computer instructions;
and the second processor is used for realizing the load balancing method applied to the cache party by executing the instruction set stored on the second memory.
A computer readable storage medium having stored therein a first set of computer instructions which, when executed by a processor, implement a method of load balancing applied to an agent as claimed in any one of the preceding claims.
A computer readable storage medium having stored therein a second set of computer instructions which, when executed by a processor, implement a method of load balancing applied to a caching party as recited in any one of the above.
A service node comprising a plurality of physical devices, the physical devices comprising an agent and a cache;
the agent in the service node interacts with at least one cache in the service node by executing the load balancing method applied to the agent as described in any one of the above;
the caching party in the service node interacts with the proxy party in the service node by executing the load balancing method applied to the caching party as described in any one of the above.
The load balancing method, the device, the proxy equipment, the cache equipment and the service node provided by the embodiment of the application carry out block storage on files and particularly relatively and uniformly break the file contents to different cache parties in a block form, when a requester requests the files, a content request of the files is mapped into at least one block request, and at least one block content which can be used for forming a complete target file is obtained from at least one cache party based on the at least one block request, so that the response to the requester is realized. The size of the blocked content corresponding to each blocking request is relatively uniform, so that the flow of the requested file is balanced and distributed to different cache parties, the intranet flow of different cache parties is relatively balanced, a bottleneck cannot be brought to the use of extranet bandwidth, and the extranet service capacity of the network such as the CDN is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a schematic flowchart of a load balancing method applied to an agent according to an embodiment of the present application;
fig. 2 is a schematic flowchart of another load balancing method applied to an agent according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart of a load balancing method applied to a caching party according to an embodiment of the present application;
fig. 4 is a flowchart of an implementation process for obtaining block content according to target block location information according to an embodiment of the present application;
fig. 5 is a schematic processing logic diagram of an application example for obtaining a target file from a CDN node according to an embodiment of the present disclosure;
fig. 6 is a schematic flowchart of another load balancing method applied to a caching party according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a load balancing apparatus applied to an agent according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a load balancing apparatus applied to a cache according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a load balancing apparatus applied to a cache according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a proxy device provided in an embodiment of the present application;
fig. 11 is a schematic structural diagram of a caching device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The embodiment of the application discloses a load balancing method, a device, proxy equipment, cache equipment, a storage medium and a service node, wherein files are stored in a blocking mode, the file contents are scattered to different cache parties relatively uniformly in a blocking mode, and the flow consumed by the content requests of the files is distributed to different cache parties in a balanced mode.
First, a load balancing method provided in an embodiment of the present application is described below, and referring to fig. 1, a flowchart of the load balancing method when applied to an agent is shown, where the method may include the following steps:
step 101, obtaining a content request carrying a data resource address of a target file.
The CDN node is a cluster composed of multiple physical devices (servers), each physical device of the CDN node includes a reverse proxy nginx and a cache storage, and serves as an execution main body of the method shown in fig. 1, and the proxy may be, but is not limited to, a reverse proxy nginx on any physical device (e.g., a server) in the CDN node, and is used for load balancing and request forwarding of storage of each cache in the node where the proxy is located, e.g., in the CDN node.
A client running on a user electronic device such as a mobile phone, a tablet computer, etc. sends a content request for a target file to an allocated CDN node (a CDN network obtains a required content from a nearby server in the network through functions of load balancing, content distribution, scheduling, etc.) when the content of the target file needs to be obtained from the network, where the content request carries at least a data resource address of the target file, and in a public network environment, the carried data resource address is usually a uniform resource locator url of the file, and in a reverse proxy nginx of a physical device in the CDN node, the content request carrying the data resource address of the target file, such as the url, is received.
Step 102, splitting the content request into at least one blocking request comprising corresponding blocking position information; and the block position information is determined by the agent side according to the data resource address.
In the embodiment of the application, the files are dispersedly stored in different cache parties in a blocking manner (in a specific case that the size of the file does not exceed the set data length, the files are not dispersedly stored and are directly stored in one cache party), when the blocking content of the same file is multiple, the first number of the cache parties storing the multiple blocking contents is multiple, and the absolute difference value of the data lengths of the different blocking contents is smaller than the set threshold value, so that the distribution balance of the bandwidth use of different cache parties is ensured.
Alternatively, in implementation, a fixed data length may be set (of course, the length may also be changed according to a policy), the data length is a minimum unit for implementing file blocking and distributed storage, the file content is distributed and stored in units of the data length, and the content of each block stored does not exceed the set data length.
For the obtained content request aiming at the complete target file, the agent side divides the content request into at least one block request so as to realize the content acquisition of different blocks of the target file.
The effect of the blocking position information carried in the blocking request is to facilitate storage of a corresponding cache, such as a cache of a certain physical device in a CDN node, and to index and read the blocking content corresponding to the blocking request from its content set.
Step 103, distributing the at least one blocking request to at least one cache party corresponding to the blocking position information in the at least one blocking request respectively.
And 104, acquiring at least one blocking content fed back by at least one cache party respectively receiving the corresponding blocking request in the at least one blocking request.
After receiving the blocking request, the caching party indexes and reads corresponding blocking content from a content set stored in the caching party according to blocking position information carried in the blocking request, and feeds the read blocking content back to an agent sending the blocking request, such as a reverse agent nginx.
And the absolute difference value of the data lengths of different block contents is smaller than a preset threshold value, so that the load of each cache party is balanced as much as possible. When the number of the block contents of the same file is plural, the first number of the cache sides storing the plural block contents is plural.
And step 105, feeding back the content of the at least one block to a requesting party.
After the agent side obtains at least one blocking content corresponding to at least one blocking request fed back by at least one cache side, optionally, the at least one blocking content can be assembled to obtain a target file required by the requester side, and the target file is fed back to the requester side.
In this implementation, the agent may specifically assemble each piece of content in sequence to obtain a complete target file requested by the requester, and then feed back the complete target file obtained by sequential assembly to the requester, such as a reverse proxy nginx in which a content request of the target file is received in the CDN node, and feed back the complete target file obtained by sequential assembly to the client that issued the request, and the like.
Or, optionally, the broker may also directly send the at least one piece of block content to the requester, so that the requester obtains the requested target file by assembling the at least one piece of block content. When at least one piece of block content is multiple, in order to facilitate the requester to assemble the multiple piece of block content in sequence, the agent can also carry a corresponding block number for each piece of block content when sending the multiple piece of block content to the requester.
The embodiment performs block storage on the file, and particularly relatively and uniformly scatters the content of the file to different cache parties in a block form, when a requester requests the file, the content request of the file is mapped into at least one block request, and at least one block content which can be used for forming a complete target file is obtained from at least one cache party based on the at least one block request, so as to realize response to the requester. The size of the blocked content corresponding to each blocking request is relatively uniform, so that the flow of the requested file is balanced and distributed to different cache parties, the intranet flow of different cache parties is relatively balanced, a bottleneck cannot be brought to the use of extranet bandwidth, and the extranet service capacity of the network such as the CDN is improved.
Referring to fig. 2, as an alternative embodiment, the load balancing method applied to the agent side of the present application may be further implemented by the following processing procedures:
step 201, a content request carrying a data resource address of a target file is obtained.
In this embodiment, the data resource address of the target file includes url of the target file. In addition, step 201 is the same as step 101 in the foregoing embodiment, and reference may be specifically made to the related description or description of step 101 in the foregoing embodiment, and a detailed description of step 201 is not provided here for avoiding redundancy.
Step 202, determining the data length of the file body of the target file.
In the back-end storage, a file includes two parts, namely a file header and a file body, the file header is used for recording related description information of the file, such as data length of data content in the file body; the file body includes the actual data content of the file.
After receiving a content request carrying a data resource address of a target file, such as url, by an agent, in order to split the content request into a plurality of block requests, a file header of the target file needs to be read from a cache first, so as to extract an actual data length of data content in a file body of the target file, and further facilitate subsequent processing.
In this step, the process of determining the data length of the file body of the target file may include:
1) determining the file header intranet address and the file header position information of the target file according to the data resource address;
in implementation, after determining the header position information, a header request including the header position information may be further generated, that is, the header position information is carried in the header request.
For the acquisition of the file header of the target file, if the agent party acquires the reverse agent nginx of the content request, on one hand, an intranet address of the file header is generated according to the url carried in the content request so as to be used for positioning and routing the cache party storing the file header of the target file, and on the other hand, file header position information is generated according to the url and is used as an index to realize the indexing and hitting of the file header of the target file at the positioned cache party.
As an optional implementation manner, the process of generating the intranet address in the file header of the target file includes: the url carried in the content request of the target file and the number of the file header are spliced to obtain splicing information; and carrying out consistent Hash operation on the splicing information to obtain the file header intranet address of the target file.
For a file, the present embodiment sets the number of its file header to 0, and the numbers of the respective blocks in the file body are sequentially incremented from 1 until the number of the nth block of the file body is n, where n is a natural number greater than 1. It is easy to understand that the numbering rule is not unique, and there may be other numbering rules to achieve similar purpose, for example, the number of the file header is set to 1, and the numbers of the blocks in the file body are sequentially increased from 2; or the number of the file header is set as a, the numbers of the blocks in the file body are sequentially increased from b, and the like, and of course, the file header/block numbers can also be characters formed by multi-bit numbers and/or letters, which are not shown one by one.
After the url and the file header/block numbers are spliced, the difference of splicing information corresponding to the file header and different blocks is small, the file header and different blocks are easily mapped to a few cache sides with small quantity in a centralized manner by performing consistent hash operation on the file header and different blocks, but the block content of the same file cannot be uniformly dispersed to more cache sides, for example, the block content is uniformly dispersed to more cache sides in a CDN node for storage, the inventor researches and verifies that consistent hash is directly performed on the url and the numbered (file header/block numbers) splicing information, and each hash result is in normal distribution, so that a large number of blocks can be scattered to a few cache sides in a centralized manner.
In order to improve this situation, in this embodiment, after the url and the number of the header/block are concatenated, it is proposed to perform information digest calculation on the concatenation result, and perform consistent hash on the information digest obtained by the information digest calculation, so as to achieve the purpose of uniformly dispersing the header and different blocks of the same file to more caching parties.
Thus, as another optional implementation, the process of generating the address in the file header of the target file may further be: the url carried in the content request of the target file and the number of the file header are spliced to obtain splicing information; performing summary calculation on the splicing information by using a predetermined summary algorithm; carrying out consistent Hash operation on the calculated information abstract to obtain a file head internal network address of the target file;
the digest algorithm used may be, but is not limited to, md5 (message digest 5 algorithm), md4 (message digest 4 algorithm), etc.
In addition, optionally, the process of generating header location information of the target file may include: and assembling the url of the target file and at least one of the number of the file header and the corresponding position of the file header in the target file to obtain the position information of the file header.
That is, the header location information of the target file at least needs to include the url of the target file, and at least one of the number (e.g., "0") of the header and the corresponding location (e.g., range: 0k ~128k of the header in the file) of the header in the target file.
2) And sending the file header position information to a cache party indicated by the intranet address in the file header.
In implementation, a file header request carrying the file header position information may be specifically sent to a cache party indicated by the intranet address in the file header; in addition, the header internal network address may be carried in the header request as a part of the header position information, which is not limited.
3) And acquiring the file body data length of the target file determined and fed back by the cache party according to the file header position information.
Specifically, a file header determined and fed back by the caching party according to the file header position information may be obtained, where the file header carries the file body data length of the target file.
After receiving a file header request of a target file, a caching party indicated by the intranet address in the file header indexes a corresponding file header from a self-cached data set according to file header position information such as url and a file header number carried in the request, and reads the file header.
And the agent side receives the file header of the target file read and fed back by the cache side, and further reads the file body data length of the target file from the received file header.
Step 203, determining a second number of the block contents included in the file body of the target file according to the predetermined data length and the file body data length of the target file.
The predetermined data length may be 128k, for example, or another data length different from 128 k.
Taking 128k as an example, assuming that the data length of the file body of the target file is h, the second number of chunked content included in the file body of the target file may be determined to be ⌈ h/128 ⌉.
And 204, determining the second number of the blocking position information according to the data resource address, and generating the second number of the blocking requests respectively comprising different blocking position information.
In the implementation, since the cache party storing the corresponding block content of the target file needs to be located and routed first, the corresponding block content can be obtained in the located cache party according to the block location information of the block content, and therefore, in addition to determining the second number of block location information, the following processing may be further included: and determining the number of the blocked intranet addresses as the second number according to the data resource addresses.
The function of the intra-block network address of the block content is used for positioning and routing the cache party of the corresponding block content of the storage target file.
The effect of the block position information of the block content is to serve as an index to realize the indexing and hit of the corresponding block content of the target file on the positioned cache side. More specifically, in this embodiment, a caching party, such as a cache on a physical device in a CDN node, stores a header and a block content of a file in a key-value manner, where location information of the header/block of the file (e.g., range corresponding to url + number) is used as a "key" of a data content (i.e., "value" of the header/block content), and based on the storage manner, after obtaining the location information of the header or the block content, the location information may be used as the "key" to obtain the "value" corresponding to the location information.
Similar to the generation process of the intranet address in the file header, as an optional embodiment, the process of generating the blocked intranet address may include: splicing url of the target file and a block number (such as 1 or 2 or 3 … or n, and n is a natural number greater than 1) of the block content to obtain splicing information; and carrying out consistent Hash operation on the splicing information to obtain the intra-block network address of the block content.
In order to uniformly distribute different blocked contents of the same file to more caching parties and achieve load balancing to a higher degree, as another optional embodiment, the intra-blocked network address of the blocked content may also be generated through the following process: splicing the url of the target file and the block number of the block content to obtain splicing information; performing summary calculation on the splicing information by using a predetermined summary algorithm; and carrying out consistent Hash operation on the calculated information abstract to obtain the intra-block network address of the block content.
The process of generating the blocking position information of the blocking content may include: and assembling the url of the target file with at least one of the information of the block number of the block content and the corresponding content position of the block content in the target file to obtain the block position information of the block content.
That is, the block location information of the block content of the target file at least needs to include url of the target file, and at least one of the block number of the block content and the corresponding content location of the block content in the target file (for example, the content range with the number x corresponding to the file body: 128 k-256 k).
And 205, distributing the at least one blocking request to a cache party indicated by the intra-block network address corresponding to the corresponding blocking request.
After receiving the blocking request, the cache party acquires and feeds back the blocking content indicated by the blocking position information in the blocking request to the proxy party. If the block position information is taken as the key, the corresponding value is obtained, and the feedback is given to the agent side.
Step 206, obtaining at least one blocking content fed back by at least one cache party respectively receiving a corresponding blocking request in the at least one blocking request.
The absolute difference value of the data lengths of different block contents is smaller than a set threshold, and under the condition that a plurality of block contents exist in the same file, the first number of cache sides for storing the plurality of block contents is a plurality.
And step 207, feeding back the content of the at least one block to the requesting party.
Optionally, after obtaining at least one block content corresponding to at least one block request fed back by at least one cache party, the agent party may assemble the at least one block content to obtain a target file required by the requester, and feed back the target file to the requester.
In this implementation, the agent may specifically assemble each piece of content in sequence based on a number corresponding to each piece of content, where n is a natural number greater than 1, for example, 1, 2, and 3 … n, and obtain a complete target file requested by the requester, and feed back the complete target file obtained by sequential assembly to the requester, for example, a reverse proxy nginx in the CDN node that receives a content request of the target file, and feed back the complete target file obtained by sequential assembly to a client that sends a request, or the like.
Or, optionally, the broker may also directly send the at least one piece of block content to the requester, so that the requester obtains the requested target file by assembling the at least one piece of block content. When at least one piece of block content is multiple, in order to facilitate the requester to assemble the multiple piece of block content in sequence, the agent can also carry a corresponding block number for each piece of block content when sending the multiple piece of block content to the requester.
In the embodiment, the files are stored in the block mode, the content of the files is scattered to different cache parties relatively and uniformly, the content requests of the files are mapped into at least one block request, the flow of the requested files is evenly distributed to different cache parties, the use of the bandwidth of an internal network can be distributed uniformly as far as possible, and the external network service capability of networks such as a CDN (content distribution network) is improved. In addition, in this embodiment, the digest operation is performed on the concatenation information of the url and the header/block number information of the file, and the obtained information digest is subjected to consistent hash, so that more balanced distribution of different block contents of the same file on more cache parties is realized, and the limitation of the bandwidth utilization of the intranet on the bandwidth utilization of the extranet can be further reduced.
Next, a load balancing method applied to a caching party in the embodiment of the present application is described, and referring to fig. 3, a flow diagram of the load balancing method when applied to the caching party is shown, which includes the following steps:
step 301, a blocking request including target blocking position information sent by an agent is obtained.
The target block position information is one of at least one block position information determined by the agent according to the data resource address; the data resource address is carried in a content request which is received by an agent party and used for requesting a target file, and the blocking request is used for requesting blocking content corresponding to the target blocking position information in the target file.
In this step, a blocking request sent by the agent based on the corresponding intra-block network address may be specifically obtained.
The corresponding intranet address is one of a second number of intranet addresses determined by the agent according to the data resource address; the process of determining the second number of intra-block network addresses comprises: determining, by the agent, a block number for a second number of each block content; and generating the intranet addresses of the blocked contents according to the uniform resource locators and the block numbers of the blocked contents to obtain the intranet addresses of the blocked contents with the second number. For a more specific determination process of the second number of intranet addresses, reference may be made to the above description, and details thereof are not described here.
In combination with the foregoing description, it can be determined that the target block location information in the block request may include a url of the complete target file corresponding to the block content, and at least one of a number of the block content and a content location (e.g., content range) corresponding to the number in the target file.
And step 302, acquiring the block content according to the target block position information.
As shown in fig. 4 (where "Y" indicates "yes" and "N" indicates "no"), the process of acquiring the block content from the target block position information may be implemented as:
step 401, determining whether the cache party locally has the block content indicated by the target block location information.
Based on the operation and maintenance characteristics of the CDN network, when the data content of the file is requested for the first time or is removed based on the removal policy, the CDN network does not cache the data content of the file, which may cause the data content of the file to be hit in the CDN network and fail, and accordingly the CDN network needs to pull (i.e., obtain) and cache the data from the data source station of the file (in combination with the protocol and the operation and maintenance characteristics of the CDN network, in this embodiment, the data content is stored in the cache, which is equivalent to caching the data content in the cache).
For the characteristics, in this embodiment, after a cache on a certain physical device in a CDN node obtains a blocking request, first, target blocking position information carried in the request is used as an index to determine whether blocking content indicated by the target blocking position information exists locally at the cache.
Step 402, in case of determining existence, obtaining the blocking content from the local.
If the determination result indicates that the content exists, the caching party may index and read the corresponding block content from the content set stored by the caching party by using the target block location information carried in the request as an index.
In step 403, in case of determining that there is no block, a predetermined back-to-source process is performed, by which the block content corresponding to the block request is obtained.
If the determination result indicates that the content does not exist, a back-to-source process is performed to obtain the requested tile content.
The process of the back source processing comprises the following steps:
1) determining a back-source cache party corresponding to url in the target block position information;
the cache party which receives the blocking request and fails in local hit extracts url from the blocking position information of the blocking request, namely the url of the target file corresponding to the blocking request, and performs consistent hash operation on the extracted url to obtain the intranet address of the target file; and then the cache party indicated by the intranet address of the target file is used as a source returning cache party.
The back-source cache is used for pulling and storing the data content of the target file from the source station of the target file under the condition that the target file is not stored in each cache (such as the target file is requested for the first time or is cleared from each cache based on a clearing strategy). And subsequently, when the stored target file meets the clearing condition, the back-source cache party clears the data of the target file from the content set of the back-source cache party.
2) And obtaining the blocking content corresponding to the blocking request from the back source cache party, and caching the obtained blocking content in the corresponding position of the cache party indicated by the target blocking position information.
In implementation, similarly, with the blocking position information (e.g., content range corresponding to url + blocking number + number) in the blocking request as "key", the blocking content corresponding to the blocking request is acquired from the cache from the source, and the acquired blocking content is cached in the corresponding position of the cache indicated by the intra-block network address/blocking position information, that is, the read blocking content is cached in the corresponding position of the cache failing to locally hit; then, when the blocked content of the target file is requested again, since the cache party pointed by the intranet address in the blocked file already stores a copy of the blocked content, the local hit can be successfully performed.
Similarly, the cache side receiving other blocking requests of the target file will also fail to hit on itself, converging to the source cache side, reading the required block content from the source cache side and storing one copy of the block content in the source cache side, thus, one file content is stored in two parts in the node, one part of the content is completely stored in the source returning cache party for converging the source returning, the other part of the content is scattered in different cache parties (non source returning cache parties) in a blocking mode, during coexistence of two storages, the agent side dispersedly requests each partitioned content of the target file in a partitioned form based on the routing strategy to realize load balancing, and the complete data content of the file stored by the source cache party is cleared when the clearing condition is met based on the clearing strategy, the clearing condition may be, but is not limited to, an unsolicited duration reaching a set duration, etc.
Step 303, sending the blocking content to the agent.
After obtaining the blocking content, the caching party may further send the obtained blocking content to the agent party that issued the blocking request.
It should be noted that, for a target file (target file not stored in CDN node) that is not stored in the cache party, when a file header of the target file is requested, a local hit also fails, and the cache party that receives a file header request and fails to locally hit converges to the back-source cache party based on the same principle as described above, in this case, the back-source cache party does not similarly have the target file, and accordingly needs to pull the data content of the target file from the source station, and after the back-source cache party completes data pull and stores the entire data content, the cache party that receives the file header request obtains a required file header from the back-source cache party and stores one copy of the file header in itself, and subsequently, when a blocking request is continuously distributed to different cache parties to obtain the blocking content of the target file, each cache party that receives the blocking request does not store the required blocking content, and converges to the back-source cache party, and each required blocking content is read from the entire target file stored in the back-source cache party and stored in a dispersed manner.
As shown in fig. 5, processing logic of an application instance for obtaining a target file from a CDN node is provided, where a reverse proxy nginx performs the following processing to obtain target content after obtaining a url request:
step 1, sending a file header request carrying url and file header range to cache1 indicated by the address in the file header;
step 2, after the cache1 receives the file header request, if the source return is needed, hashing the url consistency to the cache2 (if the source return is not needed, directly storing a response nginx based on the cache1 itself);
step 3, the cache2 pulls and caches the file content from the source station, and returns the file header to the cache 1;
step 4, the cache1 responds the file header to nginx to inform the nginx of the data length of the file body; meanwhile, the cache1 caches the file header;
step 5, in the process of distributing the blocking request, nginx sends a certain blocking request which is generated according to the data length of the file body and carries url and blocking range to a cache3 corresponding to the intranet address of the block;
step 6, if the source returning is needed, the cache3 hashes the url consistency to the cache2 (if the source returning is not needed, the response nginx is directly stored on the basis of the cache3 per se);
step 7, the cache2 returns the corresponding block content to the cache 3;
step 8, the cache3 responds the blocking content to nginx, and meanwhile, the cache3 caches the blocking content;
the processes of steps 9-12 and 9-12 are similar to those of steps 5-8, and steps 9-12 and 5-8 can be executed in parallel, and are not described again;
and step 13, assembling the blocking content returned by each cache by nginx to obtain a complete target file, and feeding back the complete target file to the client.
In the embodiment, in the convergence and source returning process, the source returning cache party pulls the complete data content of the file from the source station, and each cache party receiving the blocking request reads and stores the required blocking content from the source returning cache party, so that when the target file is requested again, the blocking request and the routing of the data content of the target file can be realized, the load balance of the intranet is correspondingly realized as fast as possible, in addition, the convergence and source returning are performed by adopting one source returning cache party, the source returning amount is not expanded to a higher degree, and higher additional load cannot be brought to the CDN node.
In practical application, based on a load balancing policy, a cache party, such as a cache on a physical device in a CDN node, may cache one or more block contents of the same file, and may also cache the block contents and a file header of the same file. Thus, referring to fig. 6, the load balancing method applied to the cache side may further include, before step 301, the following processing:
step 301', if the file header position information of the target file sent by the agent is obtained, the file body data length of the target file is obtained according to the file header position information, and the file body data length is sent to the agent.
The file header position information can be carried in the file header request, and the caching party can specifically obtain the file header request sent by the agent party and extract the file header position information from the file header request.
And the data length of the file body can be carried in the file header.
The caching party may specifically obtain a corresponding header (value) from the stored content set by using header location information (e.g., url + header number) as an index (key), and feed back the value to the agent that issued the header request, so that the agent extracts the file body data length from the obtained header for use, for example, the agent determines the second number of the block content of the target file according to the file body data length and the set data length, and further splits the content request of the target file into a plurality of block requests of the second number, and the like.
Corresponding to the load balancing method described above, an embodiment of the present application further discloses a load balancing apparatus, as shown in fig. 7, where the load balancing apparatus is applied to an agent side, the load balancing apparatus includes:
a first obtaining unit 701, configured to obtain a content request carrying a data resource address of a target file;
a splitting unit 702, configured to split the content request into at least one blocking request including corresponding blocking location information; wherein the block location information is determined by the agent according to the data resource address;
a distributing unit 703, configured to distribute the at least one blocking request to at least one cache party corresponding to the blocking location information in the at least one blocking request, respectively;
a second obtaining unit 704, configured to obtain at least one blocking content fed back by at least one cache party that respectively receives a corresponding blocking request in the at least one blocking request; the absolute difference value of the data lengths of different block contents is smaller than a set threshold, and under the condition that a plurality of block contents of the same file are stored, the first number of cache sides for storing the plurality of block contents is a plurality;
a feedback unit 705, configured to feed back the content of the at least one block to the requesting party.
In an optional implementation manner of the embodiment of the present application, the splitting unit 702 is specifically configured to:
determining the data length of the file body of the target file;
determining a second quantity of the blocked contents included in the file body of the target file according to a preset data length and the data length of the file body;
and determining the number of the blocked intranet addresses and the blocking position information of the second number according to the data resource addresses, and generating the blocking requests which comprise different blocking position information and are of the second number.
In an optional implementation manner of the embodiment of the present application, the determining, by the splitting unit 702, the file body data length of the target file includes:
determining the file header intranet address and the file header position information of the target file according to the data resource address;
sending the file header position information to a cache party indicated by the intranet address in the file header;
and acquiring the file body data length of the target file determined and fed back by the cache according to the file header position information.
In an optional implementation manner of the embodiment of the present application, the splitting unit 702 is further configured to: determining the number of the blocked intranet addresses as a second number according to the data resource addresses;
the data resource address comprises a uniform resource locator of the target file;
the splitting unit 702 determines, according to the data resource address, the intra-block network addresses or the block location information whose number is the second number, and includes:
determining the block number of each block content of a second quantity;
and generating the intranet addresses or the block position information of the block contents according to the uniform resource locators and the block numbers of the block contents to obtain the intranet addresses or the block position information of the second number.
In an optional implementation manner of the embodiment of the present application, the splitting unit 702 generates an intranet address or blocking position information of a block content according to the uniform resource locator and a block number of the block content, and includes:
splicing the uniform resource locator and the block number of the block content to obtain splicing information;
calculating an information abstract corresponding to the splicing information by using a preset abstract algorithm;
carrying out consistent Hash operation on the information abstract to obtain a blocked intranet address of the blocked content;
and assembling the uniform resource locator with at least one of the block number of the block content and the corresponding content position of the block content in the target file to obtain the block position information of the block content.
In an optional implementation manner of the embodiment of the present application, the distribution unit 703 is specifically configured to:
distributing the at least one blocking request to a cache party indicated by the intra-block network address corresponding to the corresponding blocking request; after receiving the blocking request, the cache party acquires the blocking content indicated by the blocking position information in the blocking request and feeds the blocking content back to the agent party.
In an optional implementation manner of the embodiment of the present application, the feedback unit 705 is specifically configured to:
assembling the at least one block content to obtain the target file, and sending the target file to a requester; alternatively, the first and second electrodes may be,
and sending the at least one block content to a requester so that the requester can obtain the target file by assembling the at least one block content.
The load balancing device applied to the agent side disclosed in the embodiments of the present application is relatively simple in description because it corresponds to the load balancing method applied to the agent side disclosed in the corresponding embodiments above, and for the relevant similarities, please refer to the description of the load balancing method applied to the agent side in the corresponding embodiments above, and details are not described here.
As shown in fig. 8, in the case of being applied to the cache side, the load balancing apparatus includes:
a third obtaining unit 801, configured to obtain a blocking request that includes target blocking location information and is sent by an agent, where the target blocking location information is one of at least one piece of blocking location information determined by the agent according to a data resource address; the data resource address is carried in a content request which is received by an agent party and used for requesting a target file, and the blocking request is used for requesting blocking content corresponding to the target blocking position information in the target file;
a fourth obtaining unit 802, configured to obtain the blocking content according to the target blocking position information;
a sending unit 803, configured to send the blocked content to the agent.
In an optional implementation manner of the embodiment of the present application, the fourth obtaining unit 802 is specifically configured to:
determining whether the cache party locally has the block content indicated by the target block position information;
in the event that the determination is present, obtaining the chunked content from the local;
in a case where it is determined that there is no, predetermined back-to-source processing is performed, by which the blocking content corresponding to the blocking request is obtained.
In an optional implementation manner of the embodiment of the present application, the fourth obtaining unit 802 performs a predetermined back-to-source process, including:
determining a back-source cache party corresponding to the data resource address in the target block location information;
and acquiring the blocking content corresponding to the blocking request from the back-source cache party, and caching the blocking content in a corresponding position of the cache party indicated by the target blocking position information.
In an optional implementation manner of the embodiment of the present application, the data resource address includes a uniform resource locator of the target file;
the fourth obtaining unit 802, determining a back-to-source cache party corresponding to the data resource address in the target block location information, includes:
carrying out consistent Hash operation on the uniform resource locator of the target file to obtain an intranet address of the target file;
determining a cache party indicated by the intranet address of the target file as the source returning cache party;
in an optional implementation manner of the embodiment of the present application, when the target file is not stored in each cache, the source-returning cache party acquires and caches the data content of the target file from a source station of the target file; and when the cached target file meets the clearing condition, clearing the target file from the back source caching party.
In an alternative implementation manner of the embodiment of the present application, referring to fig. 9, the apparatus may further include:
a fifth obtaining unit 804, configured to, in a case that a file header request including file header location information of a target file sent by an agent is obtained before a blocking request including target blocking location information sent by the agent is obtained, obtain a file body data length of the target file according to the file header location information, and send the file body data length to the agent.
In an optional implementation manner of the embodiment of the present application, the third obtaining unit 801 is specifically configured to:
acquiring the blocking request sent by the agent side based on the corresponding blocking intranet address;
the corresponding intranet address is one of a second number of intranet addresses determined by the agent according to the data resource address; the process of determining the second number of intra-block network addresses comprises: determining, by the agent, a block number for a second number of each block content; and generating the intranet addresses of the blocked contents according to the uniform resource locators and the block numbers of the blocked contents to obtain the intranet addresses of the blocked contents with the second number.
The load balancing device applied to the cache party disclosed in the embodiments of the present application is relatively simple in description because it corresponds to the load balancing method applied to the cache party disclosed in the corresponding embodiments above, and for the relevant similarities, please refer to the description of the load balancing method applied to the cache party in the corresponding embodiments above, and details are not described here.
The embodiment of the present application further discloses a proxy device, where the proxy device may be, but is not limited to, a reverse proxy nginx on any physical device (such as a server) in a CDN network node, and as shown in a schematic structural diagram of the proxy device shown in fig. 10, the proxy device at least includes:
a first memory 1001 for storing a first set of computer instructions;
the first set of computer instructions may be embodied in the form of a computer program.
The first memory 1001 may include a high speed random access memory and may also include a non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
A first processor 1002, configured to implement any of the load balancing methods applied to the agent side by executing the instruction set stored in the first memory.
The first processor 1002 may be a Central Processing Unit (CPU), an application-specific integrated circuit (ASIC), a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device.
Besides, the agent device may further include a communication interface, a communication bus, and the like. The first memory, the first processor and the communication interface are communicated with each other through a communication bus.
The communication interface is used for communication between the proxy device and other devices (such as other physical devices in the CDN node). The communication bus may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like, and may be divided into an address bus, a data bus, a control bus, and the like.
In this embodiment, a first processor in the proxy device implements block storage of a file and particularly relatively uniformly spreads file contents to different caching parties by executing a first computer instruction set stored in a first memory, maps a content request of the file into at least one block request when a requesting party requests the file, and obtains at least one block content, which can be used to compose a complete target file, from the at least one caching party based on the at least one block request to implement a response to the requesting party. The size of the blocked content corresponding to each blocking request is relatively uniform, so that the flow of the requested file is balanced and distributed to different cache parties, the intranet flow of different cache parties is relatively balanced, a bottleneck cannot be brought to the use of extranet bandwidth, and the extranet service capacity of the network such as the CDN is improved.
The embodiment of the present application further discloses a cache device, where the cache device may be, but is not limited to, a cache storage on any physical device (such as a server) in a CDN network node, and as shown in a schematic structural diagram of the cache device shown in fig. 11, the cache device at least includes:
a disk 1101 for storing data content of a file;
a second memory 1102 for storing a second set of computer instructions;
the second set of computer instructions may be embodied in the form of a computer program.
The second processor 1103 is configured to implement any one of the load balancing methods applied to the cache side by executing the instruction set stored in the second memory.
In the cache device of this embodiment, the second processor 1103 implements block storage of the file and more specifically spreads the file content relatively uniformly to different cache parties by executing the second computer instruction set in the second memory 1102, and implements block request and routing of the file at the same time, so that the use of the bandwidth of the intranet can be distributed uniformly, a bottleneck cannot be brought to the use of the bandwidth of the extranet, and the service capability of the extranet is improved.
The embodiment of the application also discloses a computer-readable storage medium, wherein a first computer instruction set is stored in the computer-readable storage medium, and when being executed by a processor, the first computer instruction set realizes any one of the load balancing methods applied to the agent side.
Correspondingly, the embodiment of the application also discloses another computer readable storage medium, and a second computer instruction set is stored in the another computer readable storage medium, and when being executed by a processor, the second computer instruction set realizes any one of the load balancing methods applied to the caching party.
When the instructions stored in the two computer-readable storage media run, the blocking storage of the files can be realized, the file contents are particularly scattered to different cache sides relatively uniformly, the blocking request and the routing of the files can be realized simultaneously, the use of the internal network bandwidth can be distributed in a balanced manner, the bottleneck for the use of the external network bandwidth can not be brought, and the external network service capability is improved.
The embodiment of the application also discloses a service node, which comprises a plurality of physical devices, wherein the physical devices comprise an agent party and a cache party;
the agent side in the service node interacts with at least one cache side in the service node by executing any load balancing method applied to the agent side;
the caching party within the service node interacts with the proxy party within the service node by performing any of the load balancing methods applied to the caching party as described above.
The service node may be a CDN node, and accordingly, the agent may be a reverse proxy nginx on a physical device (e.g., a server) in the CDN node, and the cache may be cache storage on a physical device (e.g., a server) in the CDN node.
For the communication interaction process based on load balancing between the proxy party and the caching party, specific reference may be made to the foregoing description of the related embodiments, and details are not described here.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other.
For convenience of description, the above system or apparatus is described as being divided into various modules or units by function, respectively. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
From the above description of the embodiments, it is clear to those skilled in the art that the present application can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the present application may be essentially or partially implemented in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments of the present application.
Finally, it is further noted that, herein, relational terms such as first, second, third, fourth, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing is only a preferred embodiment of the present application and it should be noted that those skilled in the art can make several improvements and modifications without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.

Claims (21)

1. A load balancing method applied to a proxy side, the method comprising:
acquiring a content request carrying a data resource address of a target file;
splitting the content request into at least one chunking request comprising respective chunking location information; wherein the block location information is determined by the agent according to the data resource address;
distributing the at least one blocking request to at least one cache party corresponding to the blocking position information in the at least one blocking request respectively;
obtaining at least one blocking content fed back by at least one cache party respectively receiving corresponding blocking requests in the at least one blocking request; the absolute difference value of the data lengths of different block contents is smaller than a preset threshold value, and under the condition that a plurality of block contents exist in the same file, the first number of cache sides for storing the plurality of block contents is multiple;
and feeding back the content of the at least one block to the requester.
2. The method of claim 1, wherein the splitting the content request into at least one chunk request including respective chunk location information comprises:
determining the data length of the file body of the target file;
determining a second quantity of the blocked contents included in the file body of the target file according to a preset data length and the data length of the file body;
and determining the second number of the block position information according to the data resource address, and generating the second number of block requests respectively comprising different block position information.
3. The method of claim 2, wherein determining the data length of the file body of the target file comprises:
determining the file header intranet address and the file header position information of the target file according to the data resource address;
sending the file header position information to a cache party indicated by the intranet address in the file header;
and acquiring the file body data length of the target file determined and fed back by the cache according to the file header position information.
4. The method of claim 2, further comprising: determining the number of the blocked intranet addresses as a second number according to the data resource addresses;
the data resource address comprises a uniform resource locator of the target file;
determining the number of the blocked intranet addresses or the blocked position information of the second number according to the data resource addresses, wherein the method comprises the following steps:
determining the block number of each block content of a second quantity;
and generating the intranet addresses or the block position information of the block contents according to the uniform resource locators and the block numbers of the block contents to obtain the intranet addresses or the block position information of the second number.
5. The method according to claim 4, wherein the generating intra-block network address or intra-block location information of the block content according to the uniform resource locator and the block number of the block content comprises:
splicing the uniform resource locator and the block number of the block content to obtain splicing information;
calculating an information abstract corresponding to the splicing information by using a preset abstract algorithm;
carrying out consistent Hash operation on the information abstract to obtain a blocked intranet address of the blocked content;
and assembling the uniform resource locator with at least one of the block number of the block content and the corresponding content position of the block content in the target file to obtain the block position information of the block content.
6. The method according to claim 4, wherein the distributing the at least one blocking request to at least one cache party respectively corresponding to the blocking location information in the at least one blocking request comprises:
distributing the at least one blocking request to a cache party indicated by the intra-block network address corresponding to the corresponding blocking request;
after receiving the blocking request, the cache party acquires the blocking content indicated by the blocking position information in the blocking request and feeds the blocking content back to the agent party.
7. The method of claim 1, wherein feeding back the at least one chunked content to a requestor comprises:
assembling the at least one block content to obtain the target file, and sending the target file to a requester; alternatively, the first and second electrodes may be,
and sending the at least one block content to a requester so that the requester can obtain the target file by assembling the at least one block content.
8. A load balancing method is applied to a cache side, and comprises the following steps:
acquiring a blocking request which is sent by an agent and comprises target blocking position information, wherein the target blocking position information is one of at least one piece of blocking position information determined by the agent according to a data resource address; the data resource address is carried in a content request which is received by an agent party and used for requesting a target file, and the blocking request is used for requesting blocking content corresponding to the target blocking position information in the target file;
acquiring block content according to the target block position information;
and sending the blocked content to the agent.
9. The method of claim 8, wherein the obtaining block content according to the target block location information comprises:
determining whether the cache party locally has the block content indicated by the target block position information;
in the event that the determination is present, obtaining the chunked content from the local;
in a case where it is determined that there is no, predetermined back-to-source processing is performed, by which the blocking content corresponding to the blocking request is obtained.
10. The method of claim 9, wherein the performing a predetermined back-to-source process comprises:
determining a back-source cache party corresponding to the data resource address in the target block location information;
and acquiring the blocking content corresponding to the blocking request from the back-source cache party, and caching the blocking content in a corresponding position of the cache party indicated by the target blocking position information.
11. The method of claim 10, wherein the data resource address comprises a uniform resource locator of the target file;
the determining a back-source cache party corresponding to the data resource address in the target block location information includes:
carrying out consistent Hash operation on the uniform resource locator of the target file to obtain an intranet address of the target file;
and determining a cache party indicated by the intranet address of the target file as the source returning cache party.
12. The method according to claim 11, wherein the back-source caching party obtains and caches the data content of the target file from a source station of the target file if the target file is not stored in each caching party; and when the cached target file meets the clearing condition, clearing the target file from the back source caching party.
13. The method of claim 8, wherein before obtaining the block request including the target block location information sent by the agent, the method further comprises:
and if the file header position information of the target file sent by the agent is obtained, obtaining the file body data length of the target file according to the file header position information, and sending the file body data length to the agent.
14. The method of claim 8, wherein the obtaining a block request including target block location information sent by the agent comprises:
acquiring the blocking request sent by the agent side based on the corresponding blocking intranet address;
the corresponding intranet address is one of a second number of intranet addresses determined by the agent according to the data resource address; the data resource address comprises a uniform resource locator of the target file; the process of determining the second number of intra-block network addresses comprises: determining, by the agent, a block number for a second number of each block content; and generating the intranet addresses of the blocked contents according to the uniform resource locators and the block numbers of the blocked contents to obtain the intranet addresses of the blocked contents with the second number.
15. A load balancing apparatus applied to a proxy side, the apparatus comprising:
the first acquisition unit is used for acquiring a content request carrying a data resource address of a target file;
a splitting unit configured to split the content request into at least one chunking request including corresponding chunking location information; wherein the block location information is determined by the agent according to the data resource address;
a distribution unit, configured to distribute the at least one blocking request to at least one cache party corresponding to the blocking location information in the at least one blocking request, respectively;
a second obtaining unit, configured to obtain at least one blocking content fed back by at least one cache party that receives a corresponding blocking request in the at least one blocking request respectively; the absolute difference value of the data lengths of different block contents is smaller than a preset threshold value, and under the condition that a plurality of block contents exist in the same file, the first number of cache sides for storing the plurality of block contents is multiple;
and the feedback unit is used for feeding back the content of the at least one block to the requester.
16. A load balancing apparatus, applied to a cache side, the apparatus comprising:
a third obtaining unit, configured to obtain a blocking request that includes target blocking location information and is sent by an agent, where the target blocking location information is one of at least one piece of blocking location information determined by the agent according to a data resource address; the data resource address is carried in a content request which is received by an agent party and used for requesting a target file, and the blocking request is used for requesting blocking content corresponding to the target blocking position information in the target file;
a fourth obtaining unit, configured to obtain the blocking content according to the target blocking position information;
and the sending unit is used for sending the blocked content to the agent.
17. A proxy device, comprising:
a first memory for storing a first set of computer instructions;
a first processor arranged to implement a method of load balancing as claimed in any one of claims 1 to 7 by executing a set of instructions stored on said first memory.
18. A cache device, comprising:
the magnetic disk is used for storing the data content of the file;
a second memory for storing a second set of computer instructions;
a second processor for implementing the method of load balancing according to any one of claims 8 to 14 by executing a set of instructions stored on said second memory.
19. A computer-readable storage medium having stored therein a first set of computer instructions which, when executed by a processor, implement the load balancing method of any one of claims 1-7.
20. A computer-readable storage medium having stored therein a second set of computer instructions which, when executed by a processor, implement the load balancing method of any one of claims 8-14.
21. A service node comprising a plurality of physical devices, the physical devices comprising an agent and a cache;
a broker within the service node interacting with at least one cache within the service node by performing the method of any of claims 1-7;
a caching party within the service node interacting with an agent within the service node by performing the method of any one of claims 8-14.
CN202010555608.6A 2020-06-17 2020-06-17 Load balancing method and device, proxy equipment, cache equipment and service node Active CN111464661B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202010555608.6A CN111464661B (en) 2020-06-17 2020-06-17 Load balancing method and device, proxy equipment, cache equipment and service node
PCT/CN2021/080746 WO2021253889A1 (en) 2020-06-17 2021-03-15 Load balancing method and apparatus, proxy device, cache device and serving node

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010555608.6A CN111464661B (en) 2020-06-17 2020-06-17 Load balancing method and device, proxy equipment, cache equipment and service node

Publications (2)

Publication Number Publication Date
CN111464661A true CN111464661A (en) 2020-07-28
CN111464661B CN111464661B (en) 2020-09-22

Family

ID=71680397

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010555608.6A Active CN111464661B (en) 2020-06-17 2020-06-17 Load balancing method and device, proxy equipment, cache equipment and service node

Country Status (2)

Country Link
CN (1) CN111464661B (en)
WO (1) WO2021253889A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111935017A (en) * 2020-10-14 2020-11-13 腾讯科技(深圳)有限公司 Cross-network application calling method and device and routing equipment
WO2021253889A1 (en) * 2020-06-17 2021-12-23 北京金迅瑞博网络技术有限公司 Load balancing method and apparatus, proxy device, cache device and serving node
CN116880928A (en) * 2023-09-06 2023-10-13 菲特(天津)检测技术有限公司 Model deployment method, device, equipment and storage medium

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114553965B (en) * 2022-01-04 2024-05-03 网宿科技股份有限公司 Scheduling method of intranet equipment, network equipment and storage medium
CN114900562B (en) * 2022-05-09 2023-07-21 北京百度网讯科技有限公司 Resource acquisition method and device, electronic equipment and storage medium
CN116527691B (en) * 2023-06-27 2023-11-03 天津中远海运散运数字科技有限公司 Method, device, equipment and medium for synchronizing ship-shore data

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102801784A (en) * 2012-07-03 2012-11-28 华为技术有限公司 Distributed type data storing method and equipment
WO2012173785A1 (en) * 2011-06-17 2012-12-20 Alibaba Group Holding Limited File processing method, system and server-clustered system for cloud storage
US20130060815A1 (en) * 2011-09-02 2013-03-07 Fujitsu Limited Recording medium, distribution controlling method, and information processing device
CN104618444A (en) * 2014-12-30 2015-05-13 北京奇虎科技有限公司 Reverse agent server processing request based method and device
US10601887B2 (en) * 2009-12-28 2020-03-24 Akamai Technologies, Inc. Stream handling using an intermediate format
US10601944B2 (en) * 2015-12-31 2020-03-24 Hughes Network Systems, Llc Accurate caching in adaptive video streaming based on collision resistant hash applied to segment contents and ephemeral request and URL data

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111464661B (en) * 2020-06-17 2020-09-22 北京金迅瑞博网络技术有限公司 Load balancing method and device, proxy equipment, cache equipment and service node

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10601887B2 (en) * 2009-12-28 2020-03-24 Akamai Technologies, Inc. Stream handling using an intermediate format
WO2012173785A1 (en) * 2011-06-17 2012-12-20 Alibaba Group Holding Limited File processing method, system and server-clustered system for cloud storage
US20130060815A1 (en) * 2011-09-02 2013-03-07 Fujitsu Limited Recording medium, distribution controlling method, and information processing device
CN102801784A (en) * 2012-07-03 2012-11-28 华为技术有限公司 Distributed type data storing method and equipment
CN104618444A (en) * 2014-12-30 2015-05-13 北京奇虎科技有限公司 Reverse agent server processing request based method and device
US10601944B2 (en) * 2015-12-31 2020-03-24 Hughes Network Systems, Llc Accurate caching in adaptive video streaming based on collision resistant hash applied to segment contents and ephemeral request and URL data

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021253889A1 (en) * 2020-06-17 2021-12-23 北京金迅瑞博网络技术有限公司 Load balancing method and apparatus, proxy device, cache device and serving node
CN111935017A (en) * 2020-10-14 2020-11-13 腾讯科技(深圳)有限公司 Cross-network application calling method and device and routing equipment
CN116880928A (en) * 2023-09-06 2023-10-13 菲特(天津)检测技术有限公司 Model deployment method, device, equipment and storage medium
CN116880928B (en) * 2023-09-06 2023-11-21 菲特(天津)检测技术有限公司 Model deployment method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN111464661B (en) 2020-09-22
WO2021253889A1 (en) 2021-12-23

Similar Documents

Publication Publication Date Title
CN111464661B (en) Load balancing method and device, proxy equipment, cache equipment and service node
US10778801B2 (en) Content delivery network architecture with edge proxy
US7127513B2 (en) Method and apparatus for distributing requests among a plurality of resources
US8924460B2 (en) Method and system of administrating a peer-to-peer file sharing network
KR101383905B1 (en) method and apparatus for processing server load balancing with the result of hash function
JP5068858B2 (en) Distributing content data packages originated by users of a super peer-to-peer network
US20150215405A1 (en) Methods of managing and storing distributed files based on information-centric network
US20110099226A1 (en) Method of requesting for location information of resources on network, user node and server for the same
CN110430274A (en) A kind of document down loading method and system based on cloud storage
US20140095605A1 (en) Method and apparatus for increasing localization of peer-to-peer traffic for content distribution in communication network
US20130275618A1 (en) Method and apparatus for reducing content redundancy in content-centric networking
US20140143339A1 (en) Method, apparatus, and system for resource sharing
JP5177919B2 (en) Index server and method
Liu et al. A novel cache replacement scheme against cache pollution attack in content-centric networks
Li et al. Challenges, designs, and performances of large-scale open-P2SP content distribution
Jin et al. Content routing and lookup schemes using global bloom filter for content-delivery-as-a-service
US9003034B2 (en) Method for operating a local area data network
Gupta et al. 2-Tiered cloud based content delivery network architecture: An efficient load balancing approach for video streaming
JP4923115B2 (en) Method, computer program and node for distributing references to objects in a self-organizing distributed overlay network, and self-organizing distributed overlay network
CN110633256A (en) Session Session sharing method in distributed cluster system
Zurgani et al. A comparative study of in-network caching strategies for information centric networks
CN115567591A (en) Content resource distribution method, content distribution network, cluster and medium
Velazco et al. Laser injection of spot defects on integrated circuits
Zhang et al. An improved strategy of piece selection in P2P
CN114338720A (en) Distributed file storage and transmission method, system and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant