CN111221651B - Load balancing configuration method, device, server and readable storage medium - Google Patents

Load balancing configuration method, device, server and readable storage medium Download PDF

Info

Publication number
CN111221651B
CN111221651B CN202010002254.2A CN202010002254A CN111221651B CN 111221651 B CN111221651 B CN 111221651B CN 202010002254 A CN202010002254 A CN 202010002254A CN 111221651 B CN111221651 B CN 111221651B
Authority
CN
China
Prior art keywords
load balancing
record
address list
node
service
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
CN202010002254.2A
Other languages
Chinese (zh)
Other versions
CN111221651A (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.)
Guangzhou Huya Technology Co Ltd
Original Assignee
Guangzhou Huya Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Huya Technology Co Ltd filed Critical Guangzhou Huya Technology Co Ltd
Priority to CN202010002254.2A priority Critical patent/CN111221651B/en
Publication of CN111221651A publication Critical patent/CN111221651A/en
Application granted granted Critical
Publication of CN111221651B publication Critical patent/CN111221651B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

After configuring a plurality of load balancing instances, registering an address list of a load balancing node corresponding to each selected service packet on the load balancing instance by combining name service, modifying a record adjustment field of each record containing any service packet in a preset load balancing information table when the address list of the load balancing node corresponding to any service packet is monitored to be changed by the name service, traversing the record adjustment field in each record from the load balancing information table according to a preset polling task, and adjusting the address list of the load balancing node registered on each load balancing instance according to the record adjustment field in each record.

Description

