CN114285857A - Load balancing method, device and system - Google Patents
Load balancing method, device and system Download PDFInfo
- Publication number
- CN114285857A CN114285857A CN202111682020.8A CN202111682020A CN114285857A CN 114285857 A CN114285857 A CN 114285857A CN 202111682020 A CN202111682020 A CN 202111682020A CN 114285857 A CN114285857 A CN 114285857A
- Authority
- CN
- China
- Prior art keywords
- service
- user account
- information
- account creation
- server
- 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 57
- 238000012545 processing Methods 0.000 claims abstract description 53
- 230000008569 process Effects 0.000 claims abstract description 20
- 230000004044 response Effects 0.000 claims description 33
- 238000004590 computer program Methods 0.000 claims description 8
- 238000001914 filtration Methods 0.000 claims description 4
- 238000007726 management method Methods 0.000 abstract 2
- 238000004891 communication Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 4
- 238000000926 separation method Methods 0.000 description 4
- 238000011161 development Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 3
- 230000004069 differentiation Effects 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 206010033799 Paralysis Diseases 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
Images
Classifications
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D30/00—Reducing energy consumption in communication networks
- Y02D30/50—Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate
Abstract
The application discloses a load balancing method, a device and a system. The method comprises the steps of creating a service request according to a user account, polling according to a preset load balancing strategy and selecting a gateway service server for access, wherein the user account creation service request is used for registering service information on the gateway service server to obtain registration information; matching the registration information, and selecting a server of the user account creation service to access according to a preset load balancing strategy configured in advance during service information registration; performing business processing based on the accounting service in the process of performing the user account creation service; and returning the result of the business processing to the client sending the user account creation service request. The server load management method and the server load management system solve the technical problem that server pressure is caused by massive service requests. By the method and the device, the high service bearing capacity is achieved, and the requirements of high concurrency and high availability of services are met.
Description
Technical Field
The present application relates to the field of network services, and in particular, to a load balancing method, apparatus, and system.
Background
The user access to the system is a request to the network service provided by the same server.
For the related technology, the server has low bearing capacity, single point failure is easy to occur, the service is stopped after the service is down, the system is paralyzed, and the efficiency is influenced by the service restart time. Meanwhile, as the service grows, the increasing user access volume cannot be met.
Aiming at the problem that server pressure is caused by massive service requests in the related technology, an effective solution is not provided at present.
Disclosure of Invention
The present application mainly aims to provide a load balancing method, device and system to solve the problem of server stress caused by massive service requests.
To achieve the above object, according to one aspect of the present application, a load balancing method is provided.
The load balancing method comprises the following steps: polling according to a user account creation service request and a preset load balancing strategy and selecting a gateway service server for access, wherein the user account creation service request is used for registering service information on the gateway service server to obtain registration information; matching the registration information, and selecting a server of the user account creation service to access according to a preset load balancing strategy configured in advance during service information registration; performing business processing based on the accounting service in the process of performing the user account creation service; and returning the result of the business processing to the client sending the user account creation service request.
Further, the user account creation service includes: based on OpenFeign in a SpringCloud framework, a Ribbon service is adopted at the bottom layer; acquiring registration information of the accounting service based on a Nacos service registration center, and simultaneously determining a piece of service registration information to carry out HTTP request in the registration information of the accounting service, wherein the accounting service and the user account creation service carry out service information registration in the Nacos service registration center, and the service information at least comprises one of the following: IP, port, service name.
Further, a reverse proxy is made by Nginx, the access addresses of a plurality of servers are proxied, wherein the servers at least comprise a server of gateway service, a user account creation server and an accounting server, and load balancing strategies of the Nginx comprise a random strategy, a polling strategy, a retry strategy, a minimum concurrency strategy, an available filtering strategy, a response time weighting strategy and a region weighting strategy.
Further, after performing business processing based on the accounting service in the process of performing the user account creation service, the method further includes: the user account creating service returns response information to the gateway service after receiving the response information of the accounting service; returning to the Nginx after the service response information is created based on the user account received by the gateway service; and returning to the user browser based on the response information received by the Nginx so that the user can obtain corresponding page information in the browser.
In order to achieve the above object, according to another aspect of the present application, there is provided a load balancing system including:
the load balancing system according to the application comprises: the Nginx reverse proxy service is used for providing a reverse proxy of a background service, and the background service at least comprises a gateway service, a user account creating service and an accounting service; the gateway service is used for matching the registration information of the user account creation service according to the context API information in the request address after receiving the request forwarded by the Nginx reverse proxy service; after the registration information of the user account creation service is matched, selecting a server of the user account creation service for access according to a load balancing strategy configured when the user account creation service is registered; the user account creating service is used for carrying out business processing after receiving the request of the gateway service, and is based on the accounting service in the business processing; the user account creating service acquires the registration information of the accounting service based on a Nacos service registration center; and the accounting service is used for performing service processing after receiving the user account creation service request, and returning corresponding response information to the user account creation service serving as the request client after the service processing is finished.
Further, the user account creation service is further configured to register service information in a gateway server, where the service information includes context crcl-open-api, service IP, a service port, a request address, a preset load balancing policy, and service grouping information; the gateway service is further configured to, after the gateway server receives the request forwarded by the nginnx reverse proxy service, perform registration information matching of the user account creation service according to the context crcl-open-api in the request address.
Further, the system further comprises: and the Nacos service registration center is used for acquiring the registration information of the accounting service based on the Nacos service registration center, and simultaneously determining a service registration information to carry out HTTP request in the registration information of the accounting service.
In order to achieve the above object, according to another aspect of the present application, there is provided a load balancing apparatus.
The load balancing device according to the application comprises: the system comprises a service access module, a gateway service module and a service processing module, wherein the service access module is used for polling according to a user account creation service request and a preset load balancing strategy and selecting a gateway service server for access, and the user account creation service request is used for registering service information on the gateway service server to obtain registration information; the registration information matching module is used for matching the registration information and selecting a server of the user account creation service to access according to a preset load balancing strategy configured in advance during the service information registration; the business processing module is used for carrying out business processing based on the accounting service in the process of carrying out the user account establishing service; and the return module is used for returning the service processing result to the client sending the user account creation service request.
In order to achieve the above object, according to yet another aspect of the present application, there is provided a computer-readable storage medium having a computer program stored therein, wherein the computer program is arranged to perform the method when executed.
In order to achieve the above object, according to yet another aspect of the present application, there is provided an electronic device comprising a memory and a processor, the memory having a computer program stored therein, the processor being configured to execute the computer program to perform the method.
In the load balancing method, the device and the system in the embodiment of the application, the service request is created according to the user account, polling according to a preset load balancing strategy and selecting a server of the gateway service for access, by matching the registration information and selecting a server of the user account creation service for access according to a preset load balancing strategy configured in advance during the registration of the service information, the purposes of performing business processing based on the accounting service in the process of performing the user account creation service and returning the result of the business processing to the client sending the user account creation service request are achieved, therefore, the technical effect of load balancing during service data access processing is realized, the transverse expansion is realized, the maintenance is easy, and the technical problem of server pressure caused by massive service requests is solved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this application, serve to provide a further understanding of the application and to enable other features, objects, and advantages of the application to be more apparent. The drawings and their description illustrate the embodiments of the invention and do not limit it. In the drawings:
fig. 1 is a schematic system structure diagram of a load balancing method according to an embodiment of the present application;
fig. 2 is a schematic flow chart of a load balancing method according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a load balancing apparatus according to an embodiment of the present application;
fig. 4 is a flowchart illustrating a load balancing method according to a preferred embodiment of the present application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, 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 partial embodiments of the present application, but not all 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.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the application described herein may be used. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In this application, the terms "upper", "lower", "left", "right", "front", "rear", "top", "bottom", "inner", "outer", "middle", "vertical", "horizontal", "lateral", "longitudinal", and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings. These terms are used primarily to better describe the present application and its embodiments, and are not used to limit the indicated devices, elements or components to a particular orientation or to be constructed and operated in a particular orientation.
Moreover, some of the above terms may be used to indicate other meanings besides the orientation or positional relationship, for example, the term "on" may also be used to indicate some kind of attachment or connection relationship in some cases. The specific meaning of these terms in this application will be understood by those of ordinary skill in the art as appropriate.
Furthermore, the terms "mounted," "disposed," "provided," "connected," and "sleeved" are to be construed broadly. For example, it may be a fixed connection, a removable connection, or a unitary construction; can be a mechanical connection, or an electrical connection; may be directly connected, or indirectly connected through intervening media, or may be in internal communication between two devices, elements or components. The specific meaning of the above terms in the present application can be understood by those of ordinary skill in the art as appropriate.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
As shown in fig. 1, it is a schematic diagram of a system structure of a load balancing method according to an embodiment of the present application, where the schematic diagram includes: nginnx reverse proxy service 100, gateway service 200, user account creation service 300, billing service 400. Correspondingly, the nginnx reverse proxy service 100, the gateway service 200, the user account creation service 300, and the billing service 400 correspond to physical servers, respectively.
The background services are deployed in multiple ways, the Nginx reverse proxy service 100 is used, and the Nginx load balancing strategy comprises polling, designated weight, ip binding (ip _ hash), fair and url _ hash.
The gateway service 200 may perform polling on different servers by using a preset policy.
The user account creation service 300 includes, but is not limited to, involving user account opening creation.
The billing services 400 include, but are not limited to, related to financial related billing services.
The financial relations mentioned above are mainly related to actual business scenarios, and are not used to limit the scope of protection of the present application.
And the background service is split according to the field, and the services are decoupled by using the idea of micro-service. And when the user accesses the background service, service differentiation is carried out. The user account creation service 300 is decoupled from the billing service 400, and different service access requests are carried according to the field, thereby realizing load balancing.
In an embodiment of the present application, a load balancing system is provided, including: the Nginx reverse proxy service 100 is used for providing a reverse proxy of a background service, wherein the background service at least comprises a gateway service, a user account creation service and an accounting service; the gateway service 200 is configured to perform registration information matching of the user account creation service according to context API information in a request address after receiving the request forwarded by the nginnx reverse proxy service; after the registration information of the user account creation service is matched, selecting a server of the user account creation service for access according to a load balancing strategy configured when the user account creation service is registered; a user account creation service 300, configured to perform business processing after receiving the request of the gateway service, and based on the billing service in the business processing; the user account creating service acquires the registration information of the accounting service based on a Nacos service registration center; and the accounting service 400 is configured to perform service processing after receiving the user account creation service request, and return corresponding response information to the user account creation service serving as the requesting client after the service processing is completed.
As a preferred preference in this embodiment, the user account creation service 300 is further configured to register service information in a gateway server, where the service information includes context crcl-open-api, a service IP, a service port, a request address, a preset load balancing policy, and service grouping information; the gateway service 200 is further configured to, after the gateway server receives the request forwarded by the nginnx reverse proxy service, perform registration information matching of the user account creation service according to the context crcl-open-api in the request address.
Preferably, in this embodiment, the Nacos service registration center is configured to obtain registration information of the billing service based on the Nacos service registration center, and perform an HTTP request by determining a piece of service registration information from the registration information of the billing service.
As shown in fig. 2, the method includes steps S201 to S205 as follows:
step S201, according to a user account creation service request, polling is carried out according to a preset load balancing strategy, and a server of a gateway service is selected for access, wherein the user account creation service request is used for carrying out service information registration on the server of the gateway service to obtain registration information;
step S202, matching the registration information, and selecting a server of the user account creation service to access according to a preset load balancing strategy configured in advance during the service information registration;
step S203, performing business processing based on the accounting service in the process of performing the user account creation service;
step S204, returning the result of the business processing to the client sending the user account creation service request.
From the above description, it can be seen that the following technical effects are achieved by the present application:
by adopting a mode of creating a service request according to a user account, polling according to a preset load balancing strategy and selecting a server of gateway service for access, matching the registration information and selecting a server of the user account creation service for access according to the preset load balancing strategy configured in advance during service information registration, the purposes of performing service processing based on the accounting service in the process of performing the user account creation service and returning the result of the service processing to the client sending the user account creation service request are achieved, so that the technical effect of load balancing during service data access processing is realized, and the technical problem that server pressure is caused by massive service requests is solved.
In step S201, a service request is created at the server according to the user account, polling is performed according to a preset load balancing policy, and a server of the gateway service is selected for access. The user account creation service request is requested by a client. Polling is carried out at the server side according to a preset load balancing strategy, and a server of gateway service is selected for access.
In a specific embodiment, the user account creation service request is used for registering service information on a server of the gateway service to obtain registration information.
In a preferred embodiment, service information registration may be performed in advance.
In the step S202, the registration information is matched at the server, and a server of the user account creation service is selected for access according to a preset load balancing policy configured in advance when the service information is registered.
In a specific embodiment, the service information is registered with a preset load balancing policy configured in advance.
In a preferred embodiment, the server selects a server of the user account creation service to access through the gateway. The user account creation service is related to a specific service scenario, and is not specifically limited in this application. It can be understood that the user account creation service needs to meet a preset condition and is obtained after service separation.
In the step S203, the service end performs service processing based on the accounting service in the process of performing the user account creation service. The billing service is associated with a specific business scenario and is not specifically limited in this application. It can be understood that the billing service needs to satisfy the preset condition and is obtained after the service separation.
In one embodiment, after the internal transaction is processed by the billing service, the processing result is returned to the user account creation service.
In a preferred embodiment, the user account creation service registers service information with a gateway server.
In the step S204, the server returns the result of the service processing to the client that issued the user account creation service request.
In one embodiment, after the user account creation service processes the internal traffic, the processing result is returned to the gateway service.
In a preferred embodiment, the Nginx reverse proxy receives a response and returns the response to the browser of the user, and the user can obtain corresponding page information in the browser.
As a preferred option in this embodiment, the user account creation service includes: based on OpenFeign in a SpringCloud framework, a Ribbon service is adopted at the bottom layer; acquiring registration information of the accounting service based on a Nacos service registration center, and simultaneously determining a piece of service registration information to carry out HTTP request in the registration information of the accounting service, wherein the accounting service and the user account creation service carry out service information registration in the Nacos service registration center, and the service information at least comprises one of the following: IP, port, service name.
In the specific implementation, firstly: based on OpenFeign in a SpringCloud framework, a Ribbon service is adopted at the bottom layer, and a user account creating service is opened.
Secondly, the method comprises the following steps: and acquiring the registration information of the accounting service based on a Nacos service registration center, and simultaneously performing HTTP request by determining any service registration information in the registration information of the accounting service.
Further, the accounting service and the user account creation service register service information in the Nacos service registration center. Wherein the service information includes at least one of: IP, port, service name. It can be understood that at least one of the following information needs to be provided in the registration process of the service information: IP, port, service name.
As a preference in this embodiment, the method further includes: the method comprises the steps that Nginx is adopted as a reverse proxy to proxy access addresses of a plurality of servers, wherein the servers at least comprise a server of gateway service, a user account creation server and a billing server, and load balancing strategies of the Nginx comprise a random strategy, a polling strategy, a retry strategy, a minimum concurrency strategy, an available filtering strategy, a response time weighting strategy and a region weight strategy.
In specific implementation, Nginx is used as a reverse proxy to proxy the access addresses of a plurality of servers. The reverse proxy is made of Nginx, and Nginx load balancing strategies comprise polling, weight assignment, ip binding (ip _ hash), fair and url _ hash. And completing the filling of the ip and the port of the gateway service in the Nginx configuration file. When the user account creation service is performed, the Nginx selects one gateway service to access according to a polling load balancing strategy according to a user request.
As a preferable example in this embodiment, after performing service processing based on the accounting service in the process of performing the user account creation service, the method further includes: the user account creating service returns response information to the gateway service after receiving the response information of the accounting service; returning to the Nginx after the service response information is created based on the user account received by the gateway service; and returning to the user browser based on the response information received by the Nginx so that the user can obtain corresponding page information in the browser.
In specific implementation, after receiving the response information of the accounting service, the user account creation service returns the response information to the gateway service. Further, after creating service response information based on the user account received by the gateway service, returning to the Nginx. And finally, returning to the user browser based on the response information received by the Nginx so that the user can obtain corresponding page information in the browser. The Nginx service and the gateway service adopt a conventional background service architecture, and the user account creation service and the accounting service can be mutually called based on the micro service architecture.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than presented herein.
According to an embodiment of the present application, there is also provided a load balancing apparatus for implementing the above method, as shown in fig. 3, the apparatus includes:
the service access module 301 is configured to create a service request according to a user account, perform polling according to a preset load balancing policy, and select a server of a gateway service to access, where the service request created by the user account is used to register service information on the server of the gateway service to obtain registration information;
a registration information matching module 302, configured to match the registration information, and select a server of the user account creation service to access according to a preset load balancing policy preconfigured in the service information registration;
a service processing module 303, configured to perform service processing based on the accounting service in the process of performing the user account creation service;
a returning module 304, configured to return the result of the business processing to the client that issued the user account creation service request.
In the service access module 301, a service request is created at a service end according to a user account, polling is performed according to a preset load balancing policy, and a server of a gateway service is selected for access. The user account creation service request is requested by a client. Polling is carried out at the server side according to a preset load balancing strategy, and a server of gateway service is selected for access.
In a specific embodiment, the user account creation service request is used for registering service information on a server of the gateway service to obtain registration information.
In a preferred embodiment, service information registration may be performed in advance.
The registration information matching module 302 matches the registration information at the server side, and selects a server of the user account creation service to access according to a preset load balancing policy configured in advance during the service information registration.
In a specific embodiment, the service information is registered with a preset load balancing policy configured in advance.
In a preferred embodiment, the server selects a server of the user account creation service to access through the gateway. The user account creation service is related to a specific service scenario, and is not specifically limited in this application. It can be understood that the user account creation service needs to meet a preset condition and is obtained after service separation.
The service end in the service processing module 303 performs service processing based on the accounting service in the process of performing the user account creation service. The billing service is associated with a specific business scenario and is not specifically limited in this application. It can be understood that the billing service needs to satisfy the preset condition and is obtained after the service separation.
In one embodiment, after the internal transaction is processed by the billing service, the processing result is returned to the user account creation service.
In a preferred embodiment, the user account creation service registers service information with a gateway server.
The service end in the returning module 304 returns the result of the service processing to the client end that sent the user account creation service request.
In one embodiment, after the user account creation service processes the internal traffic, the processing result is returned to the gateway service.
In a preferred embodiment, the Nginx reverse proxy receives a response and returns the response to the browser of the user, and the user can obtain corresponding page information in the browser.
It will be apparent to those skilled in the art that the modules or steps of the present application described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and they may alternatively be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, or fabricated separately as individual integrated circuit modules, or fabricated as a single integrated circuit module from multiple modules or steps. Thus, the present application is not limited to any specific combination of hardware and software.
In order to better understand the above-mentioned load balancing method flow, the following explains the above-mentioned technical solutions with reference to the preferred embodiments, but the technical solutions of the embodiments of the present invention are not limited.
According to the load balancing method in the embodiment of the application, the software load balancing is realized by introducing a new Nginx and spring cloud technology. The problem of single-point centralized deployment is solved, the service bearing capacity is improved, and the requirements of high concurrency and high availability are met. The method in the application is easy to expand transversely, adopts a distributed technology, can expand transversely and is easy to maintain. In addition, the method also has the characteristics of high availability and high concurrency.
Fig. 4 is a schematic flow chart of the load balancing method in the embodiment of the present application, and details are described by taking the user account creation service as a cloud trust establishing service, and taking the billing service as a cloud trust billing service as an example. The specific process comprises the following steps:
and services are split according to the field, and services are decoupled by using the idea of micro services. And when the user accesses the background service, service differentiation is carried out. The cloud letter development service is decoupled from the cloud letter payment service. And carrying different service access requests according to the fields to realize load balancing. The cloud letter development service and the gateway service deploy multiple points, and the pressure of a single server is reduced. The throughput is improved.
Step S1, background services are deployed, Nginx is used as a reverse proxy, and Nginx load balancing strategies comprise polling, weight assignment, IP binding (IP _ hash), fair and url _ hash.
Step S2, completing the filling of the ip and the port of the gateway service in the Nginx configuration file.
Step S3, when the user performs the cloud communication opening service, the nginn selects a gateway service for access according to the polling load balancing policy according to the user request.
Step S4, the cloud cover establishment service registers service information in the gateway server. Including context crcl-open-api, service IP, service port, request address, load balancing policy (polling load balancing policy or random load balancing policy), service grouping information.
In step S5, after receiving the request forwarded by Nginx, the gateway server will, according to the context in the request address: and the crcl-open-api performs registration information matching of the cloud trust opening and closing service.
And step S6, the gateway service matches the registration information of the cloud trust establishment service, and selects a cloud trust establishment service to access according to the load balancing strategy configured during the registration of the trust establishment service.
Step S7, after the request of the gateway service is received by the cloud cover establishment service, the service processing is performed. And the cloud communication accounting service is relied on in the service processing.
And step S8, the cloud credit accounting service and the cloud credit opening service register service information in a Nacos registration center, wherein the service information comprises IP, ports and service names.
Step S9, OpenFeign in a SpringCloud framework is used in the cloud establishment service; the bottom layer uses the Ribbon service. The load balancing supports a random strategy, a polling strategy, a retry strategy, a minimum concurrency strategy, an available filtering strategy, a response time weighting strategy and a region weighting strategy.
And step S10, the cloud letter development service goes to the Nacos service registration center to obtain the registration information of the cloud letter billing service. The cloud trust establishment service serves as a software client, and a polling load balancing strategy of Ribbon is used as a default. And selecting service registration information from the registration information of the cloud information billing service. An HTTP request is made.
And step S11, after the cloud communication accounting service receives the request, performing service processing. And after the service processing is finished, returning corresponding response information to the requesting client for the cloud letter establishment service.
And step S12, the cloud letter opening service receives the cloud letter accounting service response information, and returns the response information to the gateway service after the internal service is processed.
In step S13, the gateway service returns the information to Nginx after receiving the information of the cloud letter establishment service response.
In step S14, the nginnx receives the response and returns the response to the user browser, and the user can obtain corresponding page information in the browser.
The above description is only a preferred embodiment of the present application and is not intended to limit the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims (10)
1. A method of load balancing, comprising:
polling according to a user account creation service request and a preset load balancing strategy and selecting a gateway service server for access, wherein the user account creation service request is used for registering service information on the gateway service server to obtain registration information;
matching the registration information, and selecting a server of the user account creation service to access according to a preset load balancing strategy configured in advance during service information registration;
performing business processing based on the accounting service in the process of performing the user account creation service;
and returning the result of the business processing to the client sending the user account creation service request.
2. The method of claim 1, wherein the user account creation service comprises:
based on OpenFeign in a SpringCloud framework, a Ribbon service is adopted at the bottom layer;
acquiring registration information of the accounting service based on a Nacos service registration center, and simultaneously determining a piece of service registration information to carry out HTTP request in the registration information of the accounting service, wherein the accounting service and the user account creation service carry out service information registration in the Nacos service registration center, and the service information at least comprises one of the following: IP, port, service name.
3. The method of claim 2, further comprising:
the method comprises the steps that Nginx is adopted as a reverse proxy to proxy access addresses of a plurality of servers, wherein the servers at least comprise a server of gateway service, a user account creation server and a billing server, and load balancing strategies of the Nginx comprise a random strategy, a polling strategy, a retry strategy, a minimum concurrency strategy, an available filtering strategy, a response time weighting strategy and a region weight strategy.
4. The method of claim 3, wherein after performing business processing based on the billing service in the process of performing the user account creation service, further comprising:
the user account creating service returns response information to the gateway service after receiving the response information of the accounting service;
returning to the Nginx after the service response information is created based on the user account received by the gateway service;
and returning to the user browser based on the response information received by the Nginx so that the user can obtain corresponding page information in the browser.
5. A load balancing system, comprising:
the Nginx reverse proxy service is used for providing a reverse proxy of a background service, and the background service at least comprises a gateway service, a user account creating service and an accounting service;
the gateway service is used for matching the registration information of the user account creation service according to the context API information in the request address after receiving the request forwarded by the Nginx reverse proxy service;
after the registration information of the user account creation service is matched, selecting a server of the user account creation service for access according to a load balancing strategy configured when the user account creation service is registered;
the user account creating service is used for carrying out business processing after receiving the request of the gateway service, and is based on the accounting service in the business processing;
the user account creating service acquires the registration information of the accounting service based on a Nacos service registration center;
and the accounting service is used for performing service processing after receiving the user account creation service request, and returning corresponding response information to the user account creation service serving as the request client after the service processing is finished.
6. The system of claim 5, wherein:
the user account creation service is further operable to,
registering service information at a gateway server, wherein the service information comprises context crcl-open-api, a service IP, a service port, a request address, a preset load balancing strategy and service grouping information;
the gateway service, further configured to,
after the gateway server receives the request forwarded by the Nginx reverse proxy service, the registration information matching of the user account creation service is carried out according to the context crcl-open-api in the request address.
7. The system of claim 5, wherein the Nacos service registry is further configured to use
And the Nacos-based service registration center is used for acquiring the registration information of the accounting service and simultaneously determining a service registration information to carry out HTTP request in the registration information of the accounting service.
8. A load balancing apparatus, comprising:
the system comprises a service access module, a gateway service module and a service processing module, wherein the service access module is used for polling according to a user account creation service request and a preset load balancing strategy and selecting a gateway service server for access, and the user account creation service request is used for registering service information on the gateway service server to obtain registration information;
the registration information matching module is used for matching the registration information and selecting a server of the user account creation service to access according to a preset load balancing strategy configured in advance during the service information registration;
the business processing module is used for carrying out business processing based on the accounting service in the process of carrying out the user account establishing service;
and the return module is used for returning the service processing result to the client sending the user account creation service request.
9. A computer-readable storage medium, in which a computer program is stored, wherein the computer program is arranged to, when executed, perform the method of any of claims 1 to 4.
10. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, and wherein the processor is arranged to execute the computer program to perform the method of any of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111682020.8A CN114285857B (en) | 2021-12-31 | 2021-12-31 | Load balancing method, device and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111682020.8A CN114285857B (en) | 2021-12-31 | 2021-12-31 | Load balancing method, device and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114285857A true CN114285857A (en) | 2022-04-05 |
CN114285857B CN114285857B (en) | 2024-01-26 |
Family
ID=80879965
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111682020.8A Active CN114285857B (en) | 2021-12-31 | 2021-12-31 | Load balancing method, device and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114285857B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114978813A (en) * | 2022-04-12 | 2022-08-30 | 浙江数新网络有限公司 | Gateway implementation method based on response type thread pool |
Citations (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP5322072B1 (en) * | 2013-01-31 | 2013-10-23 | 株式会社アットシステム | Numbered ticket issuing system for web access |
CN103428166A (en) * | 2012-05-16 | 2013-12-04 | 腾讯科技(深圳)有限公司 | Multi-SNS platform unified access method and system applied by third party |
CN105392116A (en) * | 2014-08-22 | 2016-03-09 | 思科技术公司 | System and method for location reporting in an untrusted network environment |
US20160301566A1 (en) * | 2015-04-10 | 2016-10-13 | Comcast Cable Communications, Llc | Virtual gateway control and management |
CN107317887A (en) * | 2017-08-23 | 2017-11-03 | 北京知道创宇信息技术有限公司 | A kind of load-balancing method, device and system |
CN108509507A (en) * | 2018-02-11 | 2018-09-07 | 北京原点时空信息技术有限公司 | The account management system and its implementation of unified entrance |
CN109271776A (en) * | 2018-10-22 | 2019-01-25 | 努比亚技术有限公司 | Micro services system single-point logging method, server and computer readable storage medium |
CN110417886A (en) * | 2019-07-29 | 2019-11-05 | 广州竞远安全技术股份有限公司 | A kind of load-balancing method of integrated service, apparatus and system |
CN111049901A (en) * | 2019-12-11 | 2020-04-21 | 深圳市优必选科技股份有限公司 | Load balancing method, load balancing system and registration server |
CN111371825A (en) * | 2018-12-26 | 2020-07-03 | 深圳市优必选科技有限公司 | Load balancing method, device and equipment based on HTTP2.0 protocol |
CN111475283A (en) * | 2020-03-08 | 2020-07-31 | 苏州浪潮智能科技有限公司 | Load balancing method and system based on OpenStack bare computer |
CN112256351A (en) * | 2020-10-26 | 2021-01-22 | 卫宁健康科技集团股份有限公司 | Implementation method of Feign component, micro-service calling method and device |
CN112416960A (en) * | 2020-11-18 | 2021-02-26 | 腾讯科技(深圳)有限公司 | Data processing method, device and equipment under multiple scenes and storage medium |
CN112788124A (en) * | 2020-12-31 | 2021-05-11 | 中科星通(廊坊)信息技术有限公司 | Distributed registration service method and device for remote sensing image |
CN113194143A (en) * | 2021-04-30 | 2021-07-30 | 支付宝(杭州)信息技术有限公司 | Block chain account creating method and device and electronic equipment |
-
2021
- 2021-12-31 CN CN202111682020.8A patent/CN114285857B/en active Active
Patent Citations (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103428166A (en) * | 2012-05-16 | 2013-12-04 | 腾讯科技(深圳)有限公司 | Multi-SNS platform unified access method and system applied by third party |
JP5322072B1 (en) * | 2013-01-31 | 2013-10-23 | 株式会社アットシステム | Numbered ticket issuing system for web access |
CN105392116A (en) * | 2014-08-22 | 2016-03-09 | 思科技术公司 | System and method for location reporting in an untrusted network environment |
US20160301566A1 (en) * | 2015-04-10 | 2016-10-13 | Comcast Cable Communications, Llc | Virtual gateway control and management |
CN107317887A (en) * | 2017-08-23 | 2017-11-03 | 北京知道创宇信息技术有限公司 | A kind of load-balancing method, device and system |
CN108509507A (en) * | 2018-02-11 | 2018-09-07 | 北京原点时空信息技术有限公司 | The account management system and its implementation of unified entrance |
CN109271776A (en) * | 2018-10-22 | 2019-01-25 | 努比亚技术有限公司 | Micro services system single-point logging method, server and computer readable storage medium |
CN111371825A (en) * | 2018-12-26 | 2020-07-03 | 深圳市优必选科技有限公司 | Load balancing method, device and equipment based on HTTP2.0 protocol |
CN110417886A (en) * | 2019-07-29 | 2019-11-05 | 广州竞远安全技术股份有限公司 | A kind of load-balancing method of integrated service, apparatus and system |
CN111049901A (en) * | 2019-12-11 | 2020-04-21 | 深圳市优必选科技股份有限公司 | Load balancing method, load balancing system and registration server |
CN111475283A (en) * | 2020-03-08 | 2020-07-31 | 苏州浪潮智能科技有限公司 | Load balancing method and system based on OpenStack bare computer |
CN112256351A (en) * | 2020-10-26 | 2021-01-22 | 卫宁健康科技集团股份有限公司 | Implementation method of Feign component, micro-service calling method and device |
CN112416960A (en) * | 2020-11-18 | 2021-02-26 | 腾讯科技(深圳)有限公司 | Data processing method, device and equipment under multiple scenes and storage medium |
CN112788124A (en) * | 2020-12-31 | 2021-05-11 | 中科星通(廊坊)信息技术有限公司 | Distributed registration service method and device for remote sensing image |
CN113194143A (en) * | 2021-04-30 | 2021-07-30 | 支付宝(杭州)信息技术有限公司 | Block chain account creating method and device and electronic equipment |
Non-Patent Citations (2)
Title |
---|
李晖阳: "一种支持跨平台多接入的高性能Web AR服务系统研究与实现", 《中国优秀硕士学位论文全文数据库》 * |
艾艾猫DORI: "springcloud组件之三:Ribbon(轮询和随机负载)", 《HTTPS://BLOG.CSDN.NET/M0_45899013/ARTICLE/DETAILS/107645876》 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114978813A (en) * | 2022-04-12 | 2022-08-30 | 浙江数新网络有限公司 | Gateway implementation method based on response type thread pool |
Also Published As
Publication number | Publication date |
---|---|
CN114285857B (en) | 2024-01-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP2633667B1 (en) | System and method for on the fly protocol conversion in obtaining policy enforcement information | |
CN110149397A (en) | A kind of micro services integration method and device | |
CN106067858B (en) | Communication means, apparatus and system between container | |
US10554741B1 (en) | Point to node in a multi-tiered middleware environment | |
CN112738284B (en) | Data transmission method, device, equipment and storage medium in service integration | |
US9973470B2 (en) | Systems and methods for faster download of digital content in mobile wireless devices | |
US7836484B2 (en) | Method and apparatus for providing access to an identity service | |
CN108200018B (en) | Flow forwarding method and equipment, computer equipment and readable medium in cloud computing | |
CN113645304B (en) | Data service processing method and related equipment | |
CN109981757B (en) | API gateway load balancing method for small-scale micro-service architecture | |
CN110377431A (en) | Service calling method and device under more registration center's scenes | |
CN112532683A (en) | Edge calculation method and device based on micro-service architecture | |
CN107172214A (en) | A kind of service node with load balancing finds method and device | |
CN114285857B (en) | Load balancing method, device and system | |
CN105071965B (en) | A kind of management system of the network equipment | |
US10015086B2 (en) | Multi GTM based routing to avoid latencies | |
CN107205020A (en) | Service load balancing method and system under Service-Oriented Architecture Based | |
CN109889625A (en) | Access method, equipment and the computer readable storage medium of server | |
CN107343285B (en) | Management equipment and equipment management method | |
CN106230925A (en) | A kind of access control method and device | |
CN109104482A (en) | A kind of distributed system of earth mat platform | |
CN114301648B (en) | Data configuration method and device, storage medium and electronic device | |
CN105871972A (en) | Video resource distributed cathe method, device and system | |
CN103619005B (en) | Method and system for obtaining cell phone number of 3G network user | |
CN110391996A (en) | A kind of block is linked into device, system, method and computer equipment |
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 |