Load balancing strategy adjustment method and device, equipment and storage medium
By using the unified resource locator detection interface on the service mesh platform to collect performance indicator data and adjust the load balancing strategy, the problem of poor load balancing of cloud platforms when facing centralized users is solved, and the video resources are fast and stable Transmission and smooth video playback experience.
Patent Information
- Application Number
- CN202411363569.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-02-11
AI Technical Summary
The existing cloud platform load balancing strategy still has room for optimization when facing centralized user access, resulting in unstable video resource transmission and difficulty in realizing the instant broadcast experience.
By introducing a unified resource locator detection interface on the service mesh platform, the performance metric data of the service instance is collected, the priority of the service instance is calculated, and the load balancing strategy is adjusted according to the priority to optimize the load balancing performance of the cloud platform.
Effectively respond to the pressure brought by users' centralized access, ensure that video resources can be quickly and stably transmitted to users' terminal devices, and achieve a smooth video playback experience.
Smart Images

Figure CN119415244A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of load balancing, and in particular to a load balancing strategy adjustment method and device, an electronic device and a storage medium. Background Art
[0002] In the video playback industry, "seconds playback" is a key performance indicator, which means that the video can start playing immediately after the user clicks to play the video. However, in most cases, some videos are played at fixed time points, which will cause users to access the video resources at the same time, bringing huge pressure to the backend service. Therefore, ensuring the user's second playback experience has become a vital task.
[0003] With the rise of cloud computing technology, the pace of backend services migrating to cloud platforms has accelerated. Compared with traditional load balancing strategies, cloud platforms provide a variety of load balancing strategies for service instances to use. Despite this, there is still room for optimization of the existing cloud platform load balancing strategies, which makes it challenging to achieve a fast streaming experience. Summary of the invention
[0004] The purpose of the embodiment of the present invention is to provide a load balancing strategy adjustment method to solve the problem of how to further optimize the load balancing strategy of the cloud platform to cope with the pressure brought by concentrated user access and ensure that video resources can be quickly and stably transmitted to the user's terminal device. The specific technical solution is as follows:
[0005] In a first aspect of the present invention, a load balancing policy adjustment method is first provided, which is applied to a service grid platform, wherein the service grid platform includes a plurality of service instances, each of which is provided with a uniform resource locator detection interface, and the method includes:
[0006] Calling the uniform resource locator detection interface to enable the service instance to perform a preset operation;
[0007] Collecting performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface, the performance indicator data is obtained by statistics when the service instance executes the preset operation, and the performance indicator data at least includes service response time;
[0008] Calculating the priority of the service instance according to the performance indicator data;
[0009] According to the priority, adjusting the load balancing strategy for the plurality of service instances to obtain an updated load balancing strategy;
[0010] The service instance is called according to the updated load balancing strategy.
[0011] Optionally, each of the service instances is further provided with a corresponding proxy component, and the calling of the uniform resource locator detection interface so that the service instance performs a preset operation includes:
[0012] The proxy component is controlled to call the uniform resource locator detection interface of the corresponding service instance, so that the service instance executes the preset operation.
[0013] The collecting performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface includes:
[0014] The performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface reported by the proxy component is collected.
[0015] Optionally, adjusting the load balancing strategy for the plurality of service instances according to the priority includes:
[0016] According to the priority, using a resource definition mechanism to adjust the load balancing strategy for a number of the service instances to obtain the updated load balancing strategy;
[0017] Converting the configuration of the updated load balancing policy into a configuration applicable to the proxy component;
[0018] The updated load balancing policy is pushed to the proxy component.
[0019] Optionally, the performance indicator data further includes other performance indicator data, and the calculating the priority of the service instance according to the performance indicator data includes:
[0020] Assigning a first weight coefficient to the service response time, and assigning a second weight coefficient to the other performance indicator data;
[0021] Calculating a performance score of the performance indicator data according to the first weight coefficient and the second weight coefficient, wherein there is a corresponding relationship between the performance score and the priority;
[0022] The priority of the service instance is determined according to the corresponding relationship between the performance score and the priority.
[0023] Optionally, calling the service instance according to the updated load balancing strategy includes:
[0024] According to the updated load balancing strategy, the proxy component of the service instance is called according to the priority.
[0025] Optionally, the service instance runs on several service machines, and the method further includes:
[0026] Receiving a call request sent by the proxy component;
[0027] Determine a target service instance and a target service machine according to the call request and the updated load balancing strategy, wherein the target service instance runs on the target service machine;
[0028] The proxy component is controlled to forward the call request to the target service machine of the target service instance, so that the target proxy component corresponding to the target service instance receives the call request.
[0029] Optionally, the user accesses a video platform through a terminal device, and the video platform is deployed on the service grid platform. The method further includes:
[0030] Receiving a video playback request sent by the terminal device through the video platform;
[0031] Determining a target playback service instance according to the video playback request and the updated load balancing strategy;
[0032] Forwarding the video playback request to the target playback service instance so that the proxy component corresponding to the target playback service instance receives the video playback request;
[0033] The proxy component corresponding to the target playback service instance is controlled to call the target playback service instance to play the video on the terminal device.
[0034] In a second aspect of the present invention, a load balancing policy adjustment device is provided, which is applied to a service grid platform, wherein the service grid platform includes a plurality of service instances, each of which is provided with a uniform resource locator detection interface, and the device includes:
[0035] An interface calling module, used for calling the uniform resource locator detection interface to enable the service instance to perform a preset operation;
[0036] A data collection module, used to collect performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface, wherein the performance indicator data is obtained by statistics when the service instance executes the preset operation, and the performance indicator data at least includes a service response time;
[0037] A priority calculation module, used to calculate the priority of the service instance according to the performance indicator data;
[0038] A policy updating module, used to adjust the load balancing policy for a plurality of the service instances according to the priority to obtain an updated load balancing policy;
[0039] The service calling module is used to call the service instance according to the updated load balancing strategy.
[0040] Optionally, each of the service instances is further provided with a corresponding proxy component, and the interface calling module is further used to:
[0041] The proxy component is controlled to call the uniform resource locator detection interface of the corresponding service instance, so that the service instance executes the preset operation.
[0042] The data collection module is also used for:
[0043] The performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface reported by the proxy component is collected.
[0044] Optionally, the policy updating module includes:
[0045] A resource definition submodule, configured to adjust the load balancing strategy for a plurality of the service instances according to the priority using a resource definition mechanism to obtain the updated load balancing strategy;
[0046] A configuration conversion submodule, used to convert the configuration of the updated load balancing strategy into a configuration suitable for the proxy component;
[0047] The policy push submodule is used to push the updated load balancing policy to the proxy component.
[0048] Optionally, the performance indicator data further includes other performance indicator data, and the priority calculation module includes:
[0049] A weight setting submodule, used to assign a first weight coefficient to the service response time, and to assign a second weight coefficient to the other performance indicator data;
[0050] a priority mapping submodule, configured to calculate a performance score of the performance indicator data according to the first weight coefficient and the second weight coefficient, wherein the performance score corresponds to the priority;
[0051] The priority determination submodule is used to determine the priority of the service instance according to the corresponding relationship between the performance score and the priority.
[0052] Optionally, the service calling module is further used to:
[0053] According to the updated load balancing strategy, the proxy component of the service instance is called according to the priority.
[0054] Optionally, the service instance runs on several service machines, and the apparatus further includes:
[0055] A request receiving module, used for receiving a call request sent by the proxy component;
[0056] A target service determination module, used to determine a target service instance and a target service machine according to the call request and the updated load balancing strategy, wherein the target service instance runs on the target service machine;
[0057] The target service calling module is used to control the proxy component to forward the calling request to the target service machine of the target service instance, so that the target proxy component corresponding to the target service instance receives the calling request.
[0058] Optionally, the user accesses a video platform through a terminal device, the video platform is deployed on the service grid platform, and the apparatus further includes:
[0059] A play request module, used to receive a video play request sent by the terminal device through the video platform;
[0060] A playback service module, used to determine a target playback service instance according to the video playback request and the updated load balancing strategy;
[0061] A request forwarding module, used for forwarding the video play request to the target play service instance, so that the proxy component corresponding to the target play service instance receives the video play request;
[0062] The video playing module is used to control the proxy component corresponding to the target playing service instance to call the target playing service instance to play the video on the terminal device.
[0063] In another aspect of the implementation of the present invention, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; the memory is used to store computer programs; and the processor is used to implement any of the above-mentioned load balancing strategy adjustment methods when executing the program stored in the memory.
[0064] In another aspect of the present invention, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is executed on a computer, the computer executes any of the load balancing policy adjustment methods described above.
[0065] In another aspect of the present invention, a computer program product including instructions is provided, which, when executed on a computer, enables the computer to execute any of the load balancing policy adjustment methods described above.
[0066] The load balancing strategy adjustment method provided in the embodiment of the present invention calls the uniform resource locator detection interface to enable the service instance to perform a preset operation, collects the performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface, the performance indicator data is obtained by statistics when the service instance performs the preset operation, and the performance indicator data at least includes the service response time; according to the performance indicator data, the priority of the service instance is calculated, and according to the priority, the load balancing strategy for several service instances is adjusted to obtain an updated load balancing strategy; the service instance is called according to the updated load balancing strategy. Therefore, the embodiment of the present invention obtains the performance indicator data of the service instance performing the preset operation by introducing the uniform resource locator detection interface. Based on these data, the priority of the service instance can be calculated, and the load balancing strategy of the cloud platform can be optimized accordingly to effectively cope with the pressure generated by the concentrated access of users. When a user requests to play a video, the system will call a service instance with a higher priority to ensure that the video resource can be quickly and stably transmitted to the user's terminal device, thereby achieving a smooth video playback experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.
[0068] Figure 1 It is a flow chart of steps of an embodiment of a load balancing strategy adjustment method of the present invention;
[0069] Figure 2 It is a service grid platform architecture diagram of an embodiment of a load balancing strategy adjustment method of the present invention;
[0070] Figure 3 This is a service instance calling schematic diagram of an embodiment of a load balancing strategy adjustment method of the present invention;
[0071] Figure 4 It is a structural block diagram of an embodiment of a load balancing strategy adjustment device of the present invention;
[0072] Figure 5 It is a schematic diagram of the structure of a device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0073] The technical solutions in the embodiments of the present invention will be described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0074] Reference Figure 1 , is a flow chart of a load balancing strategy adjustment method embodiment of the present invention, comprising the following steps:
[0075] Step 101: Call the uniform resource locator detection interface to enable the service instance to perform a preset operation.
[0076] A load balancing policy adjustment method provided in an embodiment of the present invention can be applied to a service mesh platform. In one example, the service mesh platform can be Istio. As a proxy component on Istio, Envoy provides a series of network functions, such as load balancing, service discovery, circuit breakers, request routing, retry mechanisms, etc. Envoy can run as a proxy component between service instances to process all requests to call service instances. Usually, Istio controls the plane definition of the mesh architecture and adjusts and distributes the load balancing policy; Envoy can apply the load balancing policy and is responsible for the actual traffic proxy and load balancing.
[0077] Video playback-related service instances are usually deployed in the service grid platform using a Kubernetes-based (a container orchestration platform) deployment method. Although the load balancing strategy adopted by the service grid platform performs well in most scenarios, there is still room for optimization in environments with high performance requirements. For example, in the member playback authentication service instance, different authentication requests may involve different internal processing flows, and even if the hardware resource configurations running these service instances are the same, their processing times may vary.
[0078] To this end, the embodiment of the present invention introduces a uniform resource locator detection interface to obtain performance indicator data of the service instance performing preset operations. By collecting, summarizing and calculating these indicator data, the priority of the service instance can be obtained. At the same time, using Istio's resource definition mechanism, the system can dynamically adjust the load balancing strategy. Envoy is deployed as a sidecar component (a proxy component) to apply these adjusted load balancing strategies to optimize traffic trends, thereby significantly improving the response speed and service quality of member playback authentication.
[0079] In this embodiment, the service grid platform includes several service instances, each of which is provided with a corresponding uniform resource locator detection interface (i.e., pingURL interface). The uniform resource locator detection interface includes some behaviors that simulate real requests, such as database query and cache query. After the uniform resource locator detection interface receives a "ping" request, it will trigger the service instance to perform a series of operations. The interface is used to return the performance indicator data obtained by the service instance after performing the preset operation.
[0080] In step 101, in order to obtain the current performance indicator data of the service instance, the uniform resource locator detection interface is called to enable the service instance to perform a preset operation. In an optional embodiment, the uniform resource locator detection interface is called by the proxy component corresponding to the service instance. Specifically, the proxy component sends a "ping" request to the uniform resource locator detection interface to trigger the service instance to perform a series of preset operations.
[0081] Step 102: Collect performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface, wherein the performance indicator data is statistically obtained when the service instance executes the preset operation, and the performance indicator data at least includes service response time.
[0082] In step 102, performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface is collected, and these performance indicator data are statistically obtained when the service instance performs a preset operation. In an optional embodiment, the performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface is collected by a proxy component corresponding to the service instance, and the performance indicator data is reported to the service grid platform. In an example, the performance indicator data may include at least the service response time of the service instance.
[0083] Step 103: Calculate the priority of the service instance according to the performance indicator data.
[0084] In step 103, after receiving the performance indicator data corresponding to the service instance, the service grid platform calculates the priority of the service instance accordingly. In an optional embodiment, different weights can be assigned to different types of performance indicator data to calculate the performance score of the service instance, and different performance scores can be mapped to different priorities, thereby calculating the priority of the service instance.
[0085] Step 104: According to the priority, adjust the load balancing strategy for the plurality of service instances to obtain an updated load balancing strategy.
[0086] In step 104, the service grid platform can adjust the load balancing strategy for several service instances according to the priorities of different service instances, and obtain an updated load balancing strategy. In an optional embodiment, the load balancing strategy can be defined and adjusted through CRD (Custom Resource Definition, an extension mechanism provided by Kubernetes, i.e., a resource definition mechanism). Specifically, the service grid platform uses a series of resource definition mechanisms to define the load balancing strategy of the service instance, and the configuration of the updated load balancing strategy is automatically converted into a configuration suitable for the proxy component, and the updated load balancing strategy can be pushed to the proxy component through the control plane.
[0087] Step 105: Call the service instance according to the updated load balancing strategy.
[0088] In step 105, after the load balancing policy is adjusted, the service instance is called according to the updated load balancing policy. In an optional embodiment, the service instance with a higher priority will be called first.
[0089] In an embodiment of the present invention, a uniform resource locator detection interface is called to enable a service instance to perform a preset operation, and performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface is collected. The performance indicator data is obtained by statistics when the service instance performs the preset operation, and the performance indicator data at least includes the service response time; the priority of the service instance is calculated according to the performance indicator data, and the load balancing strategy for several service instances is adjusted according to the priority to obtain an updated load balancing strategy; the service instance is called according to the updated load balancing strategy. The embodiment of the present invention obtains the performance indicator data of the service instance performing the preset operation by introducing a uniform resource locator detection interface. Based on these data, the priority of the service instance can be calculated, and the load balancing strategy of the cloud platform can be optimized accordingly to effectively cope with the pressure generated by concentrated user access. When a user requests to play a video, the system will call a service instance with a higher priority to ensure that the video resource can be quickly and stably transmitted to the user's terminal device, thereby achieving a smooth video playback experience.
[0090] In an optional embodiment of the present invention, each of the service instances is further provided with a corresponding proxy component, and the calling of the uniform resource locator detection interface so that the service instance performs a preset operation includes:
[0091] The proxy component is controlled to call the uniform resource locator detection interface of the corresponding service instance, so that the service instance executes the preset operation.
[0092] The collecting performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface includes:
[0093] The performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface reported by the proxy component is collected.
[0094] Reference Figure 2 , is a service grid platform architecture diagram of an embodiment of a load balancing strategy adjustment method of the present invention.
[0095] In this embodiment, each service instance is also provided with a corresponding proxy component, and any request call initiated or received by the service instance will be forwarded or received by the corresponding proxy component. Figure 2 As shown, each service instance has a corresponding proxy component, and the service grid platform can control the proxy component to call the uniform resource locator detection interface of the corresponding service instance so that the service instance performs the preset operation; after the service instance performs the preset operation, the proxy component collects the performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface, and summarizes and reports these performance indicator data to the service grid platform.
[0096] The embodiment of the present invention collects and reports the performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface through the proxy component, so that the service grid platform can obtain the performance indicator data of all service instances, thereby using these performance indicator data for subsequent load balancing strategy adjustment.
[0097] In an optional embodiment of the present invention, adjusting the load balancing strategy for the plurality of service instances according to the priority includes:
[0098] According to the priority, using a resource definition mechanism to adjust the load balancing strategy for a number of the service instances to obtain the updated load balancing strategy;
[0099] Converting the configuration of the updated load balancing policy into a configuration applicable to the proxy component;
[0100] The updated load balancing policy is pushed to the proxy component.
[0101] In an embodiment of the present invention, the service grid platform can use a resource definition mechanism to define and adjust the load balancing strategy. In one example, the resource definition mechanism can be a CRD, and the service grid platform can use the CRD to define the traffic management strategy, security strategy, etc. of the service instance. In this embodiment, the service grid platform can use the resource definition mechanism to adjust the load balancing strategy for several service instances according to the priority of the service instance to obtain an updated load balancing strategy.
[0102] After adjusting the load balancing policy, the configuration of the updated load balancing policy is automatically converted to the configuration applicable to the proxy component, and the updated load balancing policy can be pushed to the proxy component through the control plane.
[0103] The embodiment of the present invention uses a resource definition mechanism to adjust the load balancing strategy for several service instances, and pushes the updated load balancing strategy to the proxy component, thereby enabling the service grid platform to dynamically adjust the load balancing strategy according to the priority of the service instance.
[0104] In an optional embodiment of the present invention, the performance indicator data further includes other performance indicator data, and the calculating the priority of the service instance according to the performance indicator data includes:
[0105] Assigning a first weight coefficient to the service response time, and assigning a second weight coefficient to the other performance indicator data;
[0106] Calculating a performance score of the performance indicator data according to the first weight coefficient and the second weight coefficient, wherein there is a corresponding relationship between the performance score and the priority;
[0107] The priority of the service instance is determined according to the corresponding relationship between the performance score and the priority.
[0108] In the embodiment of the present invention, the performance indicator data collected by the proxy component may include the service response time of the service instance, and may also include other performance indicator data.
[0109] When calculating the performance score of a service instance, a first weight coefficient may be assigned to the service response time, and a second weight coefficient may be assigned to other performance indicator data for calculation. In one example, the first weight coefficient assigned to the service response time may be 80%, and the second weight coefficient assigned to other performance indicator data may be 20%. The embodiment of the present invention does not impose any restrictions on the specific values of the first weight coefficient and the second weight coefficient, and those skilled in the art may set them according to actual needs.
[0110] In one example, other performance indicator data may include request success rate, error rate, throughput, number of concurrent connections, memory usage, CPU (Central Processing Unit) usage, disk I / O (input / output), network bandwidth usage, number of database connections, cache hit rate, average load, queue length, timeout rate, number of exceptions, log record volume and other performance indicator data.
[0111] In another embodiment, a first weight coefficient may be assigned to the service response time, and a second weight coefficient may be assigned to other performance indicator data, and then a third weight coefficient may be assigned to each other performance indicator data based on the second weight coefficient.
[0112] In one case, the second weight coefficient assigned to other performance indicator data can be evenly assigned to the above-mentioned various other performance indicator data to obtain a third weight coefficient. For example, the first weight coefficient assigned to the service response time can be 70%, the second weight coefficient assigned to other performance indicator data can be 30%, and the third weight coefficient assigned to the above-mentioned fifteen other performance indicator data can be 2%.
[0113] In another case, different third weight coefficients can be assigned to different other performance indicator data according to the second weight coefficient, and the sum of the third weight coefficients assigned to all other performance indicator data is equal to the second weight coefficient. For example, the first weight coefficient assigned to the service response time can be 70%, and the second weight coefficient assigned to other performance indicator data can be 30%, wherein the third weight coefficients assigned to each other performance indicator data can be different, for example, the third weight coefficient assigned to the request success rate can be 3%, and the third weight coefficient assigned to the error rate can be 1%, but the sum of the third weight coefficients assigned to all other performance indicator data needs to be equal to the second weight coefficient.
[0114] The above values of the first weight coefficient, the second weight coefficient, and the third weight coefficient are only for examples. The embodiment of the present application does not impose any restrictions on the specific values of the first weight coefficient, the second weight coefficient, and the third weight coefficient. Those skilled in the art can set them according to actual needs.
[0115] After weighted calculation of the service response time and other performance indicator data according to the first weight coefficient and the second weight coefficient, the performance score of the service instance can be obtained. According to the correspondence between the performance score and the priority, different performance scores are mapped to different priorities, thereby calculating the priority of the service instance. In one example, the priority can be set to 1 to 10, each priority corresponds to a different performance score interval, and the higher the level, the higher the load balancing priority. The present invention does not impose any restrictions on the setting of the priority and the correspondence between the performance score and the priority, and those skilled in the art can set it according to actual needs.
[0116] The embodiment of the present invention assigns different weight coefficients to service response time and other performance indicator data, and calculates the performance score of the service instance based on these weighted data, and then determines the priority of the service instance. This can more finely evaluate the performance of the service instance, thereby making more accurate adjustments to the load balancing strategy.
[0117] In an optional embodiment of the present invention, calling the service instance according to the updated load balancing strategy includes:
[0118] According to the updated load balancing strategy, the proxy component of the service instance is called according to the priority.
[0119] In this embodiment, after the proxy component receives the updated load balancing policy, it can call the proxy component of the service instance according to the priority according to the updated load balancing policy.
[0120] Reference Figure 3 , is a service instance calling diagram of an embodiment of a load balancing strategy adjustment method of the present invention.
[0121] like Figure 3 As shown, service instance 1, service instance 2, service instance 3, and service instance 4 are deployed on the service grid platform. The proxy components corresponding to each service instance are proxy component 1, proxy component 2, proxy component 3, and proxy component 4 respectively. Any request calls initiated or received by the service instance will be forwarded and received by the corresponding proxy components. For example, service instance 1 and service instance 2 can call each other through proxy component 1 and proxy component 2; service instance 1 and service instance 3 can call each other through proxy component 1 and proxy component 3; service instance 1 and service instance 4 can call each other through proxy component 1 and proxy component 4; service instance 4 and service instance 2 can call each other through proxy component 4 and proxy component 2; service instance 3 and service instance 4 can call each other through proxy component 3 and proxy component 4. The above relationship between service instance calls is only for Figure 3 For example, those skilled in the art can make settings according to actual conditions in actual implementation. At the same time, the proxy component can poll and call the uniform resource locator detection interface of the service instance to trigger the service instance to perform a series of preset operations. Figure 3 The calling process of the proxy component 3 and the proxy component 4 is shown in FIG.
[0122] In the process of calling each other by service instances, the proxy components of service instances can be called according to the priority according to the updated load balancing strategy. Specifically, service instances with higher priorities can be called first to obtain faster service responses. For example, if service instance 1 needs to call one of service instance 2, service instance 3, and service instance 4, and service instance 2 has the highest priority among the three, service instance 1 will call service instance 2 first, that is, service instance 1 sends a request to call service instance 2 to the proxy component through proxy component 1.
[0123] The embodiment of the present invention calls the service instance according to the priority. When the service instance needs to be called, the system will call the service instance with a higher priority to ensure a quick response of the service instance.
[0124] In an optional embodiment of the present invention, the service instance runs on a plurality of service machines, and the method further comprises:
[0125] Receiving a call request sent by the proxy component;
[0126] Determine a target service instance and a target service machine according to the call request and the updated load balancing strategy, wherein the target service instance runs on the target service machine;
[0127] The proxy component is controlled to forward the call request to the target service machine of the target service instance, so that the target proxy component corresponding to the target service instance receives the call request.
[0128] In this embodiment, each service instance can run on several service machines. The service machine, as a hardware resource for running the service instance, can be a physical server or a virtual machine. After the service grid platform receives the call request sent by the proxy component to the service instance, it performs a logical operation based on the call request and the updated load balancing strategy to determine the target service instance and the target service machine to which the call request is forwarded. The target service machine is the hardware resource that supports the operation of the target service instance. Afterwards, the proxy component forwards the call request to the target service machine of the target service instance, and the target proxy component corresponding to the target service instance receives the call request.
[0129] The embodiment of the present invention can accurately determine the target service instance and the target service machine and forward the call request by combining the call request and the updated load balancing strategy for logical operation, thereby realizing the call of a service instance with a higher priority.
[0130] In an optional embodiment of the present invention, a user accesses a video platform through a terminal device, and the video platform is deployed on the service grid platform. The method further includes:
[0131] Receiving a video playback request sent by the terminal device through the video platform;
[0132] Determining a target playback service instance according to the video playback request and the updated load balancing strategy;
[0133] Forwarding the video playback request to the target playback service instance so that the proxy component corresponding to the target playback service instance receives the video playback request;
[0134] The proxy component corresponding to the target playback service instance is controlled to call the target playback service instance to play the video on the terminal device.
[0135] In this embodiment, the user can access the video platform through the terminal device. The video platform is deployed on the service grid platform. When the user clicks to play the video, the service instance on the service grid platform needs to be called to play the video.
[0136] First, the user clicks the play video button on the video platform, triggering the terminal device to send a video play request to the service grid platform through the video platform. The user's operation and the specific settings of the video platform are examples, and those skilled in the art can set the triggering method of the video play request according to actual needs.
[0137] The service grid platform may complete the adjustment of the load balancing strategy in advance, or may adjust the load balancing strategy after receiving the video playback request. This embodiment does not impose any restrictions on this. After receiving the video playback request, the service grid platform determines the target playback service instance according to the video playback request and the updated load balancing strategy, and forwards the video playback request to the target playback service instance. The target playback service instance receives the video playback request through the corresponding proxy component, and the proxy component calls the target playback service instance according to the video playback request, thereby playing the video that the user wants to watch on the terminal device.
[0138] The embodiment of the present invention demonstrates a specific application scenario of the technical solution of the present invention. When a user requests to play a video, the embodiment of the present invention calls a service instance with a higher priority to ensure that the video resource can be quickly and stably transmitted to the user's terminal device, thereby achieving a smooth video playback experience.
[0139] In an embodiment of the present invention, a uniform resource locator detection interface is called to enable a service instance to perform a preset operation, and performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface is collected. The performance indicator data is obtained by statistics when the service instance performs the preset operation, and the performance indicator data at least includes the service response time; the priority of the service instance is calculated according to the performance indicator data, and the load balancing strategy for several service instances is adjusted according to the priority to obtain an updated load balancing strategy; the service instance is called according to the updated load balancing strategy. The embodiment of the present invention obtains the performance indicator data of the service instance performing the preset operation by introducing a uniform resource locator detection interface. Based on these data, the priority of the service instance can be calculated, and the load balancing strategy of the cloud platform can be optimized accordingly to effectively cope with the pressure generated by concentrated user access. When a user requests to play a video, the system will call a service instance with a higher priority to ensure that the video resource can be quickly and stably transmitted to the user's terminal device, thereby achieving a smooth video playback experience.
[0140] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0141] On the basis of the above embodiments, this embodiment further provides a load balancing strategy adjustment device, which is applied to electronic devices such as terminal devices and servers.
[0142] Reference Figure 4 , shows a structural block diagram of an embodiment of a load balancing strategy adjustment device of the present invention, which may specifically include the following modules:
[0143] The interface calling module 401 is used to call the uniform resource locator detection interface so that the service instance performs a preset operation;
[0144] A data collection module 402 is used to collect performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface, wherein the performance indicator data is obtained by statistics when the service instance executes the preset operation, and the performance indicator data at least includes a service response time;
[0145] The priority calculation module 403 is used to calculate the priority of the service instance according to the performance indicator data;
[0146] A policy updating module 404, configured to adjust the load balancing policy for a plurality of the service instances according to the priority to obtain an updated load balancing policy;
[0147] The service calling module 405 is used to call the service instance according to the updated load balancing strategy.
[0148] Optionally, each of the service instances is further provided with a corresponding proxy component, and the interface calling module 401 is further used to:
[0149] The proxy component is controlled to call the uniform resource locator detection interface of the corresponding service instance, so that the service instance executes the preset operation.
[0150] The data collection module 402 is further used for:
[0151] The performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface reported by the proxy component is collected.
[0152] Optionally, the policy updating module 404 includes:
[0153] A resource definition submodule, configured to adjust the load balancing strategy for a plurality of the service instances according to the priority using a resource definition mechanism to obtain the updated load balancing strategy;
[0154] A configuration conversion submodule, used to convert the configuration of the updated load balancing strategy into a configuration suitable for the proxy component;
[0155] The policy push submodule is used to push the updated load balancing policy to the proxy component.
[0156] Optionally, the performance indicator data further includes other performance indicator data, and the priority calculation module 403 includes:
[0157] A weight setting submodule, used to assign a first weight coefficient to the service response time, and to assign a second weight coefficient to the other performance indicator data;
[0158] a priority mapping submodule, configured to calculate a performance score of the performance indicator data according to the first weight coefficient and the second weight coefficient, wherein the performance score corresponds to the priority;
[0159] The priority determination submodule is used to determine the priority of the service instance according to the corresponding relationship between the performance score and the priority.
[0160] Optionally, the service calling module 405 is further used to:
[0161] According to the updated load balancing strategy, the proxy component of the service instance is called according to the priority.
[0162] Optionally, the service instance runs on several service machines, and the apparatus further includes:
[0163] A request receiving module, used for receiving a call request sent by the proxy component;
[0164] A target service determination module, used to determine a target service instance and a target service machine according to the call request and the updated load balancing strategy, wherein the target service instance runs on the target service machine;
[0165] The target service calling module is used to control the proxy component to forward the calling request to the target service machine of the target service instance, so that the target proxy component corresponding to the target service instance receives the calling request.
[0166] Optionally, the user accesses a video platform through a terminal device, the video platform is deployed on the service grid platform, and the apparatus further includes:
[0167] A play request module, used to receive a video play request sent by the terminal device through the video platform;
[0168] A playback service module, used to determine a target playback service instance according to the video playback request and the updated load balancing strategy;
[0169] A request forwarding module, used for forwarding the video play request to the target play service instance, so that the proxy component corresponding to the target play service instance receives the video play request;
[0170] The video playing module is used to control the proxy component corresponding to the target playing service instance to call the target playing service instance to play the video on the terminal device.
[0171] In an embodiment of the present invention, a uniform resource locator detection interface is called to enable a service instance to perform a preset operation, and performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface is collected. The performance indicator data is obtained by statistics when the service instance performs the preset operation, and the performance indicator data at least includes the service response time; the priority of the service instance is calculated according to the performance indicator data, and the load balancing strategy for several service instances is adjusted according to the priority to obtain an updated load balancing strategy; the service instance is called according to the updated load balancing strategy. The embodiment of the present invention obtains the performance indicator data of the service instance performing the preset operation by introducing a uniform resource locator detection interface. Based on these data, the priority of the service instance can be calculated, and the load balancing strategy of the cloud platform can be optimized accordingly to effectively cope with the pressure generated by concentrated user access. When a user requests to play a video, the system will call a service instance with a higher priority to ensure that the video resource can be quickly and stably transmitted to the user's terminal device, thereby achieving a smooth video playback experience.
[0172] The embodiment of the present invention further provides an electronic device, such as Figure 5 As shown, it includes a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502, and the memory 503 communicate with each other through the communication bus 504.
[0173] Memory 503, used for storing computer programs;
[0174] The processor 501 is used to execute the program stored in the memory 503, and implements the following steps:
[0175] Calling the uniform resource locator detection interface to enable the service instance to perform a preset operation;
[0176] Collecting performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface, the performance indicator data is obtained by statistics when the service instance executes the preset operation, and the performance indicator data at least includes service response time;
[0177] Calculating the priority of the service instance according to the performance indicator data;
[0178] According to the priority, adjusting the load balancing strategy for the plurality of service instances to obtain an updated load balancing strategy;
[0179] The service instance is called according to the updated load balancing strategy.
[0180] Optionally, each of the service instances is further provided with a corresponding proxy component, and the calling of the uniform resource locator detection interface so that the service instance performs a preset operation includes:
[0181] The proxy component is controlled to call the uniform resource locator detection interface of the corresponding service instance, so that the service instance executes the preset operation.
[0182] The collecting performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface includes:
[0183] The performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface reported by the proxy component is collected.
[0184] Optionally, adjusting the load balancing strategy for the plurality of service instances according to the priority includes:
[0185] According to the priority, using a resource definition mechanism to adjust the load balancing strategy for a number of the service instances to obtain the updated load balancing strategy;
[0186] Converting the configuration of the updated load balancing policy into a configuration applicable to the proxy component;
[0187] The updated load balancing policy is pushed to the proxy component.
[0188] Optionally, the performance indicator data further includes other performance indicator data, and the calculating the priority of the service instance according to the performance indicator data includes:
[0189] Assigning a first weight coefficient to the service response time, and assigning a second weight coefficient to the other performance indicator data;
[0190] Calculating a performance score of the performance indicator data according to the first weight coefficient and the second weight coefficient, wherein there is a corresponding relationship between the performance score and the priority;
[0191] The priority of the service instance is determined according to the corresponding relationship between the performance score and the priority.
[0192] Optionally, calling the service instance according to the updated load balancing strategy includes:
[0193] According to the updated load balancing strategy, the proxy component of the service instance is called according to the priority.
[0194] Optionally, the service instance runs on several service machines, and the method further includes:
[0195] Receiving a call request sent by the proxy component;
[0196] Determine a target service instance and a target service machine according to the call request and the updated load balancing strategy, wherein the target service instance runs on the target service machine;
[0197] The proxy component is controlled to forward the call request to the target service machine of the target service instance, so that the target proxy component corresponding to the target service instance receives the call request.
[0198] Optionally, the user accesses a video platform through a terminal device, and the video platform is deployed on the service grid platform. The method further includes:
[0199] Receiving a video playback request sent by the terminal device through the video platform;
[0200] Determining a target playback service instance according to the video playback request and the updated load balancing strategy;
[0201] Forwarding the video playback request to the target playback service instance so that the proxy component corresponding to the target playback service instance receives the video playback request;
[0202] The proxy component corresponding to the target playback service instance is controlled to call the target playback service instance to play the video on the terminal device.
[0203] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0204] The communication interface is used for communication between the above terminal and other devices.
[0205] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0206] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0207] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions. When the instructions are executed on a computer, the computer executes the load balancing policy adjustment method described in any of the above embodiments.
[0208] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is executed on a computer, the computer executes the load balancing policy adjustment method described in any one of the above embodiments.
[0209] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0210] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0211] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0212] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A method for adjusting a load balancing strategy, characterized in that: Applied to a service grid platform, the service grid platform includes a plurality of service instances, each of the service instances is provided with a uniform resource locator detection interface, the method includes: Calling the uniform resource locator detection interface to enable the service instance to perform a preset operation; Collecting performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface, the performance indicator data is statistically obtained when the service instance executes the preset operation, and the performance indicator data at least includes service response time; Calculating the priority of the service instance according to the performance indicator data; According to the priority, adjusting the load balancing strategy for the plurality of service instances to obtain an updated load balancing strategy; The service instance is called according to the updated load balancing strategy.
2. The method according to claim 1, characterized in that Each of the service instances is also provided with a corresponding proxy component, and the calling of the uniform resource locator detection interface so that the service instance performs a preset operation includes: The proxy component is controlled to call the uniform resource locator detection interface of the corresponding service instance, so that the service instance executes the preset operation. The collecting performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface includes: The performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface reported by the proxy component is collected.
3. The method according to claim 2, characterized in that The adjusting the load balancing strategy for the plurality of service instances according to the priority level includes: According to the priority, using a resource definition mechanism to adjust the load balancing strategy for a number of the service instances to obtain the updated load balancing strategy; Converting the configuration of the updated load balancing policy into a configuration applicable to the proxy component; The updated load balancing policy is pushed to the proxy component.
4. The method according to claim 1, characterized in that The performance indicator data also includes other performance indicator data, and the calculating the priority of the service instance according to the performance indicator data includes: Assigning a first weight coefficient to the service response time, and assigning a second weight coefficient to the other performance indicator data; Calculating a performance score of the performance indicator data according to the first weight coefficient and the second weight coefficient, wherein there is a corresponding relationship between the performance score and the priority; The priority of the service instance is determined according to the corresponding relationship between the performance score and the priority.
5. The method according to claim 2, characterized in that: The calling of the service instance according to the updated load balancing strategy includes: According to the updated load balancing strategy, the proxy component of the service instance is called according to the priority.
6. The method according to claim 2, characterized in that The service instance runs on a plurality of service machines, and the method further comprises: Receiving a call request sent by the proxy component; Determine a target service instance and a target service machine according to the call request and the updated load balancing strategy, wherein the target service instance runs on the target service machine; The proxy component is controlled to forward the call request to the target service machine of the target service instance, so that the target proxy component corresponding to the target service instance receives the call request.
7. The method according to any one of claims 2 to 6, characterized in that: A user accesses a video platform through a terminal device, and the video platform is deployed on the service grid platform. The method further includes: Receiving a video playback request sent by the terminal device through the video platform; Determining a target playback service instance according to the video playback request and the updated load balancing strategy; Forwarding the video playback request to the target playback service instance so that the proxy component corresponding to the target playback service instance receives the video playback request; The proxy component corresponding to the target playback service instance is controlled to call the target playback service instance to play the video on the terminal device.
8. A load balancing strategy adjustment device, characterized in that: Applied to a service grid platform, the service grid platform includes a plurality of service instances, each of the service instances is provided with a uniform resource locator detection interface, the device includes: An interface calling module, used for calling the uniform resource locator detection interface to enable the service instance to perform a preset operation; A data collection module, used to collect performance indicator data corresponding to the service instance returned in the uniform resource locator detection interface, wherein the performance indicator data is obtained by statistics when the service instance executes the preset operation; A priority calculation module, used to calculate the priority of the service instance according to the performance indicator data; A policy updating module, used to adjust the load balancing policy for a plurality of the service instances according to the priority to obtain an updated load balancing policy; The service calling module is used to call the service instance according to the updated load balancing strategy.
9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; The processor is used to implement the steps of the load balancing strategy adjustment method described in any one of claims 1-7 when executing the program stored in the memory.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the load balancing strategy adjustment method as described in any one of claims 1 to 7 is implemented.