Load balancing configuration method, device, server and readable storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a load balancing configuration method, a device, a server, and a readable storage medium.
Background
Under the large server cluster environment, the load balancing node is widely applied to front-end load balancing of the server cluster, a large number of concurrent requests can be reasonably scheduled to each back-end service node in the server cluster for processing through virtual service, the problem of overlarge data flow of a single service node is effectively avoided, and meanwhile, the computing resources of each back-end service node can be used uniformly.
Typically, each load balancing node will correspond to a particular service packet, each service packet may correspond to a particular traffic service. In the load balancing configuration process, each load balancing node corresponding to each service packet is generally selected to be bound in a corresponding load balancing instance, so that the load balancing nodes are configured to provide load balancing service for a specific business service. However, in the actual application process, each load balancing node corresponding to the service packet may be dynamically changed, and the conventional scheme often needs to manually modify the configuration for the load balancing instance, so that the configuration situation of the load balancing instance cannot be automatically adjusted when the load balancing node changes.
Disclosure of Invention
In view of the foregoing, an object of the present application is to provide a load balancing configuration method, a device, a server and a readable storage medium, which can automatically adjust the configuration situation of a load balancing instance, without manual configuration, and reduce the configuration workload.
According to an aspect of the present application, there is provided a load balancing configuration method, applied to a server, the method including:
configuring a plurality of load balancing examples, and registering an address list of a load balancing node corresponding to each selected service group on each configured load balancing example according to name service;
when the name service monitors that the address list of the load balancing node corresponding to any service packet is changed, a record adjustment field of each record containing the service packet in a preset load balancing information table is modified;
and traversing and searching a record adjustment field in each record from the load balancing information table according to a preset polling task, and adjusting an address list of the load balancing node registered on each load balancing instance according to the record adjustment field in each record.
According to another aspect of the present application, there is provided a load balancing configuration apparatus applied to a server, the apparatus including:
the configuration registration module is used for configuring a plurality of load balancing examples, and registering an address list of a load balancing node corresponding to each selected service group to each configured load balancing example according to name service;
the field modification module is used for modifying a record adjustment field of each record containing any service packet in a preset load balancing information table when the name service monitors the change of the address list of the load balancing node corresponding to the service packet;
and the adjusting module is used for traversing and searching the record adjusting field in each record from the load balancing information table according to a preset polling task, and adjusting the address list of the load balancing node registered on each load balancing instance according to the record adjusting field in each record.
According to another aspect of the present application, there is provided a server comprising a machine-readable storage medium storing machine-executable instructions and a processor which, when executing the machine-executable instructions, implements the aforementioned load balancing configuration method.
According to another aspect of the present application, there is provided a readable storage medium having stored therein machine executable instructions that when executed implement the aforementioned load balancing configuration method.
Based on any one of the above aspects, after configuring a plurality of load balancing instances, the present application registers, for each load balancing instance, an address list of a load balancing node corresponding to each selected service packet by combining with a name service to the load balancing instance, and when the name service monitors that the address list of the load balancing node corresponding to any one service packet is changed, modifies a record adjustment field of each record in a preset load balancing information table, which contains the service packet, and then searches the record adjustment field in each record in a traversing manner from the load balancing information table according to a preset polling task, and adjusts the address list of the load balancing node registered on each load balancing instance according to the record adjustment field in each record, thereby realizing automatic adjustment of the configuration situation of the load balancing instance without manual configuration, and reducing configuration workload.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered limiting the scope, and that other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 shows an application scenario schematic diagram of a load balancing configuration method provided in an embodiment of the present application;
fig. 2 is a schematic flow chart of a load balancing configuration method according to an embodiment of the present application;
fig. 3 shows a schematic flow chart of substeps of step S110 shown in fig. 2;
fig. 4 shows a schematic flow chart of the substeps of step S120 shown in fig. 2;
fig. 5 shows a schematic flow chart of the substeps of step S130 shown in fig. 2;
fig. 6 is a schematic functional block diagram of a load balancing configuration apparatus according to an embodiment of the present application;
fig. 7 is a schematic block diagram of a server for implementing the load balancing configuration method according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it should be understood that the accompanying drawings in the present application are only for the purpose of illustration and description, and are not intended to limit the protection scope of the present application. In addition, it should be understood that the schematic drawings are not drawn to scale. A flowchart, as used in this application, illustrates operations implemented according to some embodiments of the present application. It should be understood that the operations of the flow diagrams may be implemented out of order and that steps without logical context may be performed in reverse order or concurrently. Moreover, one or more other operations may be added to the flow diagrams and one or more operations may be removed from the flow diagrams as directed by those skilled in the art.
In addition, the described embodiments are only some, but not all, of the embodiments of the present application. The components of the embodiments of the present application, which are generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, as provided in the accompanying drawings, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, are intended to be within the scope of the present application.
Fig. 1 shows an application scenario schematic diagram of a load balancing configuration method provided in the embodiment of the present application, where in this embodiment, the application scenario may include a server 100, a load balancing node 200, a server cluster 300, and a user terminal 400, where the server 100 is communicatively connected to a plurality of load balancing nodes 200, and each load balancing node 200 is communicatively connected to a plurality of server clusters 300 and a plurality of user terminals 400 respectively.
In this embodiment, the load balancing node 200 may be an nmginx server, and may be configured to reasonably divide a large number of concurrent access requests of the user terminals 400 equally to each service node in the server cluster 300 according to a preset load balancing policy for processing.
In this embodiment, the server cluster 300 may include a plurality of service nodes for processing the request service of the user terminal 400 through the respective service nodes. For example, when the user terminal 400 transmits a request to access the live room, the request may be processed in response by a service node in the server cluster 300 and the live room information returned.
In this embodiment, the user terminal 400 may include, but is not limited to, a mobile device, a tablet computer, a laptop computer, or any combination of two or more thereof. In some embodiments, the mobile device may include, but is not limited to, a smart home device, a wearable device, a smart mobile device, an augmented reality device, etc., or any combination thereof. In some embodiments, the smart home devices may include, but are not limited to, smart lighting devices, control devices for smart appliances, smart monitoring devices, smart televisions, smart cameras, interphones, or the like, or any combination thereof. In some embodiments, the wearable device may include, but is not limited to, a smart wristband, a smart lace, a smart glass, a smart helmet, a smart watch, a smart garment, a smart backpack, a smart accessory, etc., or any combination thereof. In some embodiments, the smart mobile device may include, but is not limited to, a smart phone, a personal digital assistant (Personal Digital Assistant, PDA), a gaming device, a navigation device, or a Point Of Sale (POS) device, or the like, or any combination thereof. In an implementation, there may be zero, one or more user terminals 400 accessing the load balancing node 200, only one of which is shown in fig. 1. Among them, various application products may be installed in the user terminal 400, for example, an application APP, a Web page, an applet, etc. related to an internet live service used in a computer or a smart phone.
It will be appreciated that the application scenario shown in fig. 1 is only one possible example, and in other possible embodiments, the application scenario may include only a part of the components shown in fig. 1 or may include other components.
Fig. 2 shows a flow chart of a configuration updating method provided in the embodiment of the present application, which may be executed by the server 100 shown in fig. 1, and it should be understood that, in other embodiments, the order of part of the steps in the configuration updating method of the present embodiment may be interchanged according to actual needs, or part of the steps may be omitted or deleted. The detailed steps of the configuration updating method are described below.
Step S110, configuring a plurality of load balancing instances, and registering an address list of a load balancing node corresponding to each selected service group to each configured load balancing instance according to name service.
In step S120, when the name service monitors that the address list of the load balancing node corresponding to any one service packet is changed, the record adjustment field of each record in the preset load balancing information table containing the service packet is modified.
Step S130, traversing and searching a record adjustment field in each record from a load balancing information table according to a preset polling task, and adjusting an address list of a load balancing node registered on each load balancing instance according to the record adjustment field in each record.
In this embodiment, the server 100 may analyze the address list of the load balancing node of each service packet at the corresponding moment according to the packet information of each service packet registered on the name service through the service discovery principle of the name service. The service specific to each service group can be selected according to actual requirements, for example, the service group can correspond to live broadcasting room barrage service, live broadcasting game service or live broadcasting K song service. The traffic services corresponding to each service packet may be provided with load balancing services by corresponding load balancing nodes to schedule access requests for these traffic services through each load balancing node to corresponding service nodes in server cluster 300 for request response and data processing.
When the name service monitors that the address list of the load balancing node corresponding to any service packet is changed, the record adjustment field of each record containing the service packet in the preset load balancing information table is modified, then the record adjustment field in each record is searched through traversal from the load balancing information table according to a preset polling task, and the address list of the load balancing node registered on each load balancing instance is adjusted according to the record adjustment field in each record, so that the configuration condition of the load balancing instance can be automatically adjusted, manual configuration is not needed, and the configuration workload is reduced.
In a possible implementation manner, for step S110, in the process of configuring each load balancing instance, load balancing services corresponding to different load balancing instances are generally provided by different load balancing servers, and in the prior art, when each load balancing instance is configured, a configuration system of the corresponding load balancing server needs to be accessed separately, which results in a complicated configuration flow, so that for shielding differences of load balancing instances established by different load balancing servers, referring to fig. 3, step S110 may be further implemented by the following substeps:
and step S111, obtaining a load balancing configuration interface and a load balancing configuration parameter type of each load balancing server.
And step S112, each load balancing configuration interface is accessed into the load balancing instance registration interface, and the same load balancing configuration parameter type in each load balancing service provider is determined as the instance registration parameter type of the load balancing instance registration interface.
Substep S113, accessing the selected load balancing configuration interface to configure the corresponding load balancing instance according to the instance registration parameters compiled in the instance registration parameter type of the load balancing instance registration interface.
In this embodiment, the load balancing configuration interface may be an SDK (Software Development Kit ) interface for a user to access a configuration system of a corresponding load balancing service provider, and the user may access the load balancing configuration interface of the load balancing service provider to facilitate configuration of a load balancing instance in the configuration system, where the user needs to configure a load balancing configuration parameter in the configuration process, and the load balancing configuration parameter may include multiple parameter types, and may specifically be configured by the load balancing service provider, where this embodiment is not limited specifically.
The parameter types of the load balancing configuration parameters configured by the load balancing server generally comprise the same load balancing configuration parameter types, and the load balancing configuration parameter types can be uniformly configured as common instance registration parameter types, so that in order to facilitate improvement of configuration efficiency of the load balancing instance, each load balancing configuration interface can be uniformly accessed into the load balancing instance registration interface, the same load balancing configuration parameter types in each load balancing server are determined as instance registration parameter types of the load balancing instance registration interface, and when a user configures, after the load balancing server can be selected through the uniform load balancing instance registration interface, the corresponding load balancing configuration parameters are configured in the instance registration parameter types of the load balancing instance registration interface. Based on the above, the selected load balancing configuration interface is accessed to configure the corresponding load balancing instance according to the instance registration parameters edited in the instance registration parameter types of the load balancing instance registration interface.
Therefore, the user does not need to singly access the configuration system of the load balancing service provider to perform one-to-one configuration, so that the configuration efficiency of the load balancing instance is greatly improved.
In a possible implementation, before step S120, in order to facilitate the name service to monitor whether the address list of the load balancing node corresponding to each service packet is changed, each selected service packet may be subscribed to the name service, and a corresponding listener may be bound for each service packet.
On this basis, please refer to fig. 4 in combination, step S120 may be further implemented by the following sub-steps:
substep S121, detecting, by the name service, an address list of the load balancing node corresponding to each service packet subscribed to.
In sub-step S122, when an address list change of a load balancing node corresponding to any one service packet is detected, a change event is triggered to a listener corresponding to the service packet through a name service.
In the substep S123, the monitor searches, according to the change event, a record adjustment field of each record in the preset load balancing information table, where the record adjustment field includes the service packet, and modifies each found record adjustment field to be the change time indicated in the change event.
In this embodiment, taking a service packet as an example, assume that an address list of a load balancing node corresponding to the packet a includes a load balancing node address 1, a load balancing node address 2, a load balancing node address 3, and a load balancing node address 4, and when the name service detects that the load balancing node address 3 and the load balancing node address 4 in the address list of the load balancing node corresponding to the packet a are changed to a load balancing node address 5 and a load balancing node address 6, a change event is triggered to a listener corresponding to the packet a through the name service.
The listener corresponding to the packet a may search, according to the change event, a record adjustment field last_change of each record of the packet a in the groups packet field of the preset load balancing information table, and modify each searched record adjustment field last_change to a change time indicated in the change event, for example 2019-01-01-12:00:00.
in this way, when the name service monitors that the address list of the load balancing node corresponding to any service packet is changed, the record adjustment field of each record containing the service packet in the preset load balancing information table is modified, so that whether the address list of the load balancing node corresponding to the service packet is changed or not can be conveniently determined according to the record adjustment field, and the configuration condition of the load balancing instance can be conveniently adjusted.
For example, referring to fig. 5, in one possible implementation, for step S130, the following substeps may be further implemented:
and step S131, polling the record adjustment fields in each record every preset time period according to a preset polling task, and determining a target record with the record adjustment fields modified.
Sub-step S132, traversing each target service packet in each target record, and searching a load balancing node list corresponding to the target service packet.
And step S133, comparing the load balancing node list with an address list of a load balancing node corresponding to the target service group obtained through name service, and determining a first node address list needing to be added and a second node address list needing to be reduced.
And step S134, according to the determined first node address list and the second node address list, the address list of the load balancing node registered on the load balancing instance corresponding to the target service packet is adjusted.
In this embodiment, still taking the foregoing example as an example, assuming that the target service packet is the packet a, the load balancing node list corresponding to the target service packet, that is, the load balancing node address 1, the load balancing node address 2, the load balancing node address 3, and the load balancing node address 4, may be searched, and compared with the address list of the load balancing node corresponding to the packet a obtained through the name service, that is, the load balancing node address 1, the load balancing node address 2, the load balancing node address 5, and the load balancing node address 6, it may be determined that the first node address list to be added is the load balancing node address 5 and the load balancing node address 6, and the second node address list to be reduced is the load balancing node address 3 and the load balancing node address 4.
On this basis, for sub-step S134, a first node address list may be registered on the load balancing instance corresponding to the target service packet, and a second node address list may be unregistered from the load balancing instance corresponding to the target service packet. Taking the above example as an example, the load balancing node address 5 and the load balancing node address 6 may be registered on the load balancing instance corresponding to the packet a, and the load balancing node address 3 and the load balancing node address 4 may be unregistered from the load balancing instance corresponding to the packet a.
In one possible implementation, in order to increase the polling efficiency and avoid the situation where a single polling task fails, resulting in missing the record adjustment field in the poll lookup record, for sub-step S131, a componentand select operation may be performed in each polling task to ensure that the polling task is performed serially.
That is, each polling task is executed serially every preset time period, and each polling task is to search the record adjustment field in each record from the load balancing information table in a traversing way, and determine the target record with the record adjustment field modified. When executing each polling task, whether the task state represented by the atomic Boolean variable in the polling task is a task completion state or not can be judged, and if the task state represented by the atomic Boolean variable in the polling task is the task completion state, the next polling task is executed. In addition, if the task state represented by the atomic Boolean variable in the polling task is not the task completion state, the polling task is continuously executed until the task state represented by the atomic Boolean variable in the polling task is the task completion state, and then the next polling task is executed.
Therefore, the polling efficiency can be effectively improved, and the situation that the record adjustment field in the polling search record is missed when the single polling task fails is avoided.
In one possible implementation, to facilitate the subsequent user's checking and maintaining the process of adjusting the address list of the load balancing node registered on each load balancing instance at a time, the server 100 may further add a first node address list to the load balancing node instance table, add a new tag to the first node address list, and add a delete tag to the second node address list in the load balancing node instance table. Thus, the user can conveniently check the registered load balancing nodes and the unregistered load balancing nodes in each adjustment process.
Taking the above example as an example, the load balancing node address 5 and the load balancing node address 6 may be added in the load balancing node instance table, the new adding flag is added for the load balancing node address 5 and the load balancing node address 6, and the deletion flag is added for the load balancing node address 3 and the load balancing node address 4 in the load balancing node instance table.
Based on the same inventive concept, please refer to fig. 6, which is a schematic diagram illustrating functional modules of the load balancing configuration apparatus 110 provided in the embodiment of the present application, where the embodiment may divide the functional modules of the load balancing configuration apparatus 110 according to the method embodiment executed by the server 100. For example, each functional module may be divided corresponding to each function, or two or more functions may be integrated in one processing module. The integrated modules may be implemented in hardware or in software functional modules. It should be noted that, in the embodiment of the present application, the division of the modules is schematic, which is merely a logic function division, and other division manners may be implemented in actual implementation. For example, in the case of dividing the respective functional modules by the respective functions, the load balancing configuration apparatus 110 shown in fig. 6 is only one apparatus schematic diagram. The load balancing configuration apparatus 110 may include a configuration registration module 111, a field modification module 112, and an adjustment module 113, and the functions of each functional module of the load balancing configuration apparatus 110 are described in detail below.
The configuration registration module 111 is configured to configure a plurality of load balancing instances, and for each configured load balancing instance, register, according to the name service, an address list of a load balancing node corresponding to each selected service packet onto the load balancing instance. It is understood that the configuration registration module 111 may be used to perform the step S110 described above, and reference may be made to the details of the implementation of the configuration registration module 111 regarding the step S110 described above.
The field modifying module 112 is configured to modify a record adjustment field of each record in the preset load balancing information table, where the record adjustment field includes a record of the service packet, when the name service monitors that an address list of a load balancing node corresponding to any one of the service packets is changed. It will be appreciated that the field modification module 112 may be used to perform step S120 described above, and reference may be made to the details of the implementation of the field modification module 112 as described above with respect to step S120.
The adjustment module 113 is configured to traverse and find a record adjustment field in each record from the load balancing information table according to a preset polling task, and adjust an address list of a load balancing node registered on each load balancing instance according to the record adjustment field in each record. It is understood that the adjustment module 113 can be used to perform the step S130 described above, and reference can be made to the details of the implementation of the adjustment module 1132 related to the step S130.
In one possible implementation, the configuration registration module 111 may configure the plurality of load balancing instances by:
acquiring load balancing configuration interfaces and load balancing configuration parameter types of each load balancing service provider;
accessing each load balancing configuration interface into a load balancing instance registration interface, and determining the same load balancing configuration parameter type in each load balancing server as the instance registration parameter type of the load balancing instance registration interface;
according to the instance registration parameters compiled in the instance registration parameter types of the load balancing instance registration interface, the selected load balancing configuration interface is accessed to configure the corresponding load balancing instance.
In one possible implementation, the load balancing configuration apparatus 110 may include a subscription binding module that may be used to subscribe to each service group selected in the name service and bind a corresponding listener for each service group.
In one possible implementation, the field modification module 112 may modify the record adjustment field of each record in the preset load balancing information table containing the service packet by:
detecting an address list of a load balancing node corresponding to each subscribed service packet through name service;
when the address list of the load balancing node corresponding to any service packet is detected to be changed, triggering a change event to a monitor corresponding to the service packet through name service;
searching a record adjustment field of each record containing the service group in a preset load balancing information table according to the change event by a monitor, and modifying each searched record adjustment field into a change moment indicated in the change event.
In one possible implementation, the adjustment module 113 may adjust the address list of the load balancing nodes registered on each load balancing instance by:
according to a preset polling task, polling every preset time period, traversing and searching a record adjustment field in each record from a load balancing information table, and determining a target record with the record adjustment field modified;
traversing each target service group in each target record, and searching a load balancing node list corresponding to the target service group;
comparing the load balancing node list with an address list of a load balancing node corresponding to a target service group obtained through name service, and determining a first node address list needing to be added and a second node address list needing to be reduced;
and adjusting the address list of the load balancing node registered on the load balancing instance corresponding to the target service packet according to the determined first node address list and the second node address list.
In one possible implementation, the adjustment module 113 may adjust the address list of the load balancing node registered on the load balancing instance corresponding to the target service packet by:
registering the first node address list on the load balancing instance corresponding to the target service packet, and unregistering the second node address list from the load balancing instance corresponding to the target service packet.
In one possible implementation, an atom boolean variable is defined in the preset polling task, the atom boolean variable is used to characterize the task state of each polling task, and the adjustment module 113 drumstick may be used to:
performing polling tasks in series every preset time period, wherein the polling tasks are to search record adjustment fields in each record through traversal from a load balancing information table, and determine target records with the record adjustment fields modified;
when each polling task is executed, judging whether the task state represented by the atomic Boolean variable in the polling task is a task completion state or not;
if the task state represented by the atomic Boolean variable in the polling task is the task completion state, executing the next polling task;
if the task state represented by the atomic Boolean variable in the polling task is not the task completion state, continuing to execute the polling task until the task state represented by the atomic Boolean variable in the polling task is the task completion state, and executing the next polling task.
In one possible implementation manner, the load balancing configuration apparatus 110 may include a marking module, where the marking module may be configured to add a first node address list to the load balancing node instance table, add a new mark to the first node address list, and add a delete mark to the second node address list in the load balancing node instance table.
Referring to fig. 7, a schematic block diagram of a server 100 for performing the above load balancing configuration method according to an embodiment of the present application is shown, where the server 100 may include a load balancing configuration apparatus 110, a machine-readable storage medium 120, and a processor 130.
In this embodiment, the machine-readable storage medium 120 and the processor 130 are both located in the server 100 and are separately provided. However, it should be understood that the machine-readable storage medium 120 may also be separate from the server 100 and accessible by the processor 130 through a bus interface. In the alternative, machine-readable storage medium 120 may be integrated into processor 130, and may be, for example, a cache and/or general purpose registers.
The processor 130 is a control center of the server 100 and connects various portions of the entire server 100 using various interfaces and lines to perform various functions and processes of the server 100 by running or executing software programs and/or modules stored in the machine-readable storage medium 120 and invoking data stored in the machine-readable storage medium 120, thereby performing overall monitoring of the server 100. Optionally, the processor 130 may include one or more processing cores; for example, processor 130 may integrate an application processor that primarily handles operating systems, user interfaces, applications, etc., with a modem processor that primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor.
The processor 130 may be a general-purpose central processing unit (Central Processing Unit, CPU), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the load balancing configuration method provided in the above method embodiment.
The machine-readable storage medium 120 may be, but is not limited to, ROM or other type of static storage device, RAM or other type of dynamic storage device, which may store static information and instructions, or Electrically Erasable Programmabler-Only MEMory (EEPROM), compact Read-Only MEMory (CD-ROM) or other optical disk storage, optical disk storage (including compact disk, laser disk, optical disk, digital versatile disk, blu-ray disk, etc.), magnetic disk storage or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer. The machine-readable storage medium 120 may reside separately and be coupled to the processor 130 by a communication bus. The machine-readable storage medium 120 may also be integral to the processor. Wherein the machine-readable storage medium 120 is used to store machine-executable instructions for performing aspects of the present application. The processor 130 is configured to execute machine-executable instructions stored in the machine-readable storage medium 120 to implement the load balancing configuration method provided by the foregoing method embodiments.
The load balancing configuration apparatus 110 may include software functional modules stored in the machine-readable storage medium 120 (e.g., the configuration registration module 111, the field modification module 112, and the adjustment module 113 shown in fig. 6), which when executed by the processor 130, implement the load balancing configuration method provided by the foregoing method embodiments.
Since the server 100 provided in the embodiment of the present application is another implementation form of the method embodiment executed by the server 100, and the server 100 may be used to execute the load balancing configuration method provided in the method embodiment, the technical effects that can be obtained by the method embodiment may refer to the method embodiment and will not be described herein.
Further, the embodiment of the application further provides a readable storage medium containing computer executable instructions, which when executed, can be used to implement the load balancing configuration method provided by the above method embodiment.
Embodiments of the present application are described with reference to flowchart illustrations and/or block diagrams of methods, apparatus and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Although the present application has been described herein in connection with various embodiments, other variations to the disclosed embodiments can be understood and effected by those skilled in the art in practicing the claimed application, from a review of the figures, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other elements or steps, and the "a" or "an" does not exclude a plurality. A single processor or other unit may fulfill the functions of several items recited in the claims. The mere fact that certain measures are recited in mutually different dependent claims does not indicate that a combination of these measures cannot be used to advantage.
The foregoing is merely various embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the present application, and the changes and substitutions are intended to be covered in the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (9)

