A service resource allocation method based on two-tier architecture
Through the service resource allocation method of the two-layer architecture, the lower-level services report load information in real time and allocate them reasonably through the upper-level services, solving the load imbalance caused by the unreasonable upper-level service address, and realizing load balancing and stable services.
Patent Information
- Application Number
- CN202111551631.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-18
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2041-12-18
AI Technical Summary
Under the hierarchy of the system architecture, the upper-level service has poor timeliness for the load information of the lower-level service cluster, resulting in unreasonable service addresses obtained on the end side, unbalanced lower-level service loads, and even high loads or downtime.
Through the dual-layer architecture design, the lower-level services report load information to the service statistician in real time, and the service statistician summarizes and updates to the cache of the upper-level services. The service allocator makes reasonable allocations based on the load information to ensure that the end-side obtains the best service address.
It realizes load balancing of the lower-level service cluster, reduces single node overload, avoids downtime, and provides a stable service experience.
Smart Images

Figure CN114217970B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of resource allocation, and in particular to a service resource allocation method based on a double-layer architecture. Background Art
[0002] In a layered system architecture, the service addresses of lower-layer services must be reasonably allocated to the client side by the upper-layer services. During this allocation process, the upper-layer services may not have timely information about the load of the lower-layer service clusters, or the allocation algorithm may be imperfect. This may result in the client side obtaining suboptimal service addresses, leading to unbalanced loads on the lower-layer services, causing high loads and even impacting normal services.
[0003] The main reasons for unreasonable allocation are the long time required to collect, summarize, and report load information of the lower-level service cluster and the unreasonable calculation method used by the upper-level service when allocating service addresses. Summary of the Invention
[0004] The purpose of the present invention is to provide a service resource allocation method based on a two-layer architecture, so that the lower-layer service cluster can summarize and report its own load and other conditions in a timely manner, and the upper-layer service uses reasonable allocation logic when allocating, so that the end side can obtain the best service address while ensuring that the lower-layer service cluster is load-balanced and provides normal and stable services.
[0005] To achieve the above object, the present invention provides the following technical solution: a service resource allocation method based on a two-layer architecture, comprising the following steps:
[0006] Step (1), the lower-level service provider cluster can provide different capabilities. When the service is online and a client connection is established, resulting in load changes, the load information is reported to the service statistician in the cluster in real time according to the load information;
[0007] Step (2), the service statistician aggregates all load information, distinguishes services with different capabilities and calculates the total load status of the lower-level cluster. When the total load status changes, it is actively reported to the service collector in the upper-level service, and used for calculation when allocating services in the upper-level service.
[0008] Step (3): After receiving the load change of the lower-layer service, the service collector in the upper-layer service dynamically updates it to the cache service and provides it to the service distributor for allocation and use;
[0009] Step (4): When the client needs service resources, it selects the corresponding service resource type and obtains it through the service allocator in the upper layer service;
[0010] Step (5): When the service allocator receives the request from the client side to obtain the lower-layer service address, it obtains the load information of the corresponding resource from the cache service according to the resource type required, calculates the load information of the lower-layer service according to different allocation algorithms, obtains the best connectable service address on the client side, and returns it to the client side for use;
[0011] Step (6): After the client obtains the required resources, it can establish a connection with them to complete the function.
[0012] Preferably, in step (1), the load information includes total service capacity and idle service capacity.
[0013] Preferably, in step (5), the load information is the minimum load, the most recent access, and the designated area calculation method.
[0014] Preferably, in step (5), when the terminal side obtains the service address, the allocator uses a reasonable method to send the service address to the terminal side.
[0015] Preferably, in step (5), the service collector refreshes the cached load information in real time when receiving the load information reported by the lower-layer service cluster.
[0016] The present invention proposes a service resource allocation method based on a two-layer architecture, which has the following beneficial effects: the present invention provides a reasonable service address on the end side, obtains a better service experience on the end side, balances the load of the lower-layer service cluster, and reduces or even avoids the situation where a single node is overloaded or even crashes. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 This is a principle block diagram of the present invention. DETAILED DESCRIPTION
[0018] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0019] For examples, see Figure 1 , the present invention provides a technical solution: a service resource allocation method based on a two-layer architecture, characterized by: comprising the following steps;
[0020] Step (1), the lower-level service provider cluster can provide different capabilities. When the service is online and a client connection is established, resulting in load changes, the load information is reported to the service statistician in the cluster in real time according to the load information;
[0021] Step (2), the service statistician aggregates all load information, distinguishes services with different capabilities and calculates the total load status of the lower-level cluster. When the total load status changes, it is actively reported to the service collector in the upper-level service, and used for calculation when allocating services in the upper-level service.
[0022] Step (3): After receiving the load change of the lower-layer service, the service collector in the upper-layer service dynamically updates it to the cache service and provides it to the service distributor for allocation and use;
[0023] Step (4): When the client needs service resources, it selects the corresponding service resource type and obtains it through the service allocator in the upper layer service;
[0024] Step (5): When the service allocator receives the request from the client side to obtain the lower-layer service address, it obtains the load information of the corresponding resource from the cache service according to the resource type required, calculates the load information of the lower-layer service according to different allocation algorithms, obtains the best connectable service address on the client side, and returns it to the client side for use;
[0025] Step (6): After the client obtains the required resources, it can establish a connection with them to complete the function.
[0026] The lower-level service cluster is divided into service providers and service statisticians, which communicate data through the message middleware: 1. When the service provider occupies the service on the end side, it reports the load information and available capabilities of the service in real time. 2. When the service statistician receives a notification of load information changes, it summarizes and counts the load information of the cluster. If it is inconsistent with the most recent load information, it reports it to the upper-level service.
[0027] The upper-layer services are divided into service collectors and service distributors: 1. When the service collector receives the load information reported by the lower-layer service cluster, it refreshes the cached load information in real time; 2. The service distributor supports a series of distribution algorithms, including but not limited to minimum load distribution, nearest distribution, designated cluster distribution, etc.; when obtaining the service address on the end side, the distributor uses a reasonable method to send the service address to the end side.
[0028] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.
Claims
1. A service resource allocation method based on a two-tier architecture, characterized by: The following steps are included: Step (1), the lower-level service provider cluster can provide different capabilities. When the service is online and a client connection is established, resulting in load changes, the load information is reported to the service statistician in the cluster in real time according to the load information; Step (2), the service statistician aggregates all load information, distinguishes services with different capabilities and calculates the total load status of the lower-level cluster. When the total load status changes, it is actively reported to the service collector in the upper-level service, and used for calculation when allocating services in the upper-level service. Step (3): After receiving the load change of the lower-layer service, the service collector in the upper-layer service dynamically updates it to the cache service and provides it to the service distributor for allocation and use; Step (4): When the client needs service resources, it selects the corresponding service resource type and obtains it through the service allocator in the upper layer service; Step (5): When the service allocator receives the request from the client side to obtain the lower-layer service address, it obtains the load information of the corresponding resource from the cache service according to the resource type required, calculates the load information of the lower-layer service according to different allocation algorithms, obtains the best connectable service address on the client side, and returns it to the client side for use; Step (6): After the client obtains the required resources, it can establish a connection with them to complete the function; In step (1), the load information includes the total service capacity and the idle service capacity; In step (5), the load information is calculated in the form of minimum load, nearest access, and designated area; In step (5), when the end side obtains the service address, the allocator uses a reasonable method to send the service address to the end side; In step (5), when the service collector receives the load information reported by the lower-level service cluster, it refreshes the cached load information in real time.
Citation Information
Patent Citations
Micro service gateway optimization method and apparatus, and storage medium
CN109618002A