Method, device and equipment for dynamically loading load balancing configuration and medium
By automatically registering information with the middleware when the application server starts up in the distributed application system, the load balancer updates its configuration in real time, solving the problems of system inflexibility and error susceptibility caused by static configuration, realizing automated and real-time load balancing, and improving the system's flexibility and reliability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-13
- Publication Date
- 2026-03-13
AI Technical Summary
The configuration of existing load balancers relies on static information, which requires manual modification when the system is updated, expanded, or migrated. This is time-consuming, error-prone, and affects the user experience.
In distributed application systems, the application server automatically registers information with the application middleware when it starts up. The load balancer monitors the middleware data in real time, dynamically obtains and updates the load balancing configuration, thus achieving automation and real-time performance.
It improves the system's flexibility and reliability, reduces the need for manual configuration, lowers the error rate and maintenance costs, and enhances response speed and fault tolerance.
Smart Images

Figure CN121664745A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of IT and software development, and in particular to a method, apparatus, device and medium for dynamically loading load balancing configuration. Background Technology
[0002] In the field of modern information technology, distributed application systems are widely used in various business scenarios. These systems typically consist of multiple application servers that work together to handle a large number of user requests. To ensure high availability and a good user experience, system designers deploy load balancers at the system's access point. The main function of a load balancer is to distribute user requests reasonably across different application servers to avoid overloading a single server, while improving overall processing capacity and system fault tolerance.
[0003] Currently, most load balancers rely on static configurations, meaning they depend on static information about the application servers, such as their IP addresses and ports. This limits the system's flexibility and scalability. When an application system needs to be updated, expanded, or migrated, system administrators must manually modify the load balancer's configuration to redirect traffic to the latest application server. This is not only time-consuming and error-prone but can also lead to service interruptions and negatively impact user experience. Typical solutions involve configuring static routes and forwarding rules on the load balancer or using load balancing mechanisms (such as round-robin, canary deployments, and weighted distribution) to distribute traffic. However, these solutions have significant limitations in practical applications. Summary of the Invention
[0004] In view of the above-mentioned technical problems, the present invention provides a method, apparatus, device and medium for dynamically loading load balancing configuration, which aims to overcome the above problems or at least partially solve the above problems.
[0005] The first aspect of this invention provides a method for dynamically loading load balancing configurations, the method comprising: When any application server in a distributed application system starts up, the application server registers the current application information with the application middleware corresponding to the distributed application system. The application middleware updates the application information of the application server corresponding to the current application information based on the current application information. The load balancer corresponding to the distributed application system obtains the latest application information of each application server in the distributed application system from the application middleware. The load balancer updates the load balancing configuration information of the distributed application system based on the latest application information of each application server, and distributes traffic to the application servers in the distributed system according to the updated load balancing configuration information.
[0006] A second aspect of the present invention provides an apparatus for dynamically loading load balancing configurations, the apparatus comprising: The registration module is deployed on any application server in the distributed application system. It is used to register the current application information with the application middleware corresponding to the distributed application system when the application server starts. The update module, deployed in the application middleware, is used to update the application information of the application server corresponding to the current application information based on the current application information. The acquisition module is deployed on the load balancer corresponding to the distributed application system and is used to acquire the latest application information of each application server in the distributed application system from the application middleware. A configuration update module, deployed on the load balancer, is used to update the load balancing configuration information of the distributed application system based on the latest application information of each application server, and to distribute traffic to the application servers in the distributed system according to the updated load balancing configuration information.
[0007] A third aspect of the present invention provides an electronic device comprising a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method for dynamically loading load balancing configuration as described in the first aspect of the present invention.
[0008] A fourth aspect of the present invention provides a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method for dynamically loading load balancing configuration as described in the first aspect of the present invention.
[0009] In the dynamic loading load balancing configuration method proposed in this invention, for any application server in the distributed application system, when the application server starts, the current application information is automatically registered with the application middleware corresponding to the distributed application system and updated. Then, the load balancer corresponding to the distributed application system monitors the data of the application middleware in real time, dynamically obtains and loads the latest application information of each application server, and updates the load balancing configuration information of the distributed application system based on the latest application information of each application server. This realizes automated configuration and real-time updating of load balancing configuration, thereby improving the flexibility, automation level and overall reliability of the distributed application system, reducing the need for manual configuration, reducing error rate and maintenance costs, and improving the response speed and fault tolerance of the distributed application system to changes. Attached Figure Description
[0010] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 This is a flowchart illustrating the steps of a method for dynamically loading load balancing configuration according to an embodiment of the present invention; Figure 2 This is a schematic diagram of a network scenario for dynamically loading load balancing configuration, as shown in an embodiment of the present invention. Figure 3 This is an architecture diagram of a distributed application system shown in one embodiment of the present invention; Figure 4 This is a structural block diagram of a device for dynamically loading load balancing configuration provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0012] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0013] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating the steps of a method for dynamically loading load balancing configuration according to an embodiment of the present invention. Figure 1As shown, the method for dynamically loading load balancing configurations provided in this embodiment includes at least the following steps: Step S11: When any application server in the distributed application system starts, the application server registers the current application information with the application middleware corresponding to the distributed application system.
[0014] In this embodiment, the distributed application system includes multiple application servers. This distributed application system can be widely used in various business scenarios, and this embodiment does not impose specific limitations on the business scenarios in which the distributed application system is applied. For any application server in the distributed application system, when the application server starts, it obtains its current application information and registers this information with the corresponding application middleware of the distributed application system. Here, the current application information in this embodiment represents the latest application information corresponding to the application server at startup.
[0015] A distributed application system includes an application middleware (AM), which is a standalone software or application service used to connect different applications or services. Even if they have different calling methods and interfaces, they can still exchange information through the application middleware. The application middleware corresponding to this distributed application system communicates with multiple application servers in the distributed application system.
[0016] Step S12: The application middleware updates the application information of the application server corresponding to the current application information based on the current application information.
[0017] In this embodiment, after receiving the current application message registered by the application server, the application middleware can update the application information of the application server corresponding to the current application information based on the current application information, and obtain the latest application information of the application server corresponding to the current application information.
[0018] Step S13: The load balancer corresponding to the distributed application system obtains the latest application information of each application server in the distributed application system from the application middleware.
[0019] The distributed application system in this embodiment also includes a load balancer (LB), which is a device or software used to distribute network traffic among multiple services to achieve the purpose of allocating network load. The load balancer is deployed at the access point of the distributed application system. Traffic requests from outside the distributed application system (i.e., client requests or user requests) first reach the load balancer, which then distributes them to the corresponding application servers according to relevant policies (such as load balancing configuration information).
[0020] In this embodiment, the load balancer corresponding to the distributed application system monitors the application middleware corresponding to the distributed application system in real time and obtains the latest application information of each application server in the distributed application system from the application middleware.
[0021] Step S14: The load balancer updates the load balancing configuration information of the distributed application system based on the latest application information of each application server, and distributes traffic to the application servers in the distributed system according to the updated load balancing configuration information.
[0022] In this embodiment, the load balancer can update the load balancing configuration information of the distributed application system based on the latest application information of each application server, obtain the updated load balancing configuration information, and distribute traffic to the application servers in the distributed system based on the updated load balancing configuration information, thereby achieving the purpose of automatic updating.
[0023] In one optional example, the load balancer can self-parse the data format based on the latest application information obtained from each application server, convert the latest application information into a format that the load balancer configuration can understand and apply, and then dynamically update the load balancer configuration information to obtain the updated load balancer configuration information.
[0024] In this embodiment, for any application server in the distributed application system, when the application server starts, the current application information is automatically registered with the application middleware corresponding to the distributed application system and updated. Then, the load balancer corresponding to the distributed application system monitors the data of the application middleware in real time, dynamically obtains and loads the latest application information of each application server, and updates the load balancing configuration information of the distributed application system based on the latest application information of each application server. This realizes the automated configuration and real-time update of the load balancing configuration, ensuring that the load balancing configuration is always up-to-date. This improves the flexibility, automation level and overall reliability of the distributed application system, reduces the need for manual configuration, automatically registers application information without manual operation, reduces error rate and maintenance costs, and improves the response speed and fault tolerance of the distributed application system to changes.
[0025] For example, in this embodiment, a new application server A is launched in the distributed application system. When application server A starts, its current application information is automatically registered with the application middleware. The load balancer monitors the application information in the application middleware in real time and dynamically obtains the latest application information of application server A. Based on the latest application information of each application server, including application server A, the load balancing configuration information of the distributed application system is updated. Traffic is then distributed to each application server, including application server A, according to the updated load balancing configuration information, thereby achieving flexibility, automation level and overall reliability of the distributed application system.
[0026] In conjunction with the above embodiments, in one implementation, the present invention also provides a method for dynamically loading load balancing configurations. In this method, the step S11 above, "the application server registers the current application information to the application middleware corresponding to the distributed application system," specifically includes steps S21 and S22, and step S12 above includes step S23: Step S21: The software development kit integrated in the application server detects the application server and obtains the current application information of the application server.
[0027] In this embodiment, each application server in the distributed application system is integrated with a software development kit (SDK). When any application server in the distributed application system starts up, the software development kit integrated in the application server automatically detects the application server and obtains the current application information of the application server. The current application information in this embodiment includes at least the current IP address and the current port number.
[0028] In one specific embodiment, when the application server starts, the software development kit integrated in the application server automatically executes the registration module to detect the application server and obtain current application information. The registration module includes an automatic detection mechanism to automatically obtain application information such as the application server's IP address and port through system APIs and network scanning.
[0029] Step S22: The software development kit encapsulates the current application information and the service identifier of the application server into a registration request, and sends the registration request to the application middleware.
[0030] In this embodiment, after obtaining the current application information, the software development kit (SDK) can encapsulate the current application information and other metadata of the application server (such as at least a service identifier) into a registration request, and send the registration request to the registration center of the application middleware corresponding to the distributed application system. In another example, the other metadata may also include a version number.
[0031] In one specific embodiment, the software development kit can encapsulate at least the current application information and the service identifier of the application server into a standardized registration request. The registration request includes authentication information to ensure the security of communication between the two parties. When the registration request is sent to the application middleware, the registration center of the application middleware can authenticate the registration request based on the authentication information, and after successful authentication, parse the registration request to obtain the current application information in the registration request.
[0032] Step S23: Based on the current application information in the registration request, the application middleware updates the application information of the application server corresponding to the service identifier in the registration request, obtains the latest application information of the application server, and stores it.
[0033] In this embodiment, after receiving a registration request, the application middleware can parse the request to obtain the current application information and service identifier. Then, based on the current application information in the registration request, the application middleware updates the application information of the application server corresponding to the service identifier in the registration request, obtaining and storing the latest application information of the application server corresponding to the service identifier. In this embodiment, the application middleware can store application information sent from various application servers integrated with software development kits. Updating application information involves overwriting the original application information with the current application information as the latest application information.
[0034] In one optional embodiment, the application middleware includes a registration center. After receiving a registration request, the registration center parses the registration request to obtain the current application information and service identifier in the registration request, and updates the application information corresponding to the application server corresponding to the service identifier.
[0035] In conjunction with any of the above embodiments, the present invention also provides a method for dynamically loading load balancing configurations. In this method, in addition to the steps described above, steps S31 and S32 may be included, and the step S14 above, "the load balancer updates the load balancing configuration information of the distributed application system based on the latest application information of each application server," may specifically include step S33: Step S31: When the software development kit detects that the first application server it is on is faulty or offline, it sends a deregistration request to the application middleware.
[0036] In this embodiment, when an application server malfunctions or goes offline, the software development kit (SDK) integrated within that application server can detect this change. Upon detecting a malfunction or offline status of the first application server, the SSD generates a deregistration request carrying the service identifier of the first application server and sends this request to the application middleware, such as to the registry center within the application middleware. Here, the first application server in this embodiment refers to the application server in the distributed application system that has malfunctioned or gone offline.
[0037] Step S32: The application middleware deletes the application information of the first application server based on the cancellation request.
[0038] In this embodiment, after receiving a deregistration request, the application middleware (such as the registry center in the application middleware) can delete the application information of the first application server stored in the application middleware based on the service identifier of the first application server in the deregistration request, and reflect the deregistration information of the first application server in the API interface for communicating with the load balancer.
[0039] Step S33: The load balancer updates the load balancing configuration information of the distributed application system based on the latest application information of the other application servers in the distributed application system besides the first application server.
[0040] In this embodiment, since the load balancer monitors the application middleware in real time, it can obtain the deregistration information of the first application server in real time through the API interface communicating with the application middleware. After the application middleware deletes the application information of the first application server, the load balancer cannot obtain the latest application information of the first application server. At this time, the load balancer updates the load balancing configuration information of the distributed application system based on the latest application information of other application servers in the distributed application system besides the first application server, and obtains the updated load balancing configuration information. The load balancing configuration is updated in this way to exclude the first application server.
[0041] In conjunction with any of the above embodiments, in one implementation, the present invention also provides a method for dynamically loading load balancing configurations. In addition to the steps described above, this method may further include steps S41 to S43: Step S41: The software development kit sends a health check signal carrying a service identifier to the application middleware.
[0042] In this embodiment, the software development kit can periodically send health check signals carrying service identifiers to the application middleware to ensure that the application server status (i.e., the latest application information of the application server) is updated to the application middleware in a timely and correct manner.
[0043] Step S42: The application middleware detects whether the latest application information of the application server corresponding to the service identifier is the most recently received current application information based on the received health check information.
[0044] In this embodiment, the application middleware can detect whether the latest application information of the application server corresponding to the service identifier in the received health check information is the most recently received current application information, so as to update the application status in real time.
[0045] Step S43: If the latest application information is not the most recently received current application information, update the application information of the application server based on the most recently received current application information.
[0046] In this embodiment, if the application middleware detects that the latest application information of the application server corresponding to the service identifier in the health check information is not the most recently received current application information, it updates the application information of the application server corresponding to the service identifier in the health check information based on the most recently received current application information, so as to ensure that the application status (i.e., the stored application information) of the application server is the latest application information.
[0047] In conjunction with any of the above embodiments, in one implementation, the present invention also provides a method for dynamically loading load balancing configurations. In this method, S13 may specifically include steps S51 and / or S52: Step S51: The load balancer periodically obtains the latest application information of each application server in the distributed application system from the application middleware through polling or event callback interfaces.
[0048] In this embodiment, the load balancer can periodically query the latest application information in the application middleware via polling or event callback interfaces to obtain the latest application information of each application server in the distributed application system. In an optional example, the load balancer includes a monitoring module, which can periodically poll or query the application middleware's registry center for the latest application information to obtain the latest application information of each application server in the distributed application system.
[0049] In this embodiment, the event callback interface, also known as a Webhook, is a communication interface through which the application middleware proactively initiates a callback to the load balancer when a specific event occurs (i.e., application information update). Its operation is as follows: the load balancer pre-registers a network address (URL) with the application middleware. When a predetermined event occurs in the application middleware (e.g., application information update on the application server), the service sends an HTTP POST request to the registered network address to notify the load balancer that the application information has been updated and to initiate a callback.
[0050] In an optional example, once the load balancer detects a change in application information, the configuration update module in the load balancer can immediately parse the data based on the latest application information and adjust its internal load balancing forwarding rule configuration based on the parsed data to ensure that all traffic is correctly distributed to the latest application server.
[0051] Step S52: When the load balancer receives a traffic request for the distributed application system, it obtains the latest application information of each application server in the distributed application system from the application middleware.
[0052] In this embodiment, when the load balancer receives a traffic request for the distributed application system from an external client, it can proactively obtain the latest application information of each application server in the distributed application system from the application middleware. Based on the latest application information of each application server, the load balancer updates the load balancing configuration information of the distributed application system, and then distributes traffic to the application servers in the distributed system according to the traffic request and the updated load balancing configuration information.
[0053] It should be noted that the above steps S51 and S52 can be two parallel lines that do not interfere with each other, or they can be triggered simultaneously.
[0054] In conjunction with any of the above embodiments, in one implementation, the present invention also provides a method for dynamically loading load balancing configurations. In this method, step S13 may specifically include step S61, and after step S12, it may further include steps S62 to S63: Step S61: The load balancer obtains the latest application information of each application server in the distributed application system through one or more interfaces provided by the application middleware.
[0055] In this embodiment, the application middleware provides one or more interfaces for the load balancer to query the latest application information. These interfaces can be API interfaces. If the application middleware provides multiple interfaces for the load balancer to query the latest application information, the load balancer can obtain different types of the latest application information through different API interfaces. For example, it can query the latest IP address through interface A, the latest port number through interface A, and so on. Thus, in this embodiment, the load balancer can query and obtain the latest application information of each application server in the distributed application system through one or more interfaces provided by the application middleware.
[0056] Step S62: The application middleware determines whether the application information returned by the interface provided by the application middleware is the latest updated application information by listening to events.
[0057] In this embodiment, the application middleware can ensure that all interfaces in the application middleware reflect the updated application information of each application server by listening to events. Specifically, the application middleware can determine whether the application information returned by the interfaces provided by the application middleware is the latest updated application information by listening to events.
[0058] Step S63: If the application information returned by the interface provided by the application middleware is not the latest updated application information, update the application information of the interface based on the latest updated application information.
[0059] In this embodiment, if the application middleware determines that the application information returned by the interface provided by the application middleware is not the latest updated application information, then the corresponding interface needs to be updated with the latest updated application information to ensure that the load balancer can obtain the latest application information based on the interface.
[0060] In conjunction with any of the above embodiments, in one implementation, the present invention also provides a method for dynamically loading load balancing configurations. In this method, in addition to the steps described above, it may also include step S71, and the step S14 above, "distributing traffic to the application servers in the distributed system according to the updated load balancing configuration information," may specifically include step S72: Step S71: The load balancer detects whether the application middleware is available.
[0061] In this embodiment, the load balancer also checks the availability of the application middleware throughout the process. For example, the load balancer can periodically send probe requests to the application middleware (such as the application middleware registry) and determine its availability based on the returned response; alternatively, the load balancer can also determine its health status and availability by observing the actual response of the application middleware under normal circumstances.
[0062] Step S72: If the load balancer detects that the application middleware is unavailable, when the load balancer receives a traffic request for the distributed application system, it distributes traffic to the application servers in the distributed system according to the preset load balancing configuration information or the most recently updated load balancing configuration information.
[0063] In this embodiment, when the load balancer detects that the application middleware is unavailable, and the load balancer receives a traffic request for the distributed application system, the load balancer can distribute traffic to the application servers in the distributed system according to preset load balancing configuration information (such as initial load balancing configuration information or load balancing configuration information specifically set when the application middleware is unavailable), or according to the most recently updated load balancing configuration information, until the application middleware recovers (i.e. until the load balancer detects that the application middleware is available).
[0064] In other words, in this embodiment, if the load balancer detects that the application middleware is unavailable during the entire operation of the distributed application system, it will continue to operate according to the preset strategy or using the last successful load balancing configuration until the application middleware recovers.
[0065] In one embodiment, the dynamic update process of the distributed application system of this embodiment is as follows: Application Startup: The application server starts, and the SDK integrated in the application server automatically registers the application information with the application middleware; Information Update: The application middleware receives the registration information and stores it; Health Check: The SDK periodically sends health check signals, and the application middleware updates the application status; Information Query: The load balancer queries the application middleware to obtain the latest application information; Configuration Update: The load balancer dynamically updates the configuration based on the obtained application information; Traffic Distribution: The load balancer distributes traffic based on the updated configuration.
[0066] In one embodiment, such as Figure 2 As shown, Figure 2 This is a schematic diagram illustrating a network scenario with dynamically loaded load balancing configuration, as shown in an embodiment of the present invention. Figure 2In this system, external clients can send traffic requests to the load balancer to request traffic from the distributed application system. The load balancer can send query streams to the application middleware to retrieve the latest application information of each application server in the distributed application system. It then dynamically updates the load balancing configuration based on the latest application information and distributes traffic to the application servers in the distributed application system according to the updated load balancing configuration. Each application server in the distributed application system can send application registration and deregistration requests to the application middleware through its integrated SDK to update its own application status in real time.
[0067] In other words, this invention proposes a dynamic update mechanism based on an application integration SDK. This mechanism allows applications to automatically register their information with the application middleware upon startup, achieving automatic registration and deregistration of application information. The load balancer monitors the application middleware data in real time, dynamically acquiring and loading the latest application information, thus achieving automated configuration and real-time updates of the load balancing configuration. This approach improves the system's flexibility, automation level, and overall reliability, reduces the need for manual configuration, lowers error rates and maintenance costs, and simultaneously enhances the system's responsiveness and fault tolerance to changes.
[0068] It should be noted that the load balancer and application middleware in this embodiment can be inside or outside the distributed application system, and this embodiment does not impose any restrictions on this.
[0069] In one embodiment, such as Figure 3 As shown, Figure 3 This is an architecture diagram of a distributed application system according to an embodiment of the present invention. Figure 3 In a distributed application system, at least the following components are included: an application with integrated SDK (i.e., an application server), application middleware, and a load balancer. The application middleware includes at least a registry center, and the load balancer includes at least a monitoring module. Applications with integrated SDK can update their status in a timely manner by sending registration and deregistration requests to the registry center. The registry center can update its stored application information in real time based on these registration and deregistration requests. After the application information is updated, the registry center can send change feedback to the load balancer, causing the load balancer to send a query stream to the registry center through the monitoring module to obtain the latest application information. The monitoring module can trigger the load balancer to update its current load balancing configuration based on the acquired new application information, and then distribute traffic to the application server according to the updated load balancing configuration.
[0070] In summary, this invention aims to automatically register application information with the application middleware upon application startup via an application integration SDK. The load balancer monitors the application middleware's data in real time, dynamically acquiring and loading the latest application information, thereby achieving automated configuration and real-time updates of the load balancing configuration, thus improving the system's flexibility, automation level, and overall reliability. In other words, the method for dynamically loading load balancing configurations proposed in this invention offers at least the following advantages: Automation: Reduces the need for manual configuration, automatically registers and deregisters application information, requiring no manual operation; Real-time performance: Load balancers can respond to application changes in real time, improving system response speed and enabling the system to quickly adapt to changes in application servers, ensuring that the configuration is always up-to-date; Flexibility: The system can quickly adapt to the expansion and migration of applications without the need for manual reconfiguration of the load balancer; Reliability: By monitoring and updating dynamically in real time, the risks of manual operation are reduced, the risks caused by human error are decreased, and the stability and reliability of the system are improved.
[0071] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.
[0072] Based on the same inventive concept, one embodiment of the present invention provides a device for dynamically loading load balancing configurations. (See reference...) Figure 4 , Figure 4 This is a structural block diagram of a device for dynamically loading load balancing configuration according to an embodiment of the present invention. Figure 4 As shown, the device includes: The registration module is deployed on any application server in the distributed application system. It is used to register the current application information with the application middleware corresponding to the distributed application system when the application server starts. The update module, deployed in the application middleware, is used to update the application information of the application server corresponding to the current application information based on the current application information. The acquisition module is deployed on the load balancer corresponding to the distributed application system and is used to acquire the latest application information of each application server in the distributed application system from the application middleware. A configuration update module, deployed on the load balancer, is used to update the load balancing configuration information of the distributed application system based on the latest application information of each application server, and to distribute traffic to the application servers in the distributed system according to the updated load balancing configuration information.
[0073] Optionally, the registration module includes: The first detection module is used to detect the application server through the software development kit integrated in the application server, and obtain the current application information of the application server. The current application information includes at least: the current IP address and the current port number. The first sending module is used to encapsulate the current application information and the service identifier of the application server into a registration request using the software development kit, and send the registration request to the application middleware; Update modules, including: The application information update module is used to update the application information of the application server corresponding to the service identifier in the registration request based on the current application information in the registration request, and to obtain and store the latest application information of the application server.
[0074] Optionally, the device further includes: The second sending module is deployed on any application server in the distributed application system and is used to send a cancellation request to the application middleware in the event that the first application server it is on is detected to be faulty or offline, using the software development kit. The deletion module, deployed in the application middleware, is used to delete the application information of the first application server based on the logout request; Configuration update module, including: The first update module is used to update the load balancing configuration information of the distributed application system based on the latest application information of other application servers in the distributed application system besides the first application server.
[0075] Optionally, the device further includes: The third sending module, deployed on any application server in the distributed application system, is used to send a health check signal carrying a service identifier to the application middleware through the software development kit. The second detection module, deployed in the application middleware, is used to detect whether the latest application information of the application server corresponding to the service identifier is the most recently received current application information based on the received health check information. The second update module, deployed in the application middleware, is used to update the application information of the application server based on the most recently received current application information when the latest application information is not the most recently received current application information.
[0076] Optionally, the acquisition module includes: The first acquisition module is used to periodically acquire the latest application information of each application server in the distributed application system from the application middleware through polling or event callback interfaces. The second acquisition module is used to acquire the latest application information of each application server in the distributed application system from the application middleware when a traffic request for the distributed application system is received.
[0077] Optionally, the acquisition module includes: An interface providing module is used to obtain the latest application information of each application server in the distributed application system through one or more interfaces provided by the application middleware. The device further includes: The listening module, deployed in the application middleware, is used to determine whether the application information returned by the interface provided by the application middleware is the latest updated application information after updating the application information of the application server corresponding to the current application information based on the current application information by listening to events. The third update module is used to update the application information of the interface based on the latest updated application information when the application information returned by the interface provided by the application middleware is not the latest updated application information.
[0078] Optionally, the device further includes: The third detection module, deployed on the load balancer, is used to detect whether the application middleware is available. Configuration update module, including: The traffic distribution module is used to distribute traffic to the application servers in the distributed system according to preset load balancing configuration information or the most recently updated load balancing configuration information when the load balancer receives a traffic request for the distributed application system, provided that the load balancer detects that the application middleware is unavailable.
[0079] The terms "first," "second," etc., used in the specification and claims of this invention are used to distinguish similar objects and are not used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention can be implemented in orders other than those illustrated or described herein. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0080] The device for dynamically loading load balancing configuration in this embodiment of the invention can be a device, or a component, integrated circuit, or chip in a terminal. This device can be a mobile electronic device or a non-mobile electronic device. For example, mobile electronic devices can be mobile phones, tablets, laptops, PDAs, in-vehicle electronic devices, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc., while non-mobile electronic devices can be servers, network-attached storage (NAS), personal computers (PCs), televisions (TVs), ATMs, or self-service machines, etc. This embodiment of the invention does not impose specific limitations.
[0081] The device for dynamically loading load balancing configuration in this embodiment of the invention can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this embodiment of the invention does not impose specific limitations.
[0082] Based on the same inventive concept, another embodiment of the present invention provides an electronic device, such as... Figure 5 As shown, Figure 5 This is a schematic diagram of an electronic device according to an embodiment of the present invention. The electronic device includes a memory, a processor, and a program or instructions stored in the memory and executable on the processor. When the program or instructions are executed by the processor, they implement the steps of the dynamic loading load balancing configuration method described in any of the above embodiments of the present invention.
[0083] It should be noted that the electronic devices in the embodiments of the present invention include the mobile electronic devices and non-mobile electronic devices described above.
[0084] Based on the same inventive concept, another embodiment of the present invention provides a readable storage medium storing a program or instructions that, when executed by a processor, implement the steps in the dynamic loading load balancing configuration method described in any of the above embodiments of the present invention. The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes a computer-readable storage medium, such as a computer read-only memory (ROM), random access memory (RAM), a magnetic disk, or an optical disk.
[0085] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0086] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of the present invention is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0087] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0088] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of the present invention.
Claims
1. A method for dynamically loading load balancing configurations, characterized in that, The method includes: When any application server in a distributed application system starts up, the application server registers the current application information with the application middleware corresponding to the distributed application system. The application middleware updates the application information of the application server corresponding to the current application information based on the current application information. The load balancer corresponding to the distributed application system obtains the latest application information of each application server in the distributed application system from the application middleware. The load balancer updates the load balancing configuration information of the distributed application system based on the latest application information of each application server, and distributes traffic to the application servers in the distributed system according to the updated load balancing configuration information.
2. The method for dynamically loading load balancing configuration according to claim 1, characterized in that, The application server registers the current application information with the application middleware corresponding to the distributed application system, including: The software development kit integrated in the application server detects the application server and obtains the current application information of the application server. The current application information includes at least: the current IP address and the current port number. The software development kit encapsulates the current application information and the service identifier of the application server into a registration request, and sends the registration request to the application middleware; The application middleware updates the application information of the application server corresponding to the current application information based on the current application information, including: Based on the current application information in the registration request, the application middleware updates the application information of the application server corresponding to the service identifier in the registration request, obtains the latest application information of the application server, and stores it.
3. The method for dynamically loading load balancing configuration according to claim 2, characterized in that, The method further includes: If the software development kit detects a failure or shutdown of the first application server it is running on, it sends a deregistration request to the application middleware. The application middleware deletes the application information of the first application server based on the cancellation request; The load balancer updates the load balancing configuration information of the distributed application system based on the latest application information of each application server, including: The load balancer updates the load balancing configuration information of the distributed application system based on the latest application information of the other application servers in the distributed application system besides the first application server.
4. The method for dynamically loading load balancing configuration according to claim 2, characterized in that, The method further includes: The software development kit sends a health check signal carrying a service identifier to the application middleware; The application middleware detects whether the latest application information of the application server corresponding to the service identifier is the most recently received current application information based on the received health check information. If the latest application information is not the most recently received current application information, the application server is updated based on the most recently received current application information.
5. The method for dynamically loading load balancing configuration according to any one of claims 1 to 4, characterized in that, The load balancer corresponding to the distributed application system obtains the latest application information of each application server in the distributed application system from the application middleware, including: The load balancer periodically obtains the latest application information of each application server in the distributed application system from the application middleware through polling or event callback interfaces; and / or When the load balancer receives a traffic request for the distributed application system, it obtains the latest application information of each application server in the distributed application system from the application middleware.
6. The method for dynamically loading load balancing configuration according to any one of claims 1 to 4, characterized in that, The load balancer corresponding to the distributed application system obtains the latest application information of each application server in the distributed application system from the application middleware, including: The load balancer obtains the latest application information of each application server in the distributed application system through one or more interfaces provided by the application middleware. After the application middleware updates the application information of the application server corresponding to the current application information based on the current application information, the method further includes: The application middleware determines whether the application information returned by the interface provided by the application middleware is the latest updated application information by listening to events. If the application information returned by the interface provided by the application middleware is not the latest updated application information, the interface shall be updated with the latest updated application information.
7. The method for dynamically loading load balancing configuration according to any one of claims 1 to 4, characterized in that, The method further includes: The load balancer detects whether the application middleware is available; Based on the updated load balancing configuration information, traffic is distributed to the application servers in the distributed system, including: If the load balancer detects that the application middleware is unavailable, when the load balancer receives a traffic request for the distributed application system, it distributes traffic to the application servers in the distributed system according to the preset load balancing configuration information or the most recently updated load balancing configuration information.
8. A device for dynamically loading load balancing configurations, characterized in that, The device includes: The registration module is deployed on any application server in the distributed application system. It is used to register the current application information with the application middleware corresponding to the distributed application system when the application server starts. The update module, deployed in the application middleware, is used to update the application information of the application server corresponding to the current application information based on the current application information. The acquisition module is deployed on the load balancer corresponding to the distributed application system and is used to acquire the latest application information of each application server in the distributed application system from the application middleware. A configuration update module, deployed on the load balancer, is used to update the load balancing configuration information of the distributed application system based on the latest application information of each application server, and to distribute traffic to the application servers in the distributed system according to the updated load balancing configuration information.
9. An electronic device, characterized in that, It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method for dynamically loading load balancing configuration as described in any one of claims 1 to 7.
10. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the method for dynamically loading load balancing configuration as described in any one of claims 1 to 7.