1. A method for load balancing configuration, applied to a server, the method comprising:
configuring a plurality of load balancing examples, and registering an address list of a load balancing node corresponding to each selected service group on each configured load balancing example according to name service;
subscribing each selected service group in the name service, and binding a corresponding listener for each service group;
when the name service monitors that the address list of the load balancing node corresponding to any service packet is changed, a record adjustment field of each record containing the service packet in a preset load balancing information table is modified;
traversing and searching a record adjustment field in each record from the load balancing information table according to a preset polling task, and adjusting an address list of a load balancing node registered on each load balancing instance according to the record adjustment field in each record;
when the name service monitors that the address list of the load balancing node corresponding to any one service packet is changed, the step of modifying a record adjustment field of each record containing the service packet in a preset load balancing information table comprises the following steps:
detecting an address list of a load balancing node corresponding to each subscribed service packet through the name service;
when the address list of the load balancing node corresponding to any service group is detected to be changed, triggering a change event to a monitor corresponding to the service group through the name service;
and searching a record adjustment field of each record containing the service group in a preset load balancing information table according to the change event by the monitor, and modifying each searched record adjustment field into a change moment indicated in the change event.
2. The load balancing configuration method according to claim 1, wherein the step of configuring a plurality of load balancing instances comprises:
acquiring load balancing configuration interfaces and load balancing configuration parameter types of each load balancing service provider;
accessing each load balancing configuration interface into a load balancing instance registration interface, and determining the same load balancing configuration parameter type in each load balancing server as the instance registration parameter type of the load balancing instance registration interface;
and accessing the selected load balancing configuration interface to configure the corresponding load balancing instance according to the instance registration parameters compiled in the instance registration parameter types of the load balancing instance registration interface.
3. The load balancing configuration method according to claim 1 or 2, wherein the step of traversing and searching the record adjustment field in each record from the load balancing information table according to a preset polling task, and adjusting the address list of the load balancing node registered on each load balancing instance according to the record adjustment field in each record includes:
according to a preset polling task, polling the record adjustment field in each record from the load balancing information table every preset time period, and determining a target record with the record adjustment field modified;
traversing each target service group in each target record, and searching a load balancing node list corresponding to the target service group;
comparing the load balancing node list with an address list of a load balancing node corresponding to the target service group obtained through the name service, and determining a first node address list needing to be added and a second node address list needing to be reduced;
and adjusting the address list of the load balancing node registered on the load balancing instance corresponding to the target service packet according to the determined first node address list and the second node address list.
4. The load balancing configuration method according to claim 3, wherein the step of adjusting the address list of the load balancing node registered on the load balancing instance corresponding to the target service packet according to the determined first node address list and the second node address list includes:
registering the first node address list on the load balancing instance corresponding to the target service packet, and unregistering the second node address list from the load balancing instance corresponding to the target service packet.
5. The load balancing configuration method according to claim 3, wherein an atomic boolean variable is defined in the preset polling task, the atomic boolean variable is used for characterizing a task state of each polling task, and the step of polling every preset time period to find a record adjustment field in each record from the load balancing information table, and determining a target record modified by the record adjustment field includes:
performing polling tasks in series every preset time period, wherein the polling tasks are to search record adjustment fields in each record in a traversing manner from the load balancing information table, and determining target records with the record adjustment fields modified;
when each polling task is executed, judging whether the task state represented by the atomic Boolean variable in the polling task is a task completion state or not;
if the task state represented by the atomic Boolean variable in the polling task is the task completion state, executing the next polling task;
if the task state represented by the atomic Boolean variable in the polling task is not the task completion state, continuing to execute the polling task until the task state represented by the atomic Boolean variable in the polling task is the task completion state, and executing the next polling task.
6. A load balancing configuration method according to claim 3, characterized in that the method further comprises:
and adding the first node address list in a load balancing node instance table, adding a new adding mark for the first node address list, and adding a deleting mark for the second node address list in the load balancing node instance table.
7. A load balancing configuration apparatus, for application to a server, the apparatus comprising:
the configuration registration module is used for configuring a plurality of load balancing examples, and registering an address list of a load balancing node corresponding to each selected service group to each configured load balancing example according to name service;
a subscription binding module, configured to subscribe each selected service group in the name service, and bind a corresponding listener for each service group;
the field modification module is used for modifying a record adjustment field of each record containing any service packet in a preset load balancing information table when the name service monitors the change of the address list of the load balancing node corresponding to the service packet;
the adjustment module is used for traversing and searching record adjustment fields in each record from the load balancing information table according to a preset polling task, and adjusting an address list of the load balancing node registered on each load balancing instance according to the record adjustment fields in each record;
the field modification module is specifically configured to:
detecting an address list of a load balancing node corresponding to each subscribed service packet through the name service;
when the address list of the load balancing node corresponding to any service group is detected to be changed, triggering a change event to a monitor corresponding to the service group through the name service;
and searching a record adjustment field of each record containing the service group in a preset load balancing information table according to the change event by the monitor, and modifying each searched record adjustment field into a change moment indicated in the change event.
8. A server comprising a machine-readable storage medium storing machine-executable instructions and a processor that, when executing the machine-executable instructions, implements the load balancing configuration method of any one of claims 1-6.
9. A readable storage medium having stored therein machine executable instructions that when executed implement the load balancing configuration method of any one of claims 1-6.
CN202010002254.2A 2020-01-02 2020-01-02 Load balancing configuration method, device, server and readable storage medium Active CN111221651B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010002254.2A CN111221651B (en) 2020-01-02 2020-01-02 Load balancing configuration method, device, server and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010002254.2A CN111221651B (en) 2020-01-02 2020-01-02 Load balancing configuration method, device, server and readable storage medium

