Load balancing processing method and device for publishing application tasks
By obtaining the path information in the load balancing configuration file and the parameters in the target cache database, the problem of frequent loading of the seven-layer Nginx load balancing configuration file is solved, the load balancing processing performance of publishing application tasks is improved, and real-time parallel processing is achieved.
Patent Information
- Application Number
- CN202210951474.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-09
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2042-08-09
AI Technical Summary
When the existing seven-layer Nginx load balancing handles massive data requests, configuration files are frequently loaded, resulting in a waste of resources and affecting the parallel processing capabilities of the publishing system.
By obtaining the path information in the load balancing configuration file, find matching load balancing logic information, and obtain matching load balancing parameters from the target cache database, perform application task release, avoid frequent loading of load balancing virtual service pool configuration, and process release in real-time in parallel Task.
It improves the load balancing processing performance of publishing application tasks, reduces resource waste, and realizes real-time parallel processing.
Smart Images

Figure CN115277573B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet technology, and in particular to a load balancing processing method and device. Background Art
[0002] Load balancing (LB) is an essential key component of high-concurrency and high-availability systems, which tries to evenly distribute network traffic to multiple servers to improve the overall response speed and availability of the system. Load balancing includes hardware load balancing and software load balancing. The seven-layer Nginx load balancing is a software load balancing that can proxy and forward client requests to a group of upstream virtual service pools.
[0003] At present, major application parties usually use seven-layer Nginx load balancing to process data requests to ensure the throughput of massive data. However, due to the gradual increase in application systems, the number of requests in the server is also increasing, and the number of load balancing configuration files is also increasing. When a new application task is released, it is necessary to request operations on the server, which will load a large number of Nginx upstream load balancing configuration operations frequently, causing serious resource loss to the system, making it impossible for the release system to process the released application tasks in parallel, thereby affecting the load balancing processing capacity of the released application tasks. Summary of the invention
[0004] In view of this, the present invention provides a method and device for load balancing processing of publishing application tasks, the main purpose of which is to solve the problem of poor load balancing processing capability of the existing publishing application tasks.
[0005] According to one aspect of the present invention, a load balancing processing method for publishing application tasks is provided, comprising:
[0006] When an application task publishing request is received, a load balancing configuration file is obtained, wherein the load balancing configuration file stores path information associated with a load balancing configuration directory, and the load balancing configuration directory is compiled using a lightweight scripting language;
[0007] Searching the load balancing logic information in the load balancing configuration directory for the load balancing logic information that matches the request parameters carried in the application task publishing request through the path information;
[0008] A load balancing parameter matching the load balancing logic information is obtained from the target cache database, and the application task is released in combination with the load balancing logic information and the load balancing parameter.
[0009] Furthermore, before obtaining the load balancing configuration file, the method further includes:
[0010] Obtaining load balancing configuration information to be updated, and splitting the load balancing configuration information to obtain load balancing logic information to be updated and load balancing parameters to be updated;
[0011] The load balancing parameters to be updated are stored, and a directory compilation instruction carrying the load balancing logic information to be updated is sent to the load balancing server, so that the load balancing server compiles and constructs a load balancing configuration directory according to the load balancing logic information;
[0012] The path information corresponding to the load balancing configuration directory compiled and constructed by the load balancing server is obtained, and the path information is updated and configured in the load balancing configuration files corresponding to the release requests of different application tasks.
[0013] Further, the obtaining of the load balancing configuration information to be updated and splitting the load balancing configuration information to obtain the load balancing logic information to be updated and the load balancing parameters to be updated include:
[0014] Sending a load balancing configuration instruction to the application task system to instruct the application task system to receive the load balancing configuration information entered by the user;
[0015] Obtaining load balancing configuration information fed back by the application task system;
[0016] The load balancing configuration information is split according to the string type and data format to obtain the load balancing logic information to be updated and the load balancing parameters to be updated.
[0017] Furthermore, before updating and configuring the path information in the load balancing configuration files corresponding to the different application task publishing requests, the method further includes:
[0018] Storing the historical path information of the load balancing configuration file in a non-cache database, and recording the historical load balancing logic information corresponding to different search times in the non-cache database;
[0019] Clear the load balancing configuration file.
[0020] Furthermore, after searching the load balancing logic information in the load balancing configuration directory through the path information and matching the request parameters carried in the application task publishing request, the method further includes:
[0021] If the load balancing logic information matching the request parameters is not found in the load balancing configuration directory through the path information, obtaining the historical path information in the non-cache database;
[0022] The historical load balancing logic information with the largest number of searches is searched through the historical path information, and the historical load balancing parameters matching the historical load balancing logic information are acquired from the target cache database to execute the release of the application task.
[0023] Further, the acquiring the load balancing parameters matching the load balancing logic information from the target cache database includes:
[0024] If the target cache database does not store the load balancing parameters matching the load balancing logic information, the historical load balancing parameters are obtained to execute the release of the application task in combination with the load balancing logic information and the historical load balancing parameters.
[0025] Further, the publishing of the application task in combination with the load balancing logic information and the load balancing parameters includes:
[0026] Sending an application task publishing execution instruction to a target load balancing server to instruct the target load balancing server to create a coroutine matching the application task according to the load balancing logic information and the load balancing parameters;
[0027] When a response to the completion of creating a coroutine is received, the load balancing logic information and the load balancing parameters are sent to the target load balancing server to publish application tasks in the corresponding coroutine according to the load balancing logic information and the load balancing parameters.
[0028] According to another aspect of the present invention, a load balancing processing device for issuing application tasks is provided, comprising:
[0029] An acquisition module, configured to acquire a load balancing configuration file when receiving an application task publishing request, wherein the load balancing configuration file stores path information associated with a load balancing configuration directory, and the load balancing configuration directory is compiled by a lightweight scripting language;
[0030] A search module, used to search the load balancing logic information in the load balancing configuration directory according to the path information and matching the request parameters carried in the application task publishing request;
[0031] The execution module is used to obtain the load balancing parameters matching the load balancing logic information from the target cache database, and execute the release of the application task in combination with the load balancing logic information and the load balancing parameters.
[0032] Furthermore, the device also includes:
[0033] A splitting module, used to obtain the load balancing configuration information to be updated, and split the load balancing configuration information to obtain the load balancing logic information to be updated and the load balancing parameters to be updated;
[0034] A sending module, used for storing the load balancing parameters to be updated, and sending a directory compilation instruction carrying the load balancing logic information to be updated to the load balancing server, so that the load balancing server compiles and constructs a load balancing configuration directory according to the load balancing logic information;
[0035] The update module is used to obtain the path information corresponding to the load balancing configuration directory compiled and constructed by the load balancing server, and update the path information in the load balancing configuration files corresponding to different application task publishing requests.
[0036] Furthermore, the splitting module is specifically used to send a load balancing configuration instruction to the application task system to instruct the application task system to receive the load balancing configuration information entered by the user; obtain the load balancing configuration information fed back by the application task system; split the load balancing configuration information according to the string type and data format to obtain the load balancing logic information to be updated and the load balancing parameters to be updated.
[0037] Furthermore, the device also includes:
[0038] A recording module, used to store the historical path information of the load balancing configuration file in a non-cache database, and record the historical load balancing logic information corresponding to different search times in the non-cache database;
[0039] The clearing module is used to clear the load balancing configuration file.
[0040] Furthermore, the acquisition module is also used to obtain historical path information from the non-cache database if the load balancing logic information matching the request parameters is not found in the load balancing configuration directory through the path information; to search for the historical load balancing logic information with the largest number of searches through the historical path information, and to obtain historical load balancing parameters matching the historical load balancing logic information from the target cache database to execute the release of the application task.
[0041] Furthermore, the acquisition module is specifically used to acquire the historical load balancing parameters if the target cache database does not store load balancing parameters matching the load balancing logic information, so as to execute the release of the application task in combination with the load balancing logic information and the historical load balancing parameters.
[0042] Furthermore, the sending module is also used to send an application task publishing execution instruction to the target load balancing server to instruct the target load balancing server to create a coroutine matching the application task according to the load balancing logic information and the load balancing parameters; when a coroutine creation completion response is received, the load balancing logic information and the load balancing parameters are sent to the target load balancing server to publish the application task in the corresponding coroutine according to the load balancing logic information and the load balancing parameters.
[0043] According to another aspect of the present invention, a storage medium is provided, wherein at least one executable instruction is stored in the storage medium, and the executable instruction enables a processor to execute operations corresponding to the load balancing processing method for issuing application tasks as described above.
[0044] According to another aspect of the present invention, there is provided a computer device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus;
[0045] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute operations corresponding to the load balancing processing method for issuing application tasks.
[0046] By means of the above technical solution, the technical solution provided by the embodiment of the present invention has at least the following advantages:
[0047] The present invention provides a load balancing processing method and device for publishing application tasks. Compared with the prior art, the embodiment of the present application obtains a load balancing configuration file when receiving an application task publishing request, wherein the load balancing configuration file stores path information associated with a load balancing configuration directory, and the load balancing configuration directory is compiled by a lightweight scripting language; the load balancing logic information matching the request parameter carried in the application task publishing request is searched in the load balancing configuration directory through the path information; the load balancing parameters matching the load balancing logic information are obtained from a target cache database, and the application task is published in combination with the load balancing logic information and the load balancing parameters, so that when executing the application task publishing operation, the load balancing logic information is first obtained based on the path information in the configuration file, and then the load balancing parameters matching the load balancing logic information are obtained from the target cache database according to the load balancing logic information, and then the application task is published, so that there is no need to frequently load the load balancing configuration in the load balancing virtual service pool, thus avoiding the problem of resource waste, and the published application tasks can be processed in real time and in parallel, thereby improving the load balancing processing performance of publishing application tasks.
[0048] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0050] Figure 1 A flow chart of a load balancing processing method for publishing application tasks provided by an embodiment of the present invention is shown;
[0051] Figure 2 A flow chart of another load balancing processing method for publishing application tasks provided by an embodiment of the present invention is shown;
[0052] Figure 3 A flow chart of another load balancing processing method for publishing application tasks provided by an embodiment of the present invention is shown;
[0053] Figure 4 A block diagram showing a load balancing processing device for issuing application tasks provided by an embodiment of the present invention;
[0054] Figure 5 A schematic structural diagram of a computer device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0055] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0056] At present, major application parties usually use seven-layer Nginx load balancing to process data requests to ensure the throughput of massive data. However, due to the gradual increase in application systems, the number of requests in the server is also increasing, and the number of load balancing configuration files is also increasing. When a new application task is released, it is necessary to operate the server request, which will load a large number of Nginx upstream load balancing configuration operations frequently, causing serious resource loss to the system, making it impossible for the release system to process the released application tasks in parallel, thereby affecting the load balancing processing capability of the released application tasks. The embodiment of the present invention provides a load balancing processing method for releasing application tasks, such as Figure 1 As shown, the method includes:
[0057] 101. When an application task publishing request is received, a load balancing configuration file is obtained.
[0058] In the embodiment of the present invention, the execution subject is a server for executing configuration operations related to load balancing, and together with the application task publishing system, constitutes a load balancing processing system for publishing application tasks. It should be noted that in order to distribute a large number of requests from clients and / or browsers to multiple servers for response to improve the throughput and request performance of the network system, it is necessary to perform request distribution operations based on the load balancing configuration. For this purpose, the execution subject can receive and respond to the application task publishing request, that is, determine the load balancing configuration corresponding to the release of the current task, and then trigger the application task publishing system to publish the application task.
[0059] Specifically, after receiving the application task publishing request, the execution subject obtains the load balancing configuration file, so as to obtain the load balancing configuration logic information and load balancing parameters according to the configuration file, and determines the load balancing-related configuration of the current application task based on the load balancing configuration logic information and load balancing parameters. Among them, the application task publishing request can be a publishing request for the first release of an application, or a publishing request for executing the online or offline execution of an already released application. For example, the application task publishing request can be a protocol request (http, https, DNS, etc.) based on application layer information such as URL, but is not limited thereto.
[0060] Furthermore, the configuration file stores path information associated with the load balancing configuration directory, and the path information is used to indicate the storage location of the load balancing configuration directory, so as to obtain the load balancing configuration directory based on the path information. Specifically, the load balancing directory in the embodiment of the present application is compiled based on the Lua lightweight scripting language. By embedding the Lua lightweight script into the load balancing so that the Lua lightweight script is executed during the load balancing process, a large number of requests can be processed with high concurrency and non-blocking, thereby improving the load balancing processing performance of publishing application tasks.
[0061] 102. Search the load balancing logic information in the load balancing configuration directory through the path information and the load balancing logic information matching the request parameters carried in the application task publishing request.
[0062] Among them, the load balancing logic information can be the load balancing logic information required for executing load balancing operations for application task release, for example, it can be the mapping relationship between the task release of each application module and the server when the application task is released, the calling logic of multiple servers during load balancing, the server status response logic, etc., and the request parameter released by the application task can be a unique identifier for identifying the application, such as the application name, a preset code corresponding to the application, a release address corresponding to the application, etc. The embodiment of the present application does not make specific limitations on this.
[0063] According to the above step 101, based on the path information associated with the load balancing configuration directory stored in the configuration file, the load balancing configuration directory can be obtained, so that the load balancing logic information corresponding to the current application task release request can be queried based on the load balancing configuration directory. In the specific implementation process, the load balancing logic information corresponding to different request parameters can be saved in the load balancing configuration directory compiled based on the Lua lightweight scripting language, such as establishing a mapping relationship between request parameters and load balancing logic parameters, or generating an index for searching for corresponding load balancing logic information according to request parameters, so that the execution subject can obtain the load balancing logic information from the load balancing configuration directory according to the request parameters, but this is only an example, and the specific implementation method of step 102 is not limited in this application embodiment.
[0064] 103. Obtain a load balancing parameter that matches the load balancing logic information from a target cache database, and publish the application task in combination with the load balancing logic information and the load balancing parameter.
[0065] Among them, the target cache database can be a Redis cache database. During the specific implementation process, when there are application tasks to be released in the load balancing processing system for releasing application tasks, the updated load balancing configuration information will be stored in the Redis cache database during the deployment process, especially the load balancing configuration parameters, such as the time parameters and throughput parameters for each server that executes the current application task release to execute the application task release. Storing the updated load balancing configuration information in the Redis cache database can ensure the timeliness of the configuration balancing configuration information, so as to execute the release of application tasks based on real-time load balancing parameters. In addition, by embedding the Lua lightweight script in the configuration file, the execution subject can link to the Redis cache database and obtain the load balancing parameters based on the Lua lightweight script after obtaining the configuration file.
[0066] In an embodiment of the present application, by storing the updated load balancing parameters in the target database, when there is an application task to be released, the execution entity can obtain the path information of the load balancing configuration directory and search the load balancing logic corresponding to the current application task release from the load balancing configuration directory based on the path information, and then query the load balancing parameters matching the load balancing logic from the target database, so as to perform the load balancing application task release operation according to the load balancing logic and load balancing parameters, so that there is no need to frequently load the load balancing configuration in the load balancing virtual service pool, thus avoiding the problem of resource waste, and being able to process the released application tasks in real time and in parallel, thereby improving the load balancing processing performance of releasing application tasks.
[0067] In another embodiment of the present invention, in order to further define and illustrate, as Figure 2 As shown, before obtaining the load balancing configuration file in step 101, the method further includes:
[0068] 201. Obtain load balancing configuration information to be updated, and split the load balancing configuration information to obtain load balancing logic information to be updated and load balancing parameters to be updated.
[0069] 202. Store the load balancing parameters to be updated, and send a directory compilation instruction carrying the load balancing logic information to be updated to the load balancing server.
[0070] 203. Obtain path information corresponding to the load balancing configuration directory compiled and constructed by the load balancing server, and update the path information in the load balancing configuration files corresponding to different application task publishing requests.
[0071] Among them, the load balancing configuration information is all the information related to load balancing when executing the application task publishing operation. Further, the load balancing configuration information at least includes load balancing logic information, such as one or more servers that execute the application task publishing and the calling logic of one or more servers, and load balancing parameters, such as the status response parameters of each server, the application task publishing time parameters, and the throughput parameters. Specifically, the load balancing information can be obtained through a preset port, or can be obtained through a data transmission medium. The embodiments of the present application do not specifically limit this. Usually, when the load balancing configuration information is updated, the load balancing parameters are updated. Therefore, in order to avoid the problem of resource waste and poor load balancing processing performance caused by frequently loading all the load balancing configuration file information in the virtual service pool when the application task is released, after the load balancing configuration information to be updated is obtained, the embodiments of the present application split the load balancing configuration information to obtain the load balancing logic information and the load balancing parameters, so as to obtain the two parts of the load balancing configuration information respectively to improve the load balancing processing performance. The splitting method of the load balancing configuration information can be a preset splitting algorithm, a preset splitting rule, etc. for splitting the load balancing configuration information into the load balancing logic and the load balancing parameters, and the embodiments of the present application do not limit this.
[0072] Furthermore, after the execution subject splits the load balancing logic and the load balancing parameters according to the load balancing configuration information to be updated, it triggers the generation of the load balancing configuration directory according to the load balancing logic. Specifically, the load balancing configuration directory can be automatically generated by the load balancing server based on the load balancing logic information, or the load balancing server sends directory compilation prompt information to relevant staff through the terminal device after receiving the directory compilation instruction sent by the execution subject and receives the load balancing configuration directory based on manual feedback, so that the load balancing server compiles and constructs the load balancing configuration directory according to the load balancing logic information. The embodiment of the present application does not limit this. At the same time, the load balancing parameters to be updated are stored in the target cache database, so that the load balancing parameters matching the load balancing logic information can be searched in the target cache database, which greatly reduces the system pressure of the system updating data.
[0073] It should be noted that in order to concurrently execute the release of multiple application tasks in the load balancing processing system for releasing application tasks, multiple load balancing configuration directories serving different application task releases are stored in the database corresponding to the load balancing configuration server. Therefore, in order to ensure the accuracy of the load balancing application task release and execution, after the execution subject obtains the load balancing configuration directory corresponding to the load balancing configuration information, it further obtains the storage path of the load balancing configuration directory, and updates the path information in the load balancing configuration files corresponding to different application task release requests, so as to accurately obtain the matching load balancing configuration directory based on the storage path when executing the load balancing configuration operation, thereby improving the accuracy of load balancing processing when the application task is released.
[0074] In another embodiment of the present invention, for further definition and explanation, the step of obtaining the load balancing configuration information to be updated, and splitting the load balancing configuration information to obtain the load balancing logic information to be updated and the load balancing parameters to be updated includes:
[0075] Sending a load balancing configuration instruction to the application task system to instruct the application task system to receive the load balancing configuration information entered by the user;
[0076] Obtaining load balancing configuration information fed back by the application task system;
[0077] The load balancing configuration information is split according to the character string type and data format to obtain the load balancing logic information to be updated and the load balancing parameters to be updated.
[0078] In an embodiment of the present application, when the execution subject executes the load balancing processing operation of publishing the application task based on the load balancing configuration information corresponding to the application task, and the load balancing configuration information is entered by the user based on the application task system, during the specific implementation process, the execution subject sends a load balancing configuration information configuration instruction to the application task system, so that after receiving the configuration instruction, the application task system receives the load balancing configuration information entered by the user and feeds it back to the execution subject, so that the execution subject splits the received load balancing configuration information according to the string type, data format, etc., and obtains the load balancing logic information to be updated and the load balancing parameters to be updated.
[0079] In another embodiment of the present invention, for further definition and explanation, before the step of updating the path information in the load balancing configuration files corresponding to the different application task publishing requests, the method further includes:
[0080] Storing the historical path information of the load balancing configuration file in a non-cache database, and recording the historical load balancing logic information corresponding to different search times in the non-cache database;
[0081] Clear the load balancing configuration file.
[0082] Among them, the non-cached database can be any existing persistent database and / or local database. When the execution subject splits the load balancing configuration information to be updated to obtain the load balancing logic information and load balancing parameters corresponding to the application task release, and saves these two load balancing data in different locations respectively, the path information generated according to the load balancing logic information is stored in the load balancing configuration file. However, in the actual practice, the load balancing configuration file may store the path information corresponding to the last execution of the application task release. Therefore, in order to ensure the accuracy of the data during the load balancing process, before storing the path information corresponding to the current application task release in the load balancing configuration file, the historical storage data in the load balancing configuration file needs to be deleted.
[0083] Furthermore, in order to ensure the comprehensiveness of application task release data and improve the data missing response performance of load balancing processing, the historical path information is stored in a non-cache database for path information backup before deleting the historical path information of the load balancing configuration file. At the same time, the number of accesses to the historical path information in the load balancing configuration file is accumulated and the access times are stored in the non-cache database corresponding to the historical path information. When the current path information is missing or the load balancing logic information cannot be obtained based on the current path information, the historical path information can be called from the non-cache database, thereby improving the fault tolerance performance of the application task release load balancing processing system.
[0084] In another embodiment of the present invention, for further definition and explanation, after searching the load balancing logic information in the load balancing configuration directory through the path information that matches the request parameters carried in the application task publishing request, the method further includes:
[0085] If the load balancing logic information matching the request parameters is not found in the load balancing configuration directory through the path information, obtaining the historical path information in the non-cache database;
[0086] The historical load balancing logic information with the largest number of searches is searched through the historical path information, and the historical load balancing parameters matching the historical load balancing logic information are acquired from the target cache database to execute the release of the application task.
[0087] In an embodiment of the present application, through the above steps, before clearing the historical path information in the load balancing configuration file, the historical path information and the number of times the historical path information is accessed are correspondingly stored in a non-cache database to back up the historical path information. This allows the execution subject to further obtain the backed-up historical path information and obtain the load balancing configuration directory corresponding to the historical path information based on the historical path information, and query the load balancing logic information based on the load balancing configuration directory, thereby realizing load balancing processing of application task release.
[0088] It should be noted that when the load balancing configuration file published by the application task is updated, the updated part is usually the load balancing parameters, while the load balancing logic information remains unchanged. For this reason, the load balancing configuration directory can be obtained based on the historical path information when the current path information is invalid, and then the load balancing logic information can be queried from the load balancing configuration directory. When the application task publishes multiple historical path information, it can be filtered according to the number of accesses that can identify the reliability of the historical path information, that is, the more times the historical path information is accessed, the stronger its corresponding reliability is. When obtaining backup data, the load balancing logic information is obtained based on the historical path information with the most search times, so as to improve the fault tolerance of the load balancing processing published by the application task and improve the accuracy of the load balancing processing.
[0089] In another embodiment of the present invention, for further definition and explanation, the step of obtaining a load balancing parameter matching the load balancing logic information from the target cache database includes:
[0090] If the target cache database does not store the load balancing parameters matching the load balancing logic information, the historical load balancing parameters are obtained to execute the release of the application task in combination with the load balancing logic information and the historical load balancing parameters.
[0091] After the execution subject obtains the load balancing logic information based on the path information in the current load balancing file, it is necessary to further obtain the load balancing parameters that match the load balancing logic information. Since the load logic information and its matching load balancing parameters are obtained by splitting the same load balancing configuration information to be updated, when querying the load balancing parameters, the query can be based on the preset configuration file information identifier, but is not limited to this. Similarly, when the execution subject does not query the updated load balancing parameters in the target cache data, the backup historical load balancing parameters can be obtained, so as to execute the release of the application task according to the historical load balancing parameters and the current load balancing logic information, so as to improve the fault tolerance of the load balancing processing of the application task release.
[0092] In another embodiment of the present invention, in order to further define and illustrate, as Figure 3 As shown, in step 103, the release of the application task in combination with the load balancing logic information and the load balancing parameters includes:
[0093] 301. Send an application task publishing execution instruction to a target load balancing server to instruct the target load balancing server to create a coroutine matching the application task according to the load balancing logic information and the load balancing parameters.
[0094] 302. When a response indicating that the coroutine creation is completed is received, the load balancing logic information and the load balancing parameters are sent to the target load balancing server to publish application tasks in the corresponding coroutine according to the load balancing logic information and the load balancing parameters.
[0095] In an embodiment of the present application, when the application task load balancing processing system receives an application task publishing request, after the execution subject completes the application task publishing load balancing processing according to the above steps, it can send an application task publishing execution instruction to the target load balancing server in the trigger publishing application system to trigger it to execute the application task publishing operation. Specifically, the target load balancing server creates a corresponding Worker coroutine based on the load balancing logic information and load balancing parameters corresponding to the current application task publishing obtained by the execution subject, wherein each Worker coroutine corresponds to a virtual server and the data between each Worker coroutine is isolated, ensuring the accuracy and security of the data during the load balancing processing of the application task publishing.
[0096] When the execution subject receives the Worker coroutine creation completion response information from the target load balancing server, the acquired load balancing logic information and load balancing parameters corresponding to the current application task release are sent to the target load balancing server, so as to execute the application task release operation in the corresponding Worker coroutine.
[0097] The embodiment of the present invention provides a load balancing processing method for publishing application tasks. Compared with the prior art, the embodiment of the present application obtains a load balancing configuration file when receiving an application task publishing request, wherein the load balancing configuration file stores path information associated with a load balancing configuration directory, and the load balancing configuration directory is obtained by compiling a lightweight scripting language; the load balancing logic information matching the request parameter carried in the application task publishing request is searched in the load balancing configuration directory through the path information; the load balancing parameters matching the load balancing logic information are obtained from a target cache database, and the application task is published in combination with the load balancing logic information and the load balancing parameters, so that when executing the application task publishing operation, the load balancing logic information is first obtained based on the path information in the configuration file, and then the load balancing parameters matching the load balancing logic information are obtained from the target cache database according to the load balancing logic information, and then the application task is published, so that there is no need to frequently load the load balancing configuration in the load balancing virtual service pool, thus avoiding the problem of resource waste, and the published application tasks can be processed in real time and in parallel, thereby improving the load balancing processing performance of publishing application tasks.
[0098] Furthermore, as a response to the above Figure 1 To implement the method shown in FIG. 1 , an embodiment of the present invention provides a device, such as Figure 4 As shown, the device comprises:
[0099] The acquisition unit 41 is used to acquire a load balancing configuration file when receiving an application task publishing request, wherein the load balancing configuration file stores path information associated with a load balancing configuration directory, and the load balancing configuration directory is compiled by a lightweight scripting language;
[0100] A search unit 42 is used to search the load balancing logic information matching the request parameter carried in the application task publishing request in the load balancing configuration directory through the path information;
[0101] The execution unit 43 is used to obtain the load balancing parameters matching the load balancing logic information from the target cache database, and execute the release of the application task in combination with the load balancing logic information and the load balancing parameters.
[0102] Furthermore, the device also includes:
[0103] A splitting module, used to obtain the load balancing configuration information to be updated, and split the load balancing configuration information to obtain the load balancing logic information to be updated and the load balancing parameters to be updated;
[0104] A sending module, used for storing the load balancing parameters to be updated, and sending a directory compilation instruction carrying the load balancing logic information to be updated to the load balancing server, so that the load balancing server compiles and constructs a load balancing configuration directory according to the load balancing logic information;
[0105] The update module is used to obtain the path information corresponding to the load balancing configuration directory compiled and constructed by the load balancing server, and update the path information in the load balancing configuration files corresponding to different application task publishing requests.
[0106] Furthermore, the splitting module is specifically used to send a load balancing configuration instruction to the application task system to instruct the application task system to receive the load balancing configuration information entered by the user; obtain the load balancing configuration information fed back by the application task system; split the load balancing configuration information according to the string type and data format to obtain the load balancing logic information to be updated and the load balancing parameters to be updated.
[0107] Furthermore, the device also includes:
[0108] A recording module, used to store the historical path information of the load balancing configuration file in a non-cache database, and record the historical load balancing logic information corresponding to different search times in the non-cache database;
[0109] The clearing module is used to clear the load balancing configuration file.
[0110] Furthermore, the acquisition module is also used to obtain historical path information from the non-cache database if the load balancing logic information matching the request parameters is not found in the load balancing configuration directory through the path information; to search for the historical load balancing logic information with the largest number of searches through the historical path information, and to obtain historical load balancing parameters matching the historical load balancing logic information from the target cache database to execute the release of the application task.
[0111] Furthermore, the acquisition module is specifically used to acquire the historical load balancing parameters if the target cache database does not store load balancing parameters matching the load balancing logic information, so as to execute the release of the application task in combination with the load balancing logic information and the historical load balancing parameters.
[0112] Furthermore, the sending module is also used to send an application task publishing execution instruction to the target load balancing server to instruct the target load balancing server to create a coroutine matching the application task according to the load balancing logic information and the load balancing parameters; when a coroutine creation completion response is received, the load balancing logic information and the load balancing parameters are sent to the target load balancing server to publish the application task in the corresponding coroutine according to the load balancing logic information and the load balancing parameters.
[0113] The embodiment of the present invention provides a load balancing processing method and device for publishing application tasks. Compared with the prior art, the embodiment of the present application obtains a load balancing configuration file when receiving an application task publishing request, wherein the load balancing configuration file stores path information associated with a load balancing configuration directory, and the load balancing configuration directory is obtained by compiling a lightweight scripting language; the load balancing logic information matching the request parameter carried in the application task publishing request is searched in the load balancing configuration directory through the path information; the load balancing parameters matching the load balancing logic information are obtained from a target cache database, and the application task is published in combination with the load balancing logic information and the load balancing parameters, so that when executing the application task publishing operation, the load balancing logic information is first obtained based on the path information in the configuration file, and then the load balancing parameters matching the load balancing logic information are obtained from the target cache database according to the load balancing logic information, and then the application task is published, so that there is no need to frequently load the load balancing configuration in the load balancing virtual service pool, thus avoiding the problem of resource waste, and the published application tasks can be processed in real time and in parallel, thereby improving the load balancing processing performance of publishing application tasks.
[0114] According to an embodiment of the present invention, a storage medium is provided, wherein the storage medium stores at least one executable instruction, and the computer executable instruction can execute the load balancing processing method for issuing application tasks in any of the above method embodiments.
[0115] Figure 5 A schematic diagram of the structure of a computer device provided according to an embodiment of the present invention is shown. The specific embodiment of the present invention does not limit the specific implementation of the computer device.
[0116] like Figure 5 As shown, the computer device may include: a processor (processor) 502 , a communication interface (Communications Interface) 504 , a memory (memory) 506 , and a communication bus 508 .
[0117] The processor 502 , the communication interface 504 , and the memory 506 communicate with each other via a communication bus 508 .
[0118] The communication interface 504 is used to communicate with other devices such as clients or other servers.
[0119] The processor 502 is used to execute the program 510, and specifically can execute the relevant steps in the embodiment of the load balancing processing method for issuing application tasks.
[0120] Specifically, the program 510 may include program codes, which include computer operation instructions.
[0121] The processor 502 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention. The one or more processors included in the computer device may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.
[0122] The memory 506 is used to store the program 510. The memory 506 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0123] The program 510 may be specifically configured to enable the processor 502 to perform the following operations:
[0124] When an application task publishing request is received, a load balancing configuration file is obtained, wherein the load balancing configuration file stores path information associated with a load balancing configuration directory, and the load balancing configuration directory is compiled using a lightweight scripting language;
[0125] Searching the load balancing logic information in the load balancing configuration directory for the load balancing logic information that matches the request parameters carried in the application task publishing request through the path information;
[0126] A load balancing parameter matching the load balancing logic information is obtained from the target cache database, and the application task is released in combination with the load balancing logic information and the load balancing parameter.
[0127] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0128] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A load balancing processing method for publishing application tasks, characterized in that: include: When an application task publishing request is received, a load balancing configuration file is obtained, wherein the load balancing configuration file stores path information associated with a load balancing configuration directory, and the load balancing configuration directory is compiled using a lightweight scripting language; Searching the load balancing logic information in the load balancing configuration directory for the load balancing logic information that matches the request parameters carried in the application task publishing request through the path information; Obtaining a load balancing parameter matching the load balancing logic information from a target cache database, and executing the release of the application task in combination with the load balancing logic information and the load balancing parameter; Wherein, after searching the load balancing logic information in the load balancing configuration directory through the path information and matching the request parameters carried in the application task publishing request, the method further includes: If the load balancing logic information matching the request parameters is not found in the load balancing configuration directory through the path information, obtaining the historical path information in the non-cache database; The historical load balancing logic information with the largest number of searches is searched through the historical path information, and the historical load balancing parameters matching the historical load balancing logic information are acquired from the target cache database to execute the release of the application task.
2. The method according to claim 1, characterized in that Before obtaining the load balancing configuration file, the method further includes: Obtaining load balancing configuration information to be updated, and splitting the load balancing configuration information to obtain load balancing logic information to be updated and load balancing parameters to be updated; The load balancing parameters to be updated are stored, and a directory compilation instruction carrying the load balancing logic information to be updated is sent to the load balancing server, so that the load balancing server compiles and constructs a load balancing configuration directory according to the load balancing logic information; The path information corresponding to the load balancing configuration directory compiled and constructed by the load balancing server is obtained, and the path information is updated and configured in the load balancing configuration files corresponding to the release requests of different application tasks.
3. The method according to claim 2, characterized in that The step of obtaining the load balancing configuration information to be updated and splitting the load balancing configuration information to obtain the load balancing logic information to be updated and the load balancing parameters to be updated includes: Sending a load balancing configuration instruction to the application task system to instruct the application task system to receive the load balancing configuration information entered by the user; Obtaining load balancing configuration information fed back by the application task system; The load balancing configuration information is split according to the character string type and data format to obtain the load balancing logic information to be updated and the load balancing parameters to be updated.
4. The method according to claim 2, characterized in that: Before updating and configuring the path information in the load balancing configuration files corresponding to the different application task publishing requests, the method further includes: Storing the historical path information of the load balancing configuration file in a non-cache database, and recording the historical load balancing logic information corresponding to different search times in the non-cache database; Clear the load balancing configuration file.
5. The method according to claim 1, characterized in that The step of acquiring the load balancing parameters matching the load balancing logic information from the target cache database includes: If the target cache database does not store the load balancing parameters matching the load balancing logic information, the historical load balancing parameters are obtained to execute the release of the application task in combination with the load balancing logic information and the historical load balancing parameters.
6. The method according to any one of claims 1 to 5, characterized in that: The step of executing the release of the application task in combination with the load balancing logic information and the load balancing parameters includes: Sending an application task publishing execution instruction to a target load balancing server to instruct the target load balancing server to create a coroutine matching the application task according to the load balancing logic information and the load balancing parameters; When a response to the completion of creating a coroutine is received, the load balancing logic information and the load balancing parameters are sent to the target load balancing server to publish application tasks in the corresponding coroutine according to the load balancing logic information and the load balancing parameters.
7. A load balancing processing device for issuing application tasks, characterized in that: include: An acquisition module, configured to acquire a load balancing configuration file when receiving an application task publishing request, wherein the load balancing configuration file stores path information associated with a load balancing configuration directory, and the load balancing configuration directory is compiled using a lightweight scripting language; A search module, used to search the load balancing logic information in the load balancing configuration directory according to the path information and matching the request parameters carried in the application task publishing request; An execution module, used to obtain a load balancing parameter matching the load balancing logic information from a target cache database, and execute the release of the application task in combination with the load balancing logic information and the load balancing parameter; Among them, the acquisition module is also used to obtain historical path information in a non-cache database if the load balancing logic information matching the request parameters is not found in the load balancing configuration directory through the path information; search for the historical load balancing logic information with the largest number of times through the historical path information, and obtain historical load balancing parameters matching the historical load balancing logic information from the target cache database to execute the release of the application task.
8. A storage medium storing at least one executable instruction, wherein the executable instruction enables a processor to execute operations corresponding to the load balancing processing method for issuing application tasks according to any one of claims 1 to 6.
9. A computer device comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the load balancing processing method for publishing application tasks according to any one of claims 1-6.
Citation Information
Patent Citations
Load balance configuration method, device and system
CN105871588A
Nginx-based load balancing implementation method and apparatus, computer device, and storage medium
CN108965381A
Load balancing application management method and device, computer equipment and storage medium
CN110262872A
Configuration updating method and device, server and readable storage medium
CN111064626A
Method and device for processing hypertext transfer protocol request, equipment and medium
CN112104679A
