[go: up one dir, main page]

CN114285857B - Load balancing method, device and system - Google Patents

Load balancing method, device and system Download PDF

Info

Publication number
CN114285857B
CN114285857B CN202111682020.8A CN202111682020A CN114285857B CN 114285857 B CN114285857 B CN 114285857B CN 202111682020 A CN202111682020 A CN 202111682020A CN 114285857 B CN114285857 B CN 114285857B
Authority
CN
China
Prior art keywords
service
user account
account creation
information
request
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.)
Active
Application number
CN202111682020.8A
Other languages
Chinese (zh)
Other versions
CN114285857A (en
Inventor
姜勇
杨雷
石京豪
吴豹只
李华洞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhongqi Scc Beijing Finance Information Service Co ltd
Original Assignee
Zhongqi Scc Beijing Finance Information Service Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhongqi Scc Beijing Finance Information Service Co ltd filed Critical Zhongqi Scc Beijing Finance Information Service Co ltd
Priority to CN202111682020.8A priority Critical patent/CN114285857B/en
Publication of CN114285857A publication Critical patent/CN114285857A/en
Application granted granted Critical
Publication of CN114285857B publication Critical patent/CN114285857B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL 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
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE 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/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Landscapes

  • Computer And Data Communications (AREA)

Abstract

The application discloses a load balancing method, device and system. The method comprises the steps of 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 for access according to a preset load balancing strategy which is preset when the service information is registered; business processing is carried out based on the billing service in the process of carrying out the user account creation service; and returning the service processing result to the client side which sends the user account creation service request. The method and the device solve the technical problem that massive service requests cause server pressure. The high service bearing capacity of the method and the device can meet the requirements of high concurrency and high availability of services.

Description

Load balancing method, device and system
Technical Field
The present invention relates to the field of network services, and in particular, to a load balancing method, device and system.
Background
The user access system requests the network service provided by the same server.
For the server in the related technology, the bearing capacity is not high, single-point faults are easy to occur, the service stops after the service is down, the system is paralyzed, and the service restarting time also affects the efficiency. Meanwhile, as services grow, an increasing amount of user access cannot be satisfied.
Aiming at the problem of server pressure caused by massive service requests in the related technology, no effective solution is proposed at present.
Disclosure of Invention
The main purpose of the application is to provide a load balancing method, device and system, so as to solve the problem of server pressure caused by massive service requests.
To achieve the above object, according to one aspect of the present application, there is provided a load balancing method.
The load balancing method comprises the following steps: 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; matching the registration information, and selecting a server of the user account creation service for access according to a preset load balancing strategy which is preset when the service information is registered; business processing is carried out based on the billing service in the process of carrying out the user account creation service; and returning the service processing result to the client side which sends the user account creation service request.
Further, the user account creation service includes: based on OpenFeign in SpringCloud framework, and using Ribbon service at bottom layer; acquiring registration information of the accounting service based on a Nacos service registration center, and simultaneously determining one piece of service registration information in the registration information of the accounting service to perform HTTP request, wherein the accounting service and the user account creation service perform 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, 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 the load balancing strategy of the Nginx comprises a random strategy, a polling strategy, a retry strategy, a lowest concurrency strategy, an available filtering strategy, a response time weighted weight strategy and an area weight strategy.
Further, after the business processing is performed based on the billing service in the process of performing the user account creation service, the method further comprises: after receiving the response information of the accounting service, the user account creation service returns the response information to the gateway service; after creating service response information based on the user account received by the gateway service, returning to the Nginx; and returning to the user browser based on the response information received by the Nginx, so that the user can acquire corresponding page information in the browser.
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 present 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 creation service and a billing service; gateway service, which is used for carrying out registration information matching 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, a server of the user account creation service is selected for access according to a load balancing strategy configured when the user account creation service is registered; a user account creation service for performing business processing after receiving the request of the gateway service, and based on the billing service in the business processing; the user account creation service obtains registration information of the billing service based on a Nacos service registration center; and the billing service is used for carrying out business processing after receiving the user account creation service request, and returning corresponding response information to the user account creation service serving as a request client after the business processing is finished.
Further, the user account creation service is further configured to register service information in the gateway server, where the service information includes a context crcl-open-api, a service IP, a service port, a request address, a preset load balancing policy, and service packet information; the gateway service is further configured to, after the gateway server receives a request forwarded by the nginnx reverse proxy service, perform registration information matching of the user account creation service according to a context crcl-open-api in a 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 one piece of service registration information in the registration information of the accounting service to carry out HTTP request.
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 present application comprises: the service access module is used for carrying out 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 carrying out service information registration 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 for access according to a preset load balancing strategy which is preset when the service information is registered; 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 creation service; and the return module is used for returning the result of the business processing to the client side which sends the user account creation service request.
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 configured to perform the method when run.
To achieve the above object, according to yet another aspect of the present application, there is provided an electronic device comprising a memory, in which a computer program is stored, and a processor arranged to run the computer program to perform the method.
According to the load balancing method, device and system, a mode of polling according to a user account creation service request and selecting a server of gateway service for access according to a preset load balancing strategy is adopted, the server of the user account creation service is selected for access according to the preset load balancing strategy which is preset when registration of service information is performed by matching registration information, service processing is performed based on the accounting service in the process of performing the user account creation service, and a result of the service processing is returned to a client side sending the user account creation service request, so that the technical effect of load balancing in service data access processing is achieved, the service is laterally expanded, the service is easy to maintain, 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, are included to provide a further understanding of the application and to provide a further understanding of the application with regard to the other features, objects and advantages of the application. The drawings of the illustrative embodiments of the present application and their descriptions are for the purpose of illustrating the present application and are not to be construed as unduly limiting the present application. In the drawings:
fig. 1 is a schematic system configuration diagram of a load balancing method according to an embodiment of the present application;
FIG. 2 is a flow diagram of a load balancing method according to an embodiment of the present application;
fig. 3 is a schematic structural view of a load balancing apparatus according to an embodiment of the present application;
fig. 4 is a flow chart of a load balancing method according to a preferred embodiment of the present application.
Detailed Description
In order to make the present application solution better understood by those skilled in the art, the following description will be made in detail and with reference to the accompanying drawings in the embodiments of the present application, it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate in order to describe the embodiments of the present application described herein. 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 the present application, the terms "upper", "lower", "left", "right", "front", "rear", "top", "bottom", "inner", "outer", "middle", "vertical", "horizontal", "lateral", "longitudinal" and the like indicate an azimuth or a positional relationship based on that shown in the drawings. These terms are used primarily to better describe the present application and its embodiments and are not intended to limit the indicated device, element or component to a particular orientation or to be constructed and operated in a particular orientation.
Also, some of the terms described above may be used to indicate other meanings in addition to orientation or positional relationships, for example, the term "upper" may also be used to indicate some sort of attachment or connection 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," "configured," "provided," "connected," "coupled," and "sleeved" are to be construed broadly. For example, it may be a fixed connection, a removable connection, or a unitary construction; may 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 terms in this application will be understood by those of ordinary skill in the art as the case may be.
It should be noted that, in the case of no conflict, the embodiments and features in the embodiments may be combined with each other. The present application will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
As shown in fig. 1, a system structure schematic diagram of a load balancing method according to an embodiment of the present application includes: an nmginx reverse proxy service 100, a gateway service 200, a user account creation service 300, and a 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 service deploys a plurality of devices, and uses an Nginx reverse proxy service 100, and an Nginx load balancing policy comprises polling, assigned weight, ip binding (ip_hash), fair and url_hash.
The gateway service 200 may use a preset policy to perform polling of different servers.
The user account creation service 300 includes, but is not limited to, those involving user account opening creation.
The billing service 400 includes, but is not limited to, billing services related to finance.
The foregoing financial correlation is mainly related to a specific actual business scenario, and is not used to limit the protection scope of the present application.
The background service is split according to the field, and the business is decoupled by using the idea of the micro service. And when the user accesses the background service, carrying out service differentiation. The user account creation service 300 is decoupled from the billing service 400, and load balancing is implemented according to the domain bearing different service access requests.
In an embodiment of the present application, there is provided a load balancing system, including: an nmginx reverse proxy service 100 for providing a reverse proxy for a background service, the background service at least including a gateway service, a user account creation service, and a billing service; gateway service 200, configured to perform registration information matching of the user account creation service according to the context API information in the 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, a server of the user account creation service is selected for access according to a load balancing strategy configured when the user account creation service is registered; a user account creation service 300 for performing business processing after receiving the request of the gateway service, and based on the billing service in the business processing; the user account creation service obtains registration information of the billing service based on a Nacos service registration center; and the accounting service 400 is used for carrying out business processing after receiving the user account creation service request, and returning corresponding response information to the user account creation service serving as a request client after the business processing is finished.
As a 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 a context crcl-open-api, a service IP, a service port, a request address, a preset load balancing policy, and service packet information; the gateway service 200 is further configured to, after the gateway server receives a request forwarded by the nginnx reverse proxy service, perform registration information matching of the user account creation service according to a context crcl-open-api in a request address.
As a preferred embodiment, the Nacos service registry is configured to obtain registration information of the accounting service based on the Nacos service registry, and perform HTTP request by determining a piece of service registration information in the registration information of the accounting service.
As shown in fig. 2, the method includes steps S201 to S205 as follows:
step S201, polling is carried out according to a user account creation service request and 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 for access according to a preset load balancing strategy pre-configured when the service information is registered;
step S203, business processing is carried out based on the billing service in the process of carrying out the user account creation service;
step S204, the result of the business processing is returned to the client side which sends the user account creation service request.
From the above description, it can be seen that the following technical effects are achieved:
the method comprises the steps of carrying out polling according to a preset load balancing strategy according to a user account creation service request, selecting a gateway service server for access, matching the registration information, and selecting a user account creation service server for access according to a preset load balancing strategy preset during service information registration, so that the purposes of carrying out service processing based on the accounting service in the process of carrying out the user account creation service and returning the service processing result to a client side sending the user account creation service request are achieved, the technical effect of load balancing during service data access processing is achieved, and the technical problem of server pressure caused by massive service requests is solved.
In the step S201, the server side performs polling according to a preset load balancing policy and selects a server of the gateway service for access according to the user account creation service request. The user account creation service request is requested by a client. And polling the server side according to a preset load balancing strategy and selecting a server of the gateway service 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 step S202, the server matches the registration information, and selects one server of the user account creation service according to a preset load balancing policy preset when the service information is registered for access.
In a specific embodiment, the service information is registered with a preset load balancing policy.
In a preferred embodiment, the server side selects one of the servers of the user account creation service for access through the gateway. The user account creation service is related to a specific business scenario, and is not specifically limited in this application. It can be appreciated that the user account creation service needs to meet a preset condition and be obtained after service separation.
The server in step S203 performs business processing based on the billing service in the process of performing the user account creation service. The billing service is related to a specific business scenario and is not specifically limited in this application. It will be appreciated that the billing service needs to meet a preset condition and be obtained after service separation.
In one embodiment, after the accounting service processes the internal traffic, the processing results are returned to the user account creation service.
In a preferred embodiment, the user account creation service performs service information registration at a gateway server.
The server returns the result of the business processing to the client that sent the user account creation service request in step S204.
In a specific embodiment, after the user account creation service processes the internal service, the processing result is returned to the gateway service.
In a preferred embodiment, the nmginx reverse proxy receives a response and returns the response to the user browser, and the user can acquire corresponding page information in the browser.
As a preference in this embodiment, the user account creation service includes: based on OpenFeign in SpringCloud framework, and using Ribbon service at bottom layer; acquiring registration information of the accounting service based on a Nacos service registration center, and simultaneously determining one piece of service registration information in the registration information of the accounting service to perform HTTP request, wherein the accounting service and the user account creation service perform 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, first: based on OpenFeign in SpringCloud framework, and using Ribbon service at bottom layer, user account creation service is opened.
Secondly: based on the Nacos service registration center, acquiring registration information of the accounting service, and simultaneously carrying out HTTP request by determining any piece of service registration information in the registration information of the accounting service.
Further, the billing 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 will be appreciated that at least one of the following information needs to be provided during registration of service information: IP, port, service name.
As a preference in this embodiment, the method further comprises: and adopting Nginx as a reverse proxy to proxy access addresses of a plurality of servers, wherein the servers provide a server at least comprising gateway service, a user account creation server and a billing server, and the load balancing strategy of the Nginx comprises a random strategy, a polling strategy, a retry strategy, a lowest concurrency strategy, an available filtering strategy, a response time weighted re-strategy and an area weight strategy.
In specific implementation, nginx is adopted as a reverse proxy to proxy access addresses of a plurality of servers. Using nmginx as a reverse proxy, nmginx load balancing policies include poll, assign weights, ip binding (ip_hash), fair, url_hash. Filling the ip and port of the gateway service in the Nginx configuration file. When the user account creation service is made, the Nginx selects a gateway service to access according to a polling load balancing strategy according to a user request.
As a preference in this embodiment, after performing business processing based on the billing service in the process of performing the user account creation service, the method further includes: after receiving the response information of the accounting service, the user account creation service returns the response information to the gateway service; after creating service response information based on the user account received by the gateway service, returning to the Nginx; and returning to the user browser based on the response information received by the Nginx, so that the user can acquire corresponding page information in the browser.
In the 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 nginnx. And finally, returning to the user browser based on the response information received by the Nginx, so that the user can acquire the 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 billing service can be mutually invoked based on a 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 other than that illustrated herein.
According to an embodiment of the present application, there is further provided a load balancing apparatus for implementing the above method, as shown in fig. 3, where the apparatus includes:
the service access module 301 is configured to poll and select a server of a gateway service for access according to a user account creation service request according to a preset load balancing policy, where the user account creation service request is used to register service information on the server of the gateway service to obtain registration information;
the registration information matching module 302 is 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 that is preconfigured when the service information is registered;
a business processing module 303, configured to perform business processing based on the billing service in a process of performing the user account creation service;
and the returning module 304 is configured to return the result of the service processing to the client that issues the user account creation service request.
The service access module 301 performs polling according to a preset load balancing policy and selects a server of a gateway service for access according to a user account creation service request at a server side. The user account creation service request is requested by a client. And polling the server side according to a preset load balancing strategy and selecting a server of the gateway service 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 for access according to a preset load balancing policy pre-configured during registration of the service information.
In a specific embodiment, the service information is registered with a preset load balancing policy.
In a preferred embodiment, the server side selects one of the servers of the user account creation service for access through the gateway. The user account creation service is related to a specific business scenario, and is not specifically limited in this application. It can be appreciated that the user account creation service needs to meet a preset condition and be 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 related to a specific business scenario and is not specifically limited in this application. It will be appreciated that the billing service needs to meet a preset condition and be obtained after service separation.
In one embodiment, after the accounting service processes the internal traffic, the processing results are returned to the user account creation service.
In a preferred embodiment, the user account creation service performs service information registration at a gateway server.
The service end in the return module 304 returns the result of the service processing to the client end which sends the user account creation service request.
In a specific embodiment, after the user account creation service processes the internal service, the processing result is returned to the gateway service.
In a preferred embodiment, the nmginx reverse proxy receives a response and returns the response to the user browser, and the user can acquire corresponding page information in the browser.
It will be apparent to those skilled in the art that the modules or steps of the application described above may be implemented in a general purpose computing device, they may be centralized on a single computing device, or distributed across a network of computing devices, or they may alternatively be implemented in program code executable by computing devices, such that they may be stored in a memory device and executed by computing devices, or individually fabricated as individual integrated circuit modules, or multiple modules or steps within them may be fabricated as a single integrated circuit module. Thus, the present application is not limited to any specific combination of hardware and software.
In order to better understand the load balancing method flow, the following description is given with reference to the preferred embodiments, but the technical solution of the embodiments of the present invention is not limited thereto.
According to the load balancing method in the embodiment of the application, software load balancing is achieved by introducing Nginx, springCloud new technology. The method solves the problem of single-point centralized deployment, improves the service bearing capacity, and meets the requirements of high concurrency and high availability. The method is easy to transversely expand, and the distributed technology is adopted, so that the method can be transversely expanded and is easy to maintain. In addition, the method has the characteristics of high availability and high concurrency.
Fig. 4 is a schematic flow chart of a load balancing method in the embodiment of the present application, and the user account creation service is a cloud service, and the accounting service is a cloud service accounting service for example. The specific process comprises the following steps:
the service is split according to the field, and the idea of micro-service is used for decoupling the service. And when the user accesses the background service, carrying out service differentiation. The cloud information opening service is decoupled from the cloud information payment service. And carrying different service access requests according to the field to realize load balancing. Yun Xin open service and gateway service deploy multiple points, reducing the pressure of a single server. Throughput is improved.
In step S1, a plurality of background services are deployed, nginx is used as a reverse proxy, and an Nginx load balancing strategy comprises polling, assigned weight, IP binding (IP_hash), fair and url_hash.
And S2, filling the ip and the port of the gateway service in the Nginx configuration file.
And step S3, when the user performs cloud information opening service, the Nginx selects a gateway service to access according to a polling load balancing strategy according to a user request.
In step S4, the Yun Xin open 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 packet information.
Step S5, after receiving the nginnx forwarded request, the gateway server will, according to the context in the request address: and (5) performing registration information matching of the cloud information opening service by the crcl-open-api.
And S6, the gateway service is matched with the registration information of the cloud information issuing service, and one cloud information issuing service is selected to access according to a load balancing strategy configured during the registration of the issuing service.
In step S7, the Yun Xin open service performs service processing after receiving the request of the gateway service. A cloud-credit accounting service is relied on in the business process.
And S8, the cloud message billing service and the cloud message opening service register service information in the Nacos registration center, wherein the service information comprises IP, port and service name.
Step S9, yun Xin, using OpenFeign in SpringCloud framework in the open service; the bottom layer adopts a Ribbon service. Load balancing supports random policies, polling policies, retry policies, lowest concurrency policies, available filtering policies, response time weighted weighting policies, and region weight policies.
Step S10, yun Xin the open service goes to the Nacos service registry to obtain the registration information of the cloud service accounting service. Yun Xin open service as a software client uses the polling load balancing policy of rib by default. And selecting one piece of service registration information from the registration information of the cloud information accounting service. An HTTP request is made.
And S11, after the cloud information accounting service receives the request, carrying out business processing. And after the service processing is finished, returning corresponding response information to the cloud information issuing service of the request client.
And step S12, the cloud information issuing service receives the response information of the cloud information accounting service, and returns the response information to the gateway service after the internal service is processed.
Step S13, after receiving the cloud information issuing service response information, the gateway service returns to the Nginx.
In step S14, the nginnx receives the response and returns the response to the user browser, and the user can obtain the corresponding page information in the browser.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the same, but rather, various modifications and variations may be made by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims (9)

1. A method of load balancing, comprising:
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;
matching the registration information, and selecting a server of the user account creation service for access according to a preset load balancing strategy which is preset when the service information is registered;
business processing is carried out based on a billing service in the process of carrying out the user account creation service;
returning the service processing result to the client side which sends the user account creation service request;
the user account creation service includes:
based on OpenFeign in SpringCloud framework, and using Ribbon service at bottom layer;
acquiring registration information of the accounting service based on a Nacos service registration center, and simultaneously determining one piece of service registration information in the registration information of the accounting service to perform HTTP request, wherein the accounting service and the user account creation service perform service information registration in the Nacos service registration center, and the service information at least comprises one of the following: IP, port, service name;
using Nginx as reverse proxy, and using Nginx as reverse proxy, wherein the Nginx load balancing strategy comprises polling, assigned weight, ip binding, fair and url_hash;
filling the ip and port of the gateway service in the Nginx configuration file, and selecting a gateway service to access according to a polling load balancing strategy by Nginx according to a user request when the user account creation service is performed.
2. The method as recited in claim 1, further comprising:
and adopting Nginx as a reverse proxy to proxy access addresses of a plurality of servers, wherein the servers provide a server at least comprising gateway service, a user account creation server and a billing server, and the load balancing strategy of the Nginx comprises a random strategy, a polling strategy, a retry strategy, a lowest concurrency strategy, an available filtering strategy, a response time weighted re-strategy and an area weight strategy.
3. The method of claim 2, wherein after performing business processing based on the billing service in the process of performing the user account creation service, further comprising:
after receiving the response information of the accounting service, the user account creation service returns the response information to the gateway service;
after creating service response information based on the user account received by the gateway service, returning to the Nginx;
and returning to the user browser based on the response information received by the Nginx, so that the user can acquire corresponding page information in the browser.
4. 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 creation service and a billing service;
gateway service, which is used for carrying out registration information matching 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, a server of the user account creation service is selected for access according to a load balancing strategy configured when the user account creation service is registered;
a user account creation service for performing business processing after receiving the request of the gateway service, and based on the billing service in the business processing; the user account creation service includes:
based on OpenFeign in SpringCloud framework, and using Ribbon service at bottom layer;
acquiring registration information of the accounting service based on a Nacos service registration center, and simultaneously determining one piece of service registration information in the registration information of the accounting service to perform HTTP request, wherein the accounting service and the user account creation service perform service information registration in the Nacos service registration center, and the service information at least comprises one of the following: IP, port, service name;
the user account creation service obtains registration information of the billing service based on a Nacos service registration center;
and the billing service is used for carrying out business processing after receiving the user account creation service request, and returning corresponding response information to the user account creation service serving as a request client after the business processing is finished.
5. The system according to claim 4, wherein:
the user account creation service is further configured to, in response to the user account creation service,
registering service information in a gateway server, wherein the service information comprises a 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 is further configured to, in response to the request,
after the gateway server receives the request forwarded by the Nginx reverse proxy service, registration information matching of the user account creation service is performed according to a context crcl-open-api in a request address.
6. The system of claim 4, wherein the Nacos service registry is further configured to
Based on the Nacos service registration center, the server is used for acquiring registration information of the accounting service, and meanwhile, HTTP request is carried out by determining a piece of service registration information in the registration information of the accounting service.
7. A load balancing apparatus, comprising:
the service access module is used for carrying out 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 carrying out service information registration 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 for access according to a preset load balancing strategy which is preset when the service information is registered;
the business processing module is used for carrying out business processing based on accounting service in the process of carrying out the user account creation service;
the return module is used for returning the result of the business processing to the client side which sends the user account creation service request;
the user account creation service includes:
based on OpenFeign in SpringCloud framework, and using Ribbon service at bottom layer;
acquiring registration information of the accounting service based on a Nacos service registration center, and simultaneously determining one piece of service registration information in the registration information of the accounting service to perform HTTP request, wherein the accounting service and the user account creation service perform service information registration in the Nacos service registration center, and the service information at least comprises one of the following: IP, port, service name;
using Nginx as reverse proxy, and using Nginx as reverse proxy, wherein the Nginx load balancing strategy comprises polling, assigned weight, ip binding, fair and url_hash;
filling the ip and port of the gateway service in the Nginx configuration file, and selecting a gateway service to access according to a polling load balancing strategy by Nginx according to a user request when the user account creation service is performed.
8. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a computer program, wherein the computer program is arranged to perform the method of any of the claims 1 to 3 when run.
9. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, the processor being arranged to run the computer program to perform the method of any of claims 1 to 3.
CN202111682020.8A 2021-12-31 2021-12-31 Load balancing method, device and system Active CN114285857B (en)

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 CN114285857A (en) 2022-04-05
CN114285857B true 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)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114978813B (en) * 2022-04-12 2024-09-03 浙江数新网络有限公司 Gateway implementation method based on responsive thread pool
CN115801687A (en) * 2022-11-04 2023-03-14 江苏保旺达软件技术有限公司 A flow equalization method, device, electronic equipment and storage medium