Publications (2)

Publication Number Publication Date
CN111221651A CN111221651A (en) 2020-06-02
CN111221651B true CN111221651B (en) 2023-05-16

Family

ID=70810683

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010002254.2A Active CN111221651B (en) 2020-01-02 2020-01-02 Load balancing configuration method, device, server and readable storage medium

Country Status (1)

Country Link
CN (1) CN111221651B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115086334B (en) * 2022-06-15 2024-05-28 北京奇艺世纪科技有限公司 Server marking method and related device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100456690C (en) * 2003-10-14 2009-01-28 北京邮电大学 Whole load equalizing method based on global network positioning
EP3266169A4 (en) * 2015-12-28 2018-09-12 Hewlett-Packard Enterprise Development LP Packet distribution based on an identified service function
CN108449282B (en) * 2018-05-29 2021-12-21 华为技术有限公司 Load balancing method and device
CN110113399A (en) * 2019-04-24 2019-08-09 华为技术有限公司 Load balancing management method and relevant apparatus

Also Published As

Publication number Publication date
CN111221651A (en) 2020-06-02

Similar Documents

Publication Publication Date Title
KR102541295B1 (en) Operating system customization in an on-demand networked code execution system
US9122560B2 (en) System and method of optimization for mobile apps
US10225145B2 (en) Method and device for updating client
CN112099800B (en) Code data processing method, device and server
US20170329828A1 (en) Metadata tables for time-series data management
CN111355816B (en) Server selection method, device, equipment and distributed service system
US20190327105A1 (en) Method and apparatus for pushing information
CN107291744A (en) It is determined that and with the method and device of the relationship between application program
CN113656168A (en) Method, system, medium and equipment for automatic disaster recovery and scheduling of traffic
CN104216698A (en) Webpage registration method and relative device
CN111784468B (en) Account association method and device and electronic equipment
CN111225018A (en) Request message processing method and device and electronic equipment
CN110430255A (en) The processing method of service request, system and electronic equipment in distributed type assemblies
CN110046100B (en) Packet testing method, electronic device and medium
CN112463808A (en) Data processing method and device of target cluster and server
CN111221651B (en) Load balancing configuration method, device, server and readable storage medium
CN109918118B (en) Service line registration method and related equipment
CN115033551A (en) Database migration method and device, electronic equipment and storage medium
CN108647102B (en) Service request processing method and device of heterogeneous system and electronic equipment
CN114064712A (en) Data access method and device, electronic equipment and computer readable storage medium
JP2005228183A (en) Program execution method and computer system for executing the program
CN116467315A (en) Analysis method, device, equipment and storage medium of behavior data
CN111142990A (en) WeChat applet page display method and device and storage medium
CN108133123B (en) Application program identification method and system
CN111367683A (en) Result obtaining method, device and equipment

Legal Events

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