CN113890879A - Load balancing method and device for data access, computer equipment and medium - Google Patents
Load balancing method and device for data access, computer equipment and medium Download PDFInfo
- Publication number
- CN113890879A CN113890879A CN202111063653.0A CN202111063653A CN113890879A CN 113890879 A CN113890879 A CN 113890879A CN 202111063653 A CN202111063653 A CN 202111063653A CN 113890879 A CN113890879 A CN 113890879A
- Authority
- CN
- China
- Prior art keywords
- address
- network request
- request
- type
- group
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 35
- 238000001514 detection method Methods 0.000 claims abstract description 47
- 238000006243 chemical reaction Methods 0.000 claims abstract description 35
- 238000013519 translation Methods 0.000 claims description 26
- 238000012545 processing Methods 0.000 claims description 12
- 238000013507 mapping Methods 0.000 claims description 11
- 238000004364 calculation method Methods 0.000 claims description 9
- 238000012544 monitoring process Methods 0.000 claims description 9
- 230000004044 response Effects 0.000 claims description 8
- 238000004590 computer program Methods 0.000 claims description 7
- 238000004891 communication Methods 0.000 claims description 6
- 238000010586 diagram Methods 0.000 description 7
- 230000003287 optical effect Effects 0.000 description 4
- 230000008569 process Effects 0.000 description 4
- 230000002159 abnormal effect Effects 0.000 description 2
- 230000004913 activation Effects 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 230000002452 interceptive effect Effects 0.000 description 2
- 230000015572 biosynthetic process Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000013467 fragmentation Methods 0.000 description 1
- 238000006062 fragmentation reaction Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000003786 synthesis reaction Methods 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1001—Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
- H04L67/1004—Server selection for load balancing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/901—Indexing; Data structures therefor; Storage structures
- G06F16/9014—Indexing; Data structures therefor; Storage structures hash tables
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/09—Mapping addresses
- H04L61/25—Mapping addresses of the same type
- H04L61/2503—Translation of Internet protocol [IP] addresses
- H04L61/251—Translation of Internet protocol [IP] addresses between different IP versions
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/146—Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding
Abstract
The invention discloses a load balancing method and device for data access, computer equipment and a storage medium, wherein the method comprises the following steps: the method comprises the steps of receiving a first network request sent by a client through an external network, carrying out address conversion on the first network request to obtain a second network request, carrying out Hash scheduling on a Uniform Resource Locator (URL) in the second network request to obtain a node server corresponding to each request in the second network request, serving as a candidate server, carrying out availability detection on each candidate server, determining a target server based on an obtained detection result, and adopting each target server to respond to each request in the second network request.
Description
Technical Field
The present invention relates to the field of data processing, and in particular, to a load balancing method and apparatus for data access, a computer device, and a medium.
Background
With the rapid development of computer technology, more and more people work, study, shop, handle business and obtain information through the internet, and some large-scale internet enterprises or organizations relate to more sub-businesses, face higher traffic in some peak hours, and how to rapidly respond to data access is an industry problem of much concern.
At present, some ways optimize response of data access by increasing hardware configuration, increasing third party machine room hosting and the like, but the cost is often high, resource waste is generated in a low peak period, and some ways perform data access response by a fragmentation polling way, so that normal response of data access can be ensured on the whole, but in a high peak period, data part access delay is too high.
Disclosure of Invention
The embodiment of the invention provides a load balancing method and device for data access, computer equipment and a storage medium, and aims to improve the efficiency of data access.
In order to solve the foregoing technical problem, an embodiment of the present application provides a load balancing method for data access, including:
receiving a first network request sent by a client through an external network;
performing address translation on the first network request to obtain a second network request;
performing hash scheduling on the URL in the second network request to obtain a node server corresponding to each request in the second network request as a candidate server;
carrying out availability detection on each candidate server, and determining a target server based on the obtained detection result;
responding, with each of the target servers, to each of the second network requests.
Optionally, the address translation of the first network request to obtain the second network request includes:
acquiring a source address and a target address corresponding to the first network request;
identifying an address type of the source address and the destination address;
and converting the source address into a source address of a preset type and a target address of the preset type based on a preset type conversion mode to obtain a second network request.
Optionally, the preset type is an IPv6 type, at least one of the address types of the source address and the destination address is not an IPv6 type, and the source address and the destination address are converted into the source address and the destination address of the preset type based on a preset type conversion manner, so as to obtain the second network request:
taking the source address and/or the target address of which the address type is not the IPv6 type as an address to be converted;
carrying out hexadecimal conversion on the address to be converted to obtain a converted address, wherein the converted address comprises four groups;
merging the first group and the second group of the conversion address to be used as an updated first group, merging the third group and the fourth group of the conversion address to obtain an updated second group, and sequentially combining the updated first group and the updated second group to obtain an updated conversion address;
and performing zero padding processing on 96 bits before the updated translation address to obtain the source address of the preset type and/or the target address of the preset type, and generating the second network request based on the source address of the preset type and/or the target address of the preset type and the first network request.
Optionally, performing hash scheduling on the URL in the second network request to obtain a node server corresponding to each request in the second network request, and using the node server as a candidate server includes:
performing hash calculation on each URL in the second network request to obtain a hash result;
and acquiring a preset hash mapping table, determining a node server corresponding to each URL based on the hash result and the preset mapping relation table, and taking the node server corresponding to each URL as the candidate server.
Optionally, the performing availability detection on each candidate server includes:
sending a heartbeat packet detection instruction to each candidate server based on cluster communication;
and determining the node state corresponding to each candidate server according to the feedback result of each candidate server for the heartbeat packet detection instruction, wherein the node state is used as the detection result of the availability detection.
In order to solve the foregoing technical problem, an embodiment of the present application further provides a load balancing apparatus for data access, including:
the request receiving module is used for receiving a first network request sent by a client through an external network;
the address translation module is used for carrying out address translation on the first network request to obtain a second network request;
the request scheduling module is used for performing hash scheduling on the URL in the second network request to obtain a node server corresponding to each request in the second network request as a candidate server;
the performance monitoring module is used for carrying out availability detection on each candidate server and determining a target server based on the obtained detection result;
a request response module, configured to respond to each request in the second network requests with each target server.
Optionally, the address translation module includes:
the address acquisition unit is used for acquiring a source address and a target address corresponding to the first network request;
a type identifying unit for identifying address types of the source address and the destination address;
and the address conversion unit is used for converting the source address into a source address of a preset type and converting the source address into a target address of the preset type based on a preset type conversion mode to obtain the second network request.
Optionally, the preset type is an IPv6 type, at least one of the address types of the source address and the destination address is not an IPv6 type, and the address translation unit includes:
the address to be converted determining subunit is configured to use the source address and/or the destination address of which the address type is not the IPv6 type as the address to be converted;
the system conversion subunit is used for carrying out hexadecimal conversion on the address to be converted to obtain a conversion address, and the conversion address comprises four groups;
a merging subunit, configured to merge the first group and the second group of the translation address to serve as an updated first group, merge the third group and the fourth group of the translation address to obtain an updated second group, and sequentially combine the updated first group and the updated second group to obtain an updated translation address;
and the address completion subunit is configured to perform zero filling processing on 96 bits before the updated converted address to obtain the source address of the preset type and/or the target address of the preset type, and generate the second network request based on the source address of the preset type and/or the target address of the preset type and the first network request.
Optionally, the request scheduling module includes:
the hash calculation unit is used for carrying out hash calculation on each URL in the second network request to obtain a hash result;
and the candidate server determining unit is used for acquiring a preset hash mapping table, determining the node server corresponding to each URL based on the hash result and the preset mapping relation table, and taking the node server corresponding to each URL as the candidate server.
Optionally, the performance monitoring module comprises:
the heartbeat detection unit is used for sending a heartbeat packet detection instruction to each candidate server based on cluster communication;
and the result determining unit is used for determining the node state corresponding to each candidate server according to the feedback result of each candidate server for the heartbeat packet detection instruction, and the node state is used as the detection result of the availability detection.
In order to solve the above technical problem, an embodiment of the present application further provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the load balancing method for data access when executing the computer program.
In order to solve the above technical problem, an embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the steps of the load balancing method for data access are implemented.
According to the load balancing method, device, computer equipment and storage medium for data access, provided by the embodiment of the invention, the first network request sent by the client through the external network is received, the address of the first network request is converted to obtain the second network request, the URL in the second network request is subjected to hash scheduling to obtain the node server corresponding to each request in the second network request, the node server is used as a candidate server, the availability of each candidate server is detected, the target server is determined based on the obtained detection result, each target server is adopted to respond to each request in the second network request, the load balancing accuracy of data access is improved, and the efficiency of data access is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments of the present invention will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive labor.
FIG. 1 is a schematic diagram of an application environment of the present application;
FIG. 2 is a flow diagram of one embodiment of a method for load balancing of data access of the present application;
FIG. 3 is a schematic block diagram illustrating one embodiment of a load balancing apparatus for data access according to the present application;
FIG. 4 is a schematic block diagram of one embodiment of a computer device according to the present application.
Detailed Description
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "including" and "having," and any variations thereof, in the description and claims of this application and the description of the above figures are intended to cover non-exclusive inclusions. The terms "first," "second," and the like in the description and claims of this application or in the above-described drawings are used for distinguishing between different objects and not for describing a particular order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. 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 invention.
Referring to fig. 1, fig. 1 is a schematic diagram of an application environment for processing a data access request according to the present embodiment.
Referring to fig. 2, fig. 2 shows a load balancing method for data access according to an embodiment of the present invention, which is detailed as follows:
s201: and receiving a first network request sent by the client through the external network.
The first network request at least comprises two access requests.
S202: and performing address conversion on the first network request to obtain a second network request.
Specifically, the address of the access request in the first network request is converted, and the second network request is generated according to the converted address.
In a specific optional implementation manner, in step S202, performing address translation on the first network request to obtain the second network request includes:
acquiring a source address and a target address corresponding to the first network request;
identifying address types of a source address and a destination address;
and converting the source address into a source address of a preset type and a target address of the preset type based on a preset type conversion mode to obtain a second network request.
The address type includes, but is not limited to, an IPv4 type and an IPv6 type.
Preferably, the preset type is an IPv6 type.
In a specific optional implementation manner, in step S202, the step of converting the preset type into the preset type of source address and the preset type of destination address based on the preset type conversion method, where the preset type is an IPv6 type, and at least one of the address types of the source address and the destination address is not an IPv6 type, further includes:
taking a source address and/or a target address with an address type different from the IPv6 type as an address to be converted;
carrying out hexadecimal conversion on the address to be converted to obtain a converted address, wherein the converted address comprises four groups;
merging the first group and the second group of the converted addresses to be used as an updated first group, merging the third group and the fourth group of the converted addresses to obtain an updated second group, and sequentially combining the updated first group and the updated second group to obtain an updated converted address;
and performing zero padding processing on 96 bits before the updated conversion address to obtain a source address of a preset type and/or a target address of a preset type, and generating a second network request based on the source address of the preset type and/or the target address of the preset type and the first network request.
In a specific example, the address type of a target address is IPv4 type, specifically 135.75.43.52, hexadecimal conversion is performed on the target address to obtain a converted address of 87.4b.2b.34, and the obtained converted address of 87.4b.2b.34 is also 8 bits in one group, so two groups of synthesis are required, the first group and the second group of the converted address are combined to obtain 874B, the third group and the fourth group of the converted address are combined to obtain 2B34, and the 2 b.2b34 is sequentially combined to obtain an updated converted address 874b.2b34, and further zero padding processing is performed on the first 96 bits to obtain 0000:0000:0000:0000: 874: 2B34 or: 874B:2B 34.
S203: and performing hash scheduling on the URL in the second network request to obtain a node server corresponding to each request in the second network request as a candidate server.
In this embodiment, the corresponding server is found through the hash result, because the hash result for a single URL is the same, theoretically, the URL is permanently allocated to a fixed node server, and because the hash calculation is performed, the URL is allocated uniformly, and meanwhile, the access amount can be balanced.
In a specific optional implementation manner, in step S203, performing hash scheduling on the URL in the second network request to obtain a node server corresponding to each request in the second network request, and the step of serving as the candidate server includes:
performing hash calculation on each URL in the second network request to obtain a hash result;
and acquiring a preset hash mapping table, determining a node server corresponding to each URL based on the hash result and the preset mapping relation table, and taking the node server corresponding to each URL as a candidate server.
In this embodiment, the hash mapping table corresponding to each node server is preset in advance, and after a hash result is obtained, the corresponding node server can be determined according to the value of the hash result.
S204: and carrying out availability detection on each candidate server, and determining a target server based on the obtained detection result.
The availability detection means monitoring the performance state of the candidate server to determine whether the candidate server can be normally used.
In a specific optional embodiment, in step S204, performing availability detection on each candidate server, and determining the target server based on the obtained detection result includes:
sending a heartbeat packet detection instruction to each candidate server based on cluster communication;
and determining the node state corresponding to each candidate server according to the feedback result of each candidate server for the heartbeat packet detection instruction, wherein the node state is used as the detection result of the availability detection.
After the candidate servers are determined, activity probing is performed on each candidate server to determine node states of the candidate servers.
It should be noted that there are multiple nodes (node servers) in the cluster, and due to some control policies and performance factors of the nodes themselves, the nodes may be dynamically brought online and offline, so that to ensure the effectiveness of subsequent data access request distribution and processing, the state of the nodes needs to be determined first.
The detection result comprises activation, downtime and non-activation.
Specifically, whether the link state of the network connection port of the candidate server corresponding to the heartbeat packet is normal is judged by sending a heartbeat packet detection instruction to each candidate server, and when the link state is normal, the node of the candidate server performs interactive response with the server according to the heartbeat packet detection instruction.
It should be understood that an anomaly can be timely discovered through heartbeat monitoring, for example, if no feedback of the node server to the heartbeat packet is received within a period of time, it is determined that the link state of the node is abnormal, at this time, the node is removed from the list of the valid nodes, the subsequent data access request is prevented from being distributed to the node, and meanwhile, the abnormal condition is timely displayed on an interactive interface of the server, so that a maintainer can timely analyze and process the related anomaly problem appearing on the corresponding cluster node.
The heartbeat packet is a self-defined command word which is used for regularly informing the self state of the opposite side between the target host and the server, is sent according to a certain time interval, is similar to a heartbeat, and is called as a heartbeat packet. The heartbeat package is used for monitoring the availability of the SOCKET and ensuring the stability of interaction between the server and the target host.
In the embodiment, the state of each candidate server is quickly judged in a heartbeat detection mode, and effective candidate servers are screened out to serve as target servers, so that the availability of the target servers is ensured.
S205: each target server is employed to respond to each of the second network requests.
In this embodiment, by receiving a first network request sent by a client through an external network, performing address translation on the first network request to obtain a second network request, performing hash scheduling on a URL in the second network request to obtain a node server corresponding to each request in the second network request, as a candidate server, performing availability detection on each candidate server, determining a target server based on an obtained detection result, and using each target server to respond to each request in the second network request, accuracy of data access load balancing is improved, and improvement of data access efficiency is facilitated.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
Fig. 3 shows a schematic block diagram of a load balancing apparatus for data access in one-to-one correspondence with the load balancing method for data access of the above-described embodiment. As shown in fig. 3, the load balancing apparatus for data access includes a request receiving module 31, an address translation module 32, a request scheduling module 33, a performance monitoring module 34, and a request response module 35. The functional modules are explained in detail as follows:
a request receiving module 31, configured to receive a first network request sent by a client through an external network;
the address translation module 32 is configured to perform address translation on the first network request to obtain a second network request;
the request scheduling module 33 is configured to perform hash scheduling on the URL in the second network request to obtain a node server corresponding to each request in the second network request, which is used as a candidate server;
the performance monitoring module 34 is configured to perform availability detection on each candidate server, and determine a target server based on an obtained detection result;
a request response module 35, configured to respond to each request in the second network requests with each target server.
Optionally, the address translation module 32 includes:
the address acquisition unit is used for acquiring a source address and a target address corresponding to the first network request;
a type identifying unit for identifying address types of the source address and the destination address;
and the address conversion unit is used for converting the source address into a source address of a preset type and converting the source address into a target address of the preset type based on a preset type conversion mode to obtain the second network request.
Optionally, the preset type is an IPv6 type, at least one of the address types of the source address and the destination address is not an IPv6 type, and the address translation unit includes:
the address to be converted determining subunit is used for taking the source address and/or the target address with the address type not being the IPv6 type as the address to be converted;
the system conversion subunit is used for carrying out hexadecimal conversion on the address to be converted to obtain a converted address, and the converted address comprises four groups;
a merging subunit, configured to merge the first group and the second group of the converted address to serve as an updated first group, merge the third group and the fourth group of the converted address to obtain an updated second group, and sequentially combine the updated first group and the updated second group to obtain an updated converted address;
and the address completion subunit is used for performing zero filling processing on 96 bits before the updated converted address to obtain a source address of a preset type and/or a target address of a preset type, and generating a second network request based on the source address of the preset type and/or the target address of the preset type and the first network request.
Optionally, the request scheduling module 33 includes:
the hash calculation unit is used for carrying out hash calculation on each URL in the second network request to obtain a hash result;
and the candidate server determining unit is used for acquiring a preset hash mapping table, determining the node server corresponding to each URL based on the hash result and the preset mapping relation table, and taking the node server corresponding to each URL as the candidate server.
Optionally, the performance monitoring module 34 includes:
the heartbeat detection unit is used for sending a heartbeat packet detection instruction to each candidate server based on cluster communication;
and the result determining unit is used for determining the node state corresponding to each candidate server according to the feedback result of each candidate server for the heartbeat packet detection instruction, and the node state is used as the detection result of the availability detection.
For specific limitations of the load balancing apparatus for data access, see the above limitations of the load balancing method for data access, which are not described herein again. The modules in the load balancing device for data access can be wholly or partially implemented by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In order to solve the technical problem, an embodiment of the present application further provides a computer device. Referring to fig. 4, fig. 4 is a block diagram of a basic structure of a computer device according to the present embodiment.
The computer device 4 comprises a memory 41, a processor 42, a network interface 43 communicatively connected to each other via a system bus. It is noted that only the computer device 4 having the components connection memory 41, processor 42, network interface 43 is shown, but it is understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead. As will be understood by those skilled in the art, the computer device is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and the hardware includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer equipment can carry out man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch panel or voice control equipment and the like.
The memory 41 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or D interface display memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 41 may be an internal storage unit of the computer device 4, such as a hard disk or a memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the computer device 4. Of course, the memory 41 may also include both internal and external storage devices of the computer device 4. In this embodiment, the memory 41 is generally used for storing an operating system installed in the computer device 4 and various types of application software, such as program codes for controlling electronic files. Further, the memory 41 may also be used to temporarily store various types of data that have been output or are to be output.
The processor 42 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 42 is typically used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is configured to execute the program code stored in the memory 41 or process data, for example, execute the program code for data access.
The network interface 43 may comprise a wireless network interface or a wired network interface, and the network interface 43 is generally used for establishing communication connection between the computer device 4 and other electronic devices.
The present application provides yet another embodiment, which is a computer-readable storage medium storing a data access program, the data access program being executable by at least one processor to cause the at least one processor to perform the steps of the load balancing method for data access as described above.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
It is to be understood that the above-described embodiments are merely illustrative of some, but not restrictive, of the broad invention, and that the appended drawings illustrate preferred embodiments of the invention and do not limit the scope of the invention. This application is capable of embodiments in many different forms and is provided for the purpose of enabling a thorough understanding of the disclosure of the application. Although the present application has been described in detail with reference to the foregoing embodiments, it will be apparent to one skilled in the art that the present application may be practiced without modification or with equivalents of some of the features described in the foregoing embodiments. All equivalent structures made by using the contents of the specification and the drawings of the present application are directly or indirectly applied to other related technical fields and are within the protection scope of the present application.
Claims (10)
1. A load balancing method for data access is applied to a cluster server, and is characterized in that the load balancing method for data access comprises the following steps:
receiving a first network request sent by a client through an external network;
performing address translation on the first network request to obtain a second network request;
performing hash scheduling on the URL in the second network request to obtain a node server corresponding to each request in the second network request as a candidate server;
carrying out availability detection on each candidate server, and determining a target server based on the obtained detection result;
responding, with each of the target servers, to each of the second network requests.
2. The method of load balancing data access according to claim 1, wherein address translating the first network request to obtain a second network request comprises:
acquiring a source address and a target address corresponding to the first network request;
identifying an address type of the source address and the destination address;
and converting the source address into a source address of a preset type and a target address of the preset type based on a preset type conversion mode to obtain a second network request.
3. The method for load balancing data access according to claim 2, wherein the predetermined type is IPv6 type, at least one of the address types of the source address and the destination address is not IPv6 type, and the converting into the source address of the predetermined type and the destination address of the predetermined type based on the predetermined type conversion manner to obtain the second network request includes:
taking the source address and/or the target address of which the address type is not the IPv6 type as an address to be converted;
carrying out hexadecimal conversion on the address to be converted to obtain a converted address, wherein the converted address comprises four groups;
merging the first group and the second group of the conversion address to be used as an updated first group, merging the third group and the fourth group of the conversion address to obtain an updated second group, and sequentially combining the updated first group and the updated second group to obtain an updated conversion address;
and performing zero padding processing on 96 bits before the updated translation address to obtain the source address of the preset type and/or the target address of the preset type, and generating the second network request based on the source address of the preset type and/or the target address of the preset type and the first network request.
4. The method for load balancing of data access according to claim 1, wherein performing hash scheduling on the URL in the second network request to obtain a node server corresponding to each request in the second network request, and using the node server as a candidate server includes:
performing hash calculation on each URL in the second network request to obtain a hash result;
and acquiring a preset hash mapping table, determining a node server corresponding to each URL based on the hash result and the preset mapping relation table, and taking the node server corresponding to each URL as the candidate server.
5. The method for load balancing data access according to claim 1, wherein said detecting availability of each of said candidate servers comprises:
sending a heartbeat packet detection instruction to each candidate server based on cluster communication;
and determining the node state corresponding to each candidate server according to the feedback result of each candidate server for the heartbeat packet detection instruction, wherein the node state is used as the detection result of the availability detection.
6. A load balancing apparatus for data access, the load balancing apparatus for data access comprising:
the request receiving module is used for receiving a first network request sent by a client through an external network;
the address translation module is used for carrying out address translation on the first network request to obtain a second network request;
the request scheduling module is used for performing hash scheduling on the URL in the second network request to obtain a node server corresponding to each request in the second network request as a candidate server;
the performance monitoring module is used for carrying out availability detection on each candidate server and determining a target server based on the obtained detection result;
a request response module, configured to respond to each request in the second network requests with each target server.
7. The apparatus for load balancing of data accesses according to claim 6, wherein the address translation module comprises:
the address acquisition unit is used for acquiring a source address and a target address corresponding to the first network request;
a type identifying unit for identifying address types of the source address and the destination address;
and the address conversion unit is used for converting the source address into a source address of a preset type and converting the source address into a target address of the preset type based on a preset type conversion mode to obtain the second network request.
8. The apparatus for load balancing data access according to claim 7, wherein the preset type is an IPv6 type, and at least one of the address types of the source address and the destination address is not an IPv6 type, and the address translation unit includes:
the address to be converted determining subunit is configured to use the source address and/or the destination address of which the address type is not the IPv6 type as the address to be converted;
the system conversion subunit is used for carrying out hexadecimal conversion on the address to be converted to obtain a conversion address, and the conversion address comprises four groups;
a merging subunit, configured to merge the first group and the second group of the translation address to serve as an updated first group, merge the third group and the fourth group of the translation address to obtain an updated second group, and sequentially combine the updated first group and the updated second group to obtain an updated translation address;
and the address completion subunit is configured to perform zero filling processing on 96 bits before the updated converted address to obtain the source address of the preset type and/or the target address of the preset type, and generate the second network request based on the source address of the preset type and/or the target address of the preset type and the first network request.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements a load balancing method of data access according to any of claims 1 to 5 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored, which, when being executed by a processor, carries out a method of load balancing of data access according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111063653.0A CN113890879B (en) | 2021-09-10 | 2021-09-10 | Load balancing method and device for data access, computer equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111063653.0A CN113890879B (en) | 2021-09-10 | 2021-09-10 | Load balancing method and device for data access, computer equipment and medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113890879A true CN113890879A (en) | 2022-01-04 |
CN113890879B CN113890879B (en) | 2023-12-29 |
Family
ID=79008800
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111063653.0A Active CN113890879B (en) | 2021-09-10 | 2021-09-10 | Load balancing method and device for data access, computer equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113890879B (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114827163A (en) * | 2022-05-07 | 2022-07-29 | 金腾科技信息(深圳)有限公司 | Server load balancing processing method, device, equipment and storage medium |
CN114978660A (en) * | 2022-05-17 | 2022-08-30 | 阿里巴巴(中国)有限公司 | Out-of-band network construction method and out-of-band processing method based on out-of-band network |
CN116820787A (en) * | 2023-08-31 | 2023-09-29 | 湖北芯擎科技有限公司 | Load balancing method, load balancing device, electronic equipment and computer readable storage medium |
CN114978660B (en) * | 2022-05-17 | 2024-04-19 | 阿里巴巴(中国)有限公司 | Out-of-band network construction method and out-of-band processing method based on out-of-band network |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006301769A (en) * | 2005-04-18 | 2006-11-02 | Hitachi Information Technology Co Ltd | Server device |
CN103023797A (en) * | 2011-09-23 | 2013-04-03 | 百度在线网络技术(北京)有限公司 | Data center system and device and method for providing service |
CN103428229A (en) * | 2012-05-14 | 2013-12-04 | 百度在线网络技术(北京)有限公司 | Data center system and device and method for providing service |
US20150350155A1 (en) * | 2014-06-03 | 2015-12-03 | Manuel Diaz | Systems and methods for ip sharing across wide area networks |
CN109218219A (en) * | 2018-10-15 | 2019-01-15 | 迈普通信技术股份有限公司 | A kind of load-balancing method, device, the network equipment and storage medium |
CN109936635A (en) * | 2019-03-12 | 2019-06-25 | 北京百度网讯科技有限公司 | Load-balancing method and device |
CN112866433A (en) * | 2021-01-22 | 2021-05-28 | 京东数字科技控股股份有限公司 | Message load balancing processing method and device and computer equipment |
CN113242331A (en) * | 2021-05-11 | 2021-08-10 | 鸬鹚科技(深圳)有限公司 | Different types of address translation methods, different types of address translation devices, different types of computer equipment and different types of storage media |
CN113259428A (en) * | 2021-05-11 | 2021-08-13 | 鸬鹚科技(深圳)有限公司 | Data access request processing method and device, computer equipment and medium |
-
2021
- 2021-09-10 CN CN202111063653.0A patent/CN113890879B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006301769A (en) * | 2005-04-18 | 2006-11-02 | Hitachi Information Technology Co Ltd | Server device |
CN103023797A (en) * | 2011-09-23 | 2013-04-03 | 百度在线网络技术(北京)有限公司 | Data center system and device and method for providing service |
CN103428229A (en) * | 2012-05-14 | 2013-12-04 | 百度在线网络技术(北京)有限公司 | Data center system and device and method for providing service |
US20150350155A1 (en) * | 2014-06-03 | 2015-12-03 | Manuel Diaz | Systems and methods for ip sharing across wide area networks |
CN109218219A (en) * | 2018-10-15 | 2019-01-15 | 迈普通信技术股份有限公司 | A kind of load-balancing method, device, the network equipment and storage medium |
CN109936635A (en) * | 2019-03-12 | 2019-06-25 | 北京百度网讯科技有限公司 | Load-balancing method and device |
CN112866433A (en) * | 2021-01-22 | 2021-05-28 | 京东数字科技控股股份有限公司 | Message load balancing processing method and device and computer equipment |
CN113242331A (en) * | 2021-05-11 | 2021-08-10 | 鸬鹚科技(深圳)有限公司 | Different types of address translation methods, different types of address translation devices, different types of computer equipment and different types of storage media |
CN113259428A (en) * | 2021-05-11 | 2021-08-13 | 鸬鹚科技(深圳)有限公司 | Data access request processing method and device, computer equipment and medium |
Non-Patent Citations (3)
Title |
---|
TIEN-THINH NGUYEN ET AL.: "Load balancing mechanism for proxy mobile IPV6 networks: An IP multicast perspective", 《2014 INTERNATIONAL CONFERENCE ON COMPUTING, NETWORKING AND COMMUNICATIONS(ICNC)》 * |
王靓宇: "IPv4和IPv6双域互通初探", 《中国新闻技术工作者联合会2020年学术年会论文集》 * |
肖辽亮: "NAT-PT簇负载均衡系统的研究与实现", 《硕士学位论文》 * |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114827163A (en) * | 2022-05-07 | 2022-07-29 | 金腾科技信息(深圳)有限公司 | Server load balancing processing method, device, equipment and storage medium |
CN114978660A (en) * | 2022-05-17 | 2022-08-30 | 阿里巴巴(中国)有限公司 | Out-of-band network construction method and out-of-band processing method based on out-of-band network |
CN114978660B (en) * | 2022-05-17 | 2024-04-19 | 阿里巴巴(中国)有限公司 | Out-of-band network construction method and out-of-band processing method based on out-of-band network |
CN116820787A (en) * | 2023-08-31 | 2023-09-29 | 湖北芯擎科技有限公司 | Load balancing method, load balancing device, electronic equipment and computer readable storage medium |
CN116820787B (en) * | 2023-08-31 | 2023-12-15 | 湖北芯擎科技有限公司 | Load balancing method, load balancing device, electronic equipment and computer readable storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN113890879B (en) | 2023-12-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108462760B (en) | Electronic device, automatic cluster access domain name generation method and storage medium | |
US11509505B2 (en) | Method and apparatus for operating smart network interface card | |
CN107547595B (en) | Cloud resource scheduling system, method and device | |
CN113259428A (en) | Data access request processing method and device, computer equipment and medium | |
CN110784515B (en) | Data storage method based on distributed cluster and related equipment thereof | |
CN110908770A (en) | Operation and creation method of virtual machine, virtual machine and virtual machine management platform | |
CN113890879A (en) | Load balancing method and device for data access, computer equipment and medium | |
CN115277566B (en) | Load balancing method and device for data access, computer equipment and medium | |
CN114095567B (en) | Data access request processing method and device, computer equipment and medium | |
CN111752770A (en) | Service request processing method, system, computer device and storage medium | |
CN113242331A (en) | Different types of address translation methods, different types of address translation devices, different types of computer equipment and different types of storage media | |
CN111224878B (en) | Route forwarding method and device, electronic equipment and storage medium | |
CN113259479A (en) | Data processing method and equipment | |
CN113992382B (en) | Service data processing method and device, electronic equipment and storage medium | |
CN114827161A (en) | Service calling request sending method and device, electronic equipment and readable storage medium | |
CN110995542B (en) | Network state detection method, system and related equipment | |
CN114124883B (en) | Data access method and device based on cloud storage address, computer equipment and medium | |
CN113239396A (en) | Data access system, method, device, computer equipment and medium | |
CN114968822A (en) | Interface testing method and device, computer equipment and storage medium | |
CN109308288A (en) | Data processing method and device | |
CN114281774A (en) | Log identification method and device, electronic equipment and storage medium | |
CN113242302A (en) | Data access request processing method and device, computer equipment and medium | |
CN113986995A (en) | Request distribution method and device, storage medium and electronic equipment | |
CN103051607B (en) | Access method, equipment and system | |
CN113242299A (en) | Disaster recovery system, method, computer device and medium for multiple data centers |
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 |