Citations (14)

* Cited by examiner, † Cited by third party
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 思科技术公司 Systems and methods for location reporting in an untrusted network environment
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10404532B2 (en) * 2015-04-10 2019-09-03 Comcast Cable Commnications, LLC Virtual gateway control and management

Patent Citations (14)

* Cited by examiner, † Cited by third party
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 思科技术公司 Systems and methods for location reporting in an untrusted network environment
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)

* Cited by examiner, † Cited by third party
Title
springcloud组件之三:Ribbon(轮询和随机负载);艾艾猫dori;《https://blog.csdn.net/m0_45899013/article/details/107645876》;全文 *
一种支持跨平台多接入的高性能Web AR服务系统研究与实现;李晖阳;《中国优秀硕士学位论文全文数据库》;全文 *

Also Published As

Publication number Publication date
CN114285857A (en) 2022-04-05

Similar Documents

Publication Publication Date Title
CN114285857B (en) Load balancing method, device and system
CN106067858B (en) Communication method, device and system between containers
US8150912B2 (en) Systems and methods for providing customer-selected solutions for multiple datacenter website hosting
US10554741B1 (en) Point to node in a multi-tiered middleware environment
EP2633667B1 (en) System and method for on the fly protocol conversion in obtaining policy enforcement information
US8275868B2 (en) Systems for providing customer-selected solutions for multiple datacenter website hosting
US8208403B2 (en) Defining an end-to-end path for a network service
CN110149397A (en) A kind of micro services integration method and device
CN106953940B (en) Dns server and configuring load application method, network system, domain name analytic method and system
WO2015101237A1 (en) Methods, devices, and systems for allocating service nodes in a network
CN108234670A (en) A kind of distributed remote call method based on zookeeper and netty
CN105554160A (en) Dubbo distributed cluster system architecture method based on nginx load balancing
CN111324843A (en) Front-end request processing method, device, equipment and readable storage medium
CN106878457B (en) The attached storage method of distributed network and system
CN101800760A (en) Realization method and system for accessing data service
CN109660578A (en) CDN's returns source processing method and processing device, system
CN111327647A (en) A method, device and electronic device for a container to provide external services
CN114157710A (en) Communication strategy configuration method, device, storage medium and equipment
CN109729104A (en) Client source address acquisition method, apparatus, server, and computer-readable medium
CN104539752B (en) Access method and system between multilevel field platform
CN105071965B (en) A kind of management system of the network equipment
CN107249038A (en) Business datum retransmission method and system
CN113495776B (en) VNF instantiation method and device
CN115842825B (en) Cloud service platform, cloud service deployment method and device
CN110855787A (en) Method for realizing OpenResty dynamic load balancing based on Consul

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