A microservice resource allocation method, device, electronic device and storage medium

By receiving access requests from tenants and determining the target microservice cluster based on tenant identification, combined with monitoring and resource adjustment mechanisms, the problem of excessive cluster load caused by requested access between multiple tenants is solved, and the rational allocation and efficient utilization of microservice resources are achieved.

CN114827248BActive Publication Date: 2025-03-18ZHEJIANG XITUMENG DIGITAL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210353457.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-31
Publication Date
2025-03-18
Estimated Expiration
2042-03-31

AI Technical Summary

Technical Problem

Existing microservice resource allocation methods cannot effectively avoid the excessive cluster load and service performance impact caused by large-scale requests between multiple tenants to access services.

Method used

By receiving access requests from tenants, obtaining the microservice cluster collection, and determining the target microservice cluster based on the tenant's identity, calling the microservices in the target microservice cluster. In addition, by monitoring the actual access situation of tenants, the allocation of resource size of microservice clusters is flexibly adjusted to ensure maximum resource utilization.

Benefits of technology

The rational allocation of microservice resources is achieved, reducing the problem of excessive cluster load caused by large-scale common access between multiple tenants, and improving service performance and resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114827248B_ABST
    Figure CN114827248B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a microservice resource allocation method, device, electronic device and storage medium, the method comprising: receiving a tenant's access request, the access request carrying a tenant identifier; obtaining a microservice cluster set; the microservice cluster set includes at least one microservice cluster; based on the tenant identifier, determining the microservice cluster corresponding to the tenant identifier in the microservice cluster set as the target microservice cluster; calling the microservice in the target microservice cluster. Through the microservice resource allocation method provided by the embodiment of the present application, exclusive use of service resources can be achieved, reducing the probability of access obstruction caused by resource occupation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network technology, and in particular to a microservice resource allocation method, device, electronic device and storage medium. Background Art

[0002] With the advent of the wave of industrial digital reform, more and more manufacturers have begun to carry out industrial manufacturing digital construction, and improve production capacity and management by upgrading production and manufacturing equipment to digitalization and intelligence. Therefore, a general industrial Internet of Things platform needs to support multi-tenant and multi-device access. With the explosive growth of data transmission and access requirements, the requirements for the platform's service provision capabilities are also increasing.

[0003] The current microservice resource method cannot guarantee that different tenants will not be affected by each other's access or services. When a large number of tenant access or service access affects the access speed, timely and reasonable diversion measures cannot be taken, and the consequences will be very serious. Therefore, the design of the platform needs to ensure that independent resource deployment services can be provided to designated tenants, and fundamentally prevent the impact of a large number of requests for access services between tenants. Summary of the invention

[0004] In view of the defects of the prior art, the embodiments of the present disclosure provide a microservice resource allocation method, device, electronic device and storage medium, which can realize exclusive use of service resources and reduce the probability of access obstruction caused by resource occupation.

[0005] An embodiment of the present application provides a microservice resource allocation method, the method comprising: receiving an access request from a tenant, the access request carrying a tenant identifier; obtaining a microservice cluster set; the microservice cluster set comprising at least one microservice cluster; based on the tenant identifier, determining a microservice cluster corresponding to the tenant identifier in the microservice cluster set as a target microservice cluster; and calling a microservice in the target microservice cluster.

[0006] Specifically, before accepting the access request of the tenant, the access request carries the tenant identifier, the method also includes: receiving the registration request of the tenant, the registration request carries the tenant information; assigning the tenant identifier to the tenant; based on the tenant information, assigning a microservice cluster to the tenant; the microservice cluster corresponds to the tenant identifier.

[0007] Specifically, based on user information, a microservice cluster is allocated to a tenant, including: based on the tenant information, determining the load estimate of the tenant; if the load estimate is greater than a first load threshold, allocating an independent microservice cluster to the tenant; the independent microservice cluster is one type of microservice cluster, and the number of tenants served by the independent microservice cluster is one.

[0008] Specifically, based on user information, a microservice cluster is allocated to a tenant, including: based on the tenant information, determining the load estimate of the tenant; if the load estimate is less than or equal to a first load threshold, allocating a non-independent microservice cluster to the tenant; the non-independent microservice cluster is a type of microservice cluster, and the number of tenants served by the independent microservice cluster is multiple.

[0009] Specifically, based on the tenant identifier, the microservice cluster corresponding to the tenant in the microservice cluster set is determined as the target microservice cluster, including: obtaining the real-time load of the microservice cluster corresponding to the tenant; if the real-time load is greater than the second load threshold for a duration greater than a preset duration, the association between the tenant and the microservice cluster corresponding to the tenant is released; the microservice cluster is reallocated to the tenant, and an association is established between the tenant and the newly allocated microservice cluster; and the newly allocated microservice cluster corresponding to the tenant is determined as the target microservice cluster.

[0010] Specifically, before obtaining the microservice cluster set, the method also includes: obtaining a tenant identification list; based on the tenant identification, determining the microservice cluster corresponding to the tenant in the microservice cluster set as the target microservice cluster, including: if the tenant identification exists in the tenant identification list, determining the microservice cluster corresponding to the tenant in the microservice cluster set as the target microservice cluster.

[0011] Specifically, the access request also carries a function identifier, and calling a microservice in a target microservice cluster includes: based on the function identifier, calling a target microservice corresponding to the function identifier in the target microservice cluster.

[0012] Accordingly, an embodiment of the present application provides a microservice resource allocation device, which includes: a receiving module for receiving an access request from a tenant, the access request carrying a tenant identifier; an acquisition module for acquiring a microservice cluster set; the microservice cluster set includes at least one microservice cluster; a determination module for determining, based on the tenant identifier, a microservice cluster corresponding to the tenant identifier in the microservice cluster set as a target microservice cluster; and a service module for calling a microservice in the target microservice cluster.

[0013] Specifically, the microservice resource allocation device may further include an allocation module, which is used to: receive a registration request from a tenant, the registration request carries tenant information; allocate a tenant identifier to the tenant; allocate a microservice cluster to the tenant based on the tenant information; and the microservice cluster corresponds to the tenant identifier.

[0014] Specifically, the allocation module is used to: determine the tenant's load estimate based on the tenant information; if the load estimate is greater than the first load threshold, allocate an independent microservice cluster to the tenant; the independent microservice cluster is one type of microservice cluster, and the number of tenants served by the independent microservice cluster is one.

[0015] Specifically, the allocation module is used to: determine the tenant's load estimate based on the tenant information; if the load estimate is less than or equal to the first load threshold, allocate a non-independent microservice cluster to the tenant; the non-independent microservice cluster is one type of microservice cluster, and the number of tenants served by the independent microservice cluster is multiple.

[0016] Specifically, the determination module is also used to: obtain the real-time load of the microservice cluster corresponding to the tenant; if the real-time load is greater than the second load threshold for a duration greater than a preset duration, then the association between the tenant and the microservice cluster corresponding to the tenant is terminated; the microservice cluster is reallocated to the tenant, and an association is established between the tenant and the newly allocated microservice cluster; and the newly allocated microservice cluster corresponding to the tenant is determined as the target microservice cluster.

[0017] Specifically, the acquisition module is further used to: acquire a tenant identification list; the determination module is further used to: if the tenant identification exists in the tenant identification list, determine the microservice cluster corresponding to the tenant in the microservice cluster set as the target microservice cluster.

[0018] Specifically, the access request also carries a function identifier, and the calling module is further used to: based on the function identifier, call the target microservice corresponding to the function identifier in the target microservice cluster.

[0019] Accordingly, an embodiment of the present disclosure provides an electronic device, which includes a processor and a memory, wherein at least one instruction, at least one program, a code set, or an instruction set is stored in the memory, and the at least one instruction, at least one program, a code set, or an instruction set is loaded and executed by the processor to implement the above-mentioned microservice resource allocation method.

[0020] Accordingly, an embodiment of the present disclosure provides a computer-readable storage medium, in which at least one instruction, at least one program, code set or instruction set is stored, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the above-mentioned microservice resource allocation method.

[0021] The embodiments of the present application have the following beneficial effects:

[0022] (1) By pre-configuring the relationship between tenants and microservice clusters, the purpose of reasonable allocation of microservice resources can be achieved, reducing or avoiding the probability of excessive cluster load and affecting service performance due to a large number of common accesses among multiple tenants;

[0023] (2) By monitoring the actual access of tenants and flexibly adjusting the allocation of microservice cluster resources, it is possible to maximize resource utilization while ensuring service independence. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0025] Figure 1 This is a schematic diagram of an application scenario of a microservice resource allocation method provided in an embodiment of the present application;

[0026] Figure 2 This is a first flow chart of a microservice resource allocation method provided in an embodiment of the present application;

[0027] Figure 3 This is a second flow chart of a microservice resource allocation method provided in an embodiment of the present application;

[0028] Figure 4 It is a third flow chart of a microservice resource allocation method provided in an embodiment of the present application;

[0029] Figure 5 It is a structural diagram of a microservice resource allocation device provided in an embodiment of the present application;

[0030] Figure 6 This is a hardware structure block diagram of a server of a microservice resource allocation method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0031] In order to make the purpose, technical scheme and advantages of the present application clearer, the embodiments of the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiment is only one embodiment of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0032] The "embodiment" referred to herein refers to a specific feature, structure or characteristic that may be included in at least one implementation of the present application. In the description of the embodiments of the present application, it should be understood that the orientation or positional relationship indicated by the terms "upper", "lower", "left", "right", "top", "bottom", etc. is based on the orientation or positional relationship shown in the accompanying drawings, which is only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device / system or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present application. The terms "first" and "second" are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first" and "second" may include one or more of the features explicitly or implicitly. Moreover, the terms "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here. In addition, the terms "including" and "having" / "for" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system / apparatus, product or apparatus comprising a series of steps or units / modules is not necessarily limited to those steps or units / modules explicitly listed, but may include other steps or units / modules not explicitly listed or inherent to such process, method, product or apparatus.

[0033] The following is a specific embodiment of a microservice resource allocation method provided by this application. Figure 1 , Figure 1 This is a schematic diagram of an application scenario of microservice resource allocation provided by an embodiment of the present application. Figure 1 As shown, it includes a server 101 and a terminal 102. Optionally, the server 101 and the terminal 102 may be connected via a wireless link or a wired link, which is not limited in the present disclosure.

[0034] Specifically, the server 101 can be an industrial Internet of Things platform, and multiple tenants can access the industrial Internet of Things platform through multiple terminals 102. The terminal 102 needs to access the server 101 to implement the microservices required by the tenants. The server 101 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Optionally, the operating system running on the server 101 may include but is not limited to IOS, Linux, Windows, Unix, Android systems, etc.

[0035] In an optional embodiment, the terminal 102 can communicate with the server 101 and send an access request to the server 101 when there is a demand for microservices; then, after receiving the access request, the server 101 can obtain a set of microservice clusters, determine the microservice cluster corresponding to the tenant identifier in the microservice cluster set as the target microservice cluster based on the tenant identifier, and call the microservice in the target microservice cluster. Specifically, the terminal 102 may include but is not limited to electronic devices such as smart phones, desktop computers, tablet computers, laptops, smart speakers, digital assistants, augmented reality (AR) / virtual reality (VR) devices, smart wearable devices, etc. Optionally, the operating system running on the electronic device may include but is not limited to Android, IOS, Linux, Windows, etc.

[0036] In addition, it should be noted that Figure 1 What is shown is only one application environment of the microservice resource allocation method provided by the present disclosure. In actual applications, other application environments may also be included, and this embodiment does not limit this.

[0037] The following is an exemplary process of a microservice resource allocation method provided by this application. Figure 2 This is a first flow chart of a microservice resource allocation method provided in an embodiment of the present application. This specification provides method or process operation steps as shown in the embodiment or flow chart, but may include more or fewer operation steps based on conventional or non-creative labor. The order of steps listed in the embodiment is only one of many execution orders and does not represent the only execution order. In actual execution, the method or process sequence shown in the embodiment or the accompanying drawings may be executed or executed in parallel (for example, in a parallel processor or multi-threaded processing environment). Specifically, Figure 2 As shown, the method includes:

[0038] S201: Receive an access request from a tenant.

[0039] Specifically, the microservice system can be a system composed of a routing layer, an API (Application Programming Interface) service system, a microservice system, a database system, and an operating environment. In a specific implementation, the operating environment can be an operating environment under K8S (Kubernetes) container technology.

[0040] The access request sent by the tenant to the microservice system can carry the tenant ID. The access request can be an access request filtered by the routing service or routing gateway of the routing layer, such as the 7-layer filtering of the YARP (reverse proxy framework, YetAnother Robot Platform) routing layer. The filtered access request can reach the API service system based on the GOIN framework. The functions of the API service system include tenant ID management, system settings, system permissions, tenant configuration, etc.

[0041] The embodiment of the present application can achieve reasonable resource allocation by pre-grouping all tenants and assigning corresponding microservice clusters. The process of tenant pre-configuration of microservice clusters in the embodiment of the present application can be implemented based on the tenant identification management and tenant configuration functions of the API service system. Figure 3 The steps before step S201 of a microservice resource allocation method in an embodiment of the present application are further described. Figure 3 2 is a schematic diagram of a second process flow of a microservice resource allocation method provided in an embodiment of the present application. In a specific implementation, before step S201, steps S301-S303 may also be included. For details, please refer to Figure 3 ,like Figure 3 The diagram includes:

[0042] S301: receiving a registration request from a tenant, where the registration request carries tenant information.

[0043] Specifically, the tenant information may include information that characterizes the tenant's microservice requirements, including package information and tenant type information.

[0044] S302: Allocate a tenant ID to the tenant.

[0045] Specifically, a tenant ID may be generated when a tenant registers, and the tenant ID may correspond one-to-one to the tenant.

[0046] In a specific implementation, the K8S configuration center can configure the tenant ID and configure the microservice cluster corresponding to the tenant ID to implement microservice management.

[0047] S303: Allocate a microservice cluster to the tenant based on the tenant information.

[0048] Specifically, a microservice cluster suitable for the tenant can be determined from multiple microservice clusters based on the tenant's package information, and the access load margin of this microservice cluster is greater than the access load estimate corresponding to the tenant's package information. Microservice clusters are allocated to tenants based on the tenant's information, that is, an association relationship is established between the microservice cluster and the tenant. The load amount and load value of the embodiments of the present application may refer to the access load peak, where the load estimate may be the estimated load peak, and the load actual measurement may be the measured load peak.

[0049] In a specific implementation, the large tenant can be separately classified into an independent microservice cluster. Step S303 can also include: determining the load estimate of the tenant based on the tenant information; if the load estimate is greater than the first load threshold, allocating an independent microservice cluster to the tenant; the independent microservice cluster is one type of microservice cluster, and the number of tenants served by the independent microservice cluster is one.

[0050] In a specific implementation, multiple small tenants may be grouped into a non-independent microservice cluster. Step S303 may also include: determining a tenant's load estimate based on tenant information; if the load estimate is less than or equal to a first load threshold, allocating a non-independent microservice cluster to the tenant; the non-independent microservice cluster is a type of microservice cluster, and the number of tenants served by the independent microservice cluster is multiple.

[0051] Specifically, after the tenant registers, the microservice distributed system can automatically scale the corresponding tenant services by monitoring the tenant access request volume and the memory and CPU usage of the service machine. That is, it can flexibly adjust the allocation of microservice cluster resource size, thereby maximizing resource utilization while maintaining service independence.

[0052] In an embodiment of the present application, by pre-configuring the association relationship between tenants and microservice clusters, the microservice calls of the corresponding tenants can be implemented by accessing different APIs, thereby achieving the purpose of reasonable allocation of microservice resources and reducing or avoiding the probability of affecting service performance due to excessive cluster load caused by a large number of common accesses among multiple tenants.

[0053] Next, we will continue based on Figure 2 A microservice resource allocation method according to an embodiment of the present application is described.

[0054] S202: Obtain a microservice cluster set.

[0055] Specifically, the microservice cluster set may include at least one microservice cluster. Microservice clusters may include independent microservice clusters and non-independent microservice clusters. These microservice clusters may be configured when all tenants register, or may be adjusted according to actual access requirements during the actual access process. Each microservice cluster contains multiple microservices, and the microservice functions of each microservice cluster may be consistent, and the resource size and load of different microservice clusters may be different.

[0056] S203: Based on the tenant identifier, determine the microservice cluster corresponding to the tenant identifier in the microservice cluster set as the target microservice cluster.

[0057] Specifically, a microservice cluster may correspond to a tenant identifier. Each microservice cluster may correspond to one or more tenants or tenant identifiers. By identifying the tenant identifier, based on the association between the tenant identifier and the microservice cluster, the microservice cluster corresponding to the tenant identifier in the microservice cluster set may be determined as the target microservice cluster.

[0058] In a specific implementation, a tenant identification list may be obtained before step S202. In this embodiment, S203 may include: if the tenant identification exists in the tenant identification list, determining the microservice cluster corresponding to the tenant in the microservice cluster set as the target microservice cluster. The tenant identification list may include tenant identification information of each tenant, and may also include microservice cluster information corresponding to each tenant. The tenant identification list may be continuously updated based on the registration of new tenants, and may also be updated based on changes in the association relationship between the microservice cluster and the tenant.

[0059] The following is based on Figure 4 Step S203 is further described. Figure 4 This is a third flow chart of a microservice resource allocation method provided in an embodiment of the present application. Figure 4 ,like Figure 4 As shown, the exemplary process of step S203 includes:

[0060] S401: Obtain the real-time load of the microservice cluster corresponding to the tenant.

[0061] Specifically, the real-time load may be the real-time access load of the microservice cluster.

[0062] S402: If the duration during which the real-time load is greater than the second load threshold is greater than a preset duration, the association between the tenant and the microservice cluster corresponding to the tenant is released.

[0063] Specifically, dissolving the association between a tenant and the microservice cluster corresponding to the tenant means that the tenant no longer corresponds to the microservice cluster, while the association between other tenants served by the microservice cluster and the microservice cluster remains unchanged.

[0064] S403: Reallocate the microservice cluster to the tenant, and establish an association between the tenant and the newly allocated microservice cluster.

[0065] Specifically, the measured load value of the tenant can be obtained, and a microservice cluster suitable for the tenant can be determined from multiple microservice clusters, and the access load margin of this microservice cluster is greater than the measured load value of the tenant. Microservice clusters are allocated to tenants based on the tenant's information, that is, an association relationship is established between the microservice cluster and the tenant. The load amount and load value of the embodiment of the present application may refer to the access load peak, where the load estimate may be the estimated load peak, and the measured load may be the measured load peak within a preset time length.

[0066] In a specific implementation, an independent microservice cluster may be reallocated to the large tenant. Step S403 may also include: obtaining the actual load value of the tenant; if the actual load value is greater than the first load threshold, allocating the independent microservice cluster to the tenant; the independent microservice cluster is one type of microservice cluster, and the number of tenants served by the independent microservice cluster is one.

[0067] In a specific implementation, a non-independent microservice cluster may be reallocated to the small tenant. Step S403 may also include: obtaining the actual load value of the tenant; if the actual load value is less than or equal to the first load threshold, allocating a non-independent microservice cluster to the tenant; the non-independent microservice cluster is one type of microservice cluster, and the number of tenants served by the independent microservice cluster is multiple.

[0068] S404: Determine the newly allocated microservice cluster corresponding to the tenant as the target microservice cluster.

[0069] Specifically, based on the association relationship between the reallocated tenant identifier and the microservice cluster, the newly allocated microservice cluster corresponding to the tenant may be determined as the target microservice cluster.

[0070] Next, we will continue based on Figure 2 A microservice resource allocation method according to an embodiment of the present application is described.

[0071] S204: Call the microservice in the target microservice cluster.

[0072] In a specific implementation, the access request received in step S201 also carries a function identifier, and step S204 may further include: based on the function identifier, calling a target microservice corresponding to the function identifier in the target microservice cluster.

[0073] Specifically, the microservice distributed service system can parse the service requests of different tenants according to the access requests of different tenants, and then call the corresponding microservices for service response. When performing multi-tenant routing distribution to call microservices, you need to know the service IP and port of the microservice. Based on the dapr sidecar mode, you can call it through the microservice name. The functional identifiers of microservices can correspond to different microservice names respectively. The microservice names may include device access, tenant management, system management, event reporting, reading and writing databases, etc. The microservice system can provide a microservice interface based on the dapr sidecar mode for the GOIN framework to call, and can interact with data according to demand. Specifically, based on the functional identifier of device access, the relevant information of the newly connected device can be written to the database by calling the device access microservice.

[0074] In an embodiment of the present application, by executing a microservice resource allocation method of the present application, interface management can be centrally performed through an API service system, and multi-tenant access diversion and distribution of API access requests can be implemented based on tenant identification of different tenants, thereby achieving exclusive use of service resources within a group, while achieving the effect of non-interference between different groups.

[0075] Accordingly, the present application provides a microservice resource allocation device. Figure 5 Schematic diagram of a microservice resource allocation device provided in an embodiment of the present application. Figure 5 As shown, the microservice resource allocation device 500 may include:

[0076] The receiving module 501 may be used to receive an access request from a tenant, where the access request carries a tenant identifier.

[0077] The acquisition module 502 may be used to acquire a microservice cluster set; the microservice cluster set includes at least one microservice cluster.

[0078] The determination module 503 may be configured to determine, based on the tenant identifier, a microservice cluster corresponding to the tenant identifier in the microservice cluster set as a target microservice cluster.

[0079] The service module 504 may be used to call a microservice in a target microservice cluster.

[0080] Specifically, the microservice resource allocation device may further include an allocation module, which is used to: receive a registration request from a tenant, the registration request carries tenant information; allocate a tenant identifier to the tenant; allocate a microservice cluster to the tenant based on the tenant information; and the microservice cluster corresponds to the tenant identifier.

[0081] Specifically, the allocation module can be used to: determine the tenant's load estimate based on tenant information; if the load estimate is greater than the first load threshold, allocate an independent microservice cluster to the tenant; the independent microservice cluster is one type of microservice cluster, and the number of tenants served by the independent microservice cluster is one.

[0082] Specifically, the allocation module can be used to: determine the tenant's load estimate based on the tenant information; if the load estimate is less than or equal to the first load threshold, allocate a non-independent microservice cluster to the tenant; the non-independent microservice cluster is one type of microservice cluster, and the number of tenants served by the independent microservice cluster is multiple.

[0083] Specifically, the determination module 503 can also be used to: obtain the real-time load of the microservice cluster corresponding to the tenant; if the real-time load is greater than the second load threshold for a duration greater than a preset duration, then the association between the tenant and the microservice cluster corresponding to the tenant is terminated; the microservice cluster is reallocated to the tenant, and an association is established between the tenant and the newly allocated microservice cluster; and the newly allocated microservice cluster corresponding to the tenant is determined as the target microservice cluster.

[0084] Specifically, the acquisition module 502 may also be used to: acquire a tenant identification list; the determination module 503 may also be used to: if the tenant identification exists in the tenant identification list, determine the microservice cluster corresponding to the tenant in the microservice cluster set as the target microservice cluster.

[0085] Specifically, the access request also carries a function identifier, and the calling module 504 may be further used to: based on the function identifier, call a target microservice corresponding to the function identifier in the target microservice cluster.

[0086] The device embodiments and method embodiments of the present application may be based on the same concept.

[0087] Accordingly, an embodiment of the present disclosure also provides an electronic device, which includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set, or an instruction set, and the at least one instruction, at least one program, a code set, or an instruction set is loaded and executed by the processor to implement the above-mentioned microservice resource allocation method.

[0088] The method embodiments provided in the embodiments of the present application can be executed in a computer terminal, a server or a similar computing device. Taking running on a server as an example, Figure 6 : is a hardware structure block diagram of a server of a microservice resource allocation method provided in an embodiment of the present application. Figure 6As shown, the server 600 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 610 (the central processing unit 610 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 630 for storing data, and one or more storage media 620 (such as one or more mass storage devices) for storing application programs 623 or data 622. Among them, the memory 630 and the storage medium 620 can be short-term storage or permanent storage. The program stored in the storage medium 620 may include one or more modules, each of which may include a series of instruction operations on the server. Furthermore, the central processing unit 610 can be configured to communicate with the storage medium 620 and execute a series of instruction operations in the storage medium 620 on the server 600. The server 600 may also include one or more power supplies 650, one or more wired or wireless network interfaces 650, one or more input and output interfaces 640, and / or one or more operating systems 621, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0089] The input / output interface 640 may be used to receive or send data via a network. The specific example of the network may include a wireless network provided by a communication provider of the server 600. In one example, the input / output interface 640 includes a network adapter (Network Interface Controller, NIC), which may be connected to other network devices via a base station so as to communicate with the Internet. In one example, the input / output interface 640 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0090] It can be understood by those skilled in the art that Figure 6 The structure shown is for illustration only and does not limit the structure of the above electronic device. Figure 6 More or fewer components as shown, or with Figure 6 Different configurations shown.

[0091] The present application implements a storage medium, which can be set in a server to store at least one instruction, at least one program, code set or instruction set related to the microservice resource allocation method in the method embodiment, and the at least one instruction, the at least one program, the code set or instruction set is loaded and executed by the processor to implement the above-mentioned microservice resource allocation method.

[0092] Specifically, in this embodiment, the storage medium may be located in at least one of the multiple network servers of the computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to, various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a mobile hard disk, a magnetic disk, or an optical disk.

[0093] In the present invention, unless otherwise clearly specified and limited, the terms "connected", "connection" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be a connection between two elements or an interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0094] It should be noted that the order of the above embodiments of the present application is only for description and does not represent the advantages and disadvantages of the embodiments. The above description describes specific embodiments, and other embodiments are also within the scope of the attached claims. In some cases, the actions or steps recorded in the claims can be performed in the order of different embodiments and can achieve the expected results. In addition, the processes depicted in the drawings do not necessarily require a specific order or connection order to achieve the desired results. In some embodiments, multi-task parallel processing is also possible or may be advantageous.

[0095] Each embodiment in this specification is described in a progressive 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 embodiments of the device / system, since they are based on similarities to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0096] The above are preferred embodiments of the present invention. It should be noted that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.

Claims

1. A microservice resource allocation method, characterized in that: The method comprises: Receive an access request from a tenant, where the access request carries a tenant identifier; Obtain a microservice cluster set; the microservice cluster set includes at least one microservice cluster; Based on the tenant identifier, determining the microservice cluster corresponding to the tenant identifier in the microservice cluster set as the target microservice cluster; Calling a microservice in the target microservice cluster; The determining, based on the tenant identifier, a microservice cluster corresponding to the tenant in the microservice cluster set as a target microservice cluster includes: Obtain the real-time load of the microservice cluster corresponding to the tenant, where the real-time load is the real-time access load of the microservice cluster corresponding to the tenant; If the duration that the real-time load is greater than the second load threshold is greater than a preset duration, the association between the tenant and the microservice cluster corresponding to the tenant is released; Re-assigning a microservice cluster to the tenant, and establishing an association between the tenant and the newly assigned microservice cluster; Determine the newly allocated microservice cluster corresponding to the tenant as the target microservice cluster; Before receiving the access request from the tenant, wherein the access request carries the tenant identifier, Receive a registration request from a tenant, where the registration request carries tenant information; assigning a tenant identifier to the tenant; Based on the tenant information, a microservice cluster is allocated to the tenant; the microservice cluster corresponds to the tenant identifier; The allocating a microservice cluster to the tenant based on the tenant information includes: Based on the tenant information, determine a load estimate of the tenant, where the load estimate is an estimate of a load access peak value of the tenant; If the load estimate is greater than a first load threshold, an independent microservice cluster is allocated to the tenant; the independent microservice cluster is one of the microservice clusters, and the number of tenants served by the independent microservice cluster is one.

2. A microservice resource allocation method according to claim 1, characterized in that: The allocating a microservice cluster to the tenant based on the user information includes: Determining a load estimate of the tenant based on the tenant information; If the load estimate is less than or equal to a first load threshold, allocating a non-independent microservice cluster to the tenant; The non-independent microservice cluster is one of the microservice clusters, and the number of tenants served by the independent microservice cluster is multiple.

3. A microservice resource allocation method according to claim 1, characterized in that: Before obtaining the microservice cluster set, the method further includes: Get a list of tenant IDs; The determining, based on the tenant identifier, a microservice cluster corresponding to the tenant in the microservice cluster set as a target microservice cluster includes: If the tenant identifier exists in the tenant identifier list, the microservice cluster corresponding to the tenant in the microservice cluster set is determined as the target microservice cluster.

4. A microservice resource allocation method according to claim 1, characterized in that: The access request also carries a function identifier, and the calling of the microservice in the target microservice cluster includes: Based on the function identifier, the target microservice corresponding to the function identifier in the target microservice cluster is called.

5. A microservice resource allocation device, characterized in that: The device comprises: A receiving module, configured to receive an access request from a tenant, wherein the access request carries a tenant identifier; An acquisition module, used to acquire a microservice cluster set; the microservice cluster set includes at least one microservice cluster; A determination module, configured to determine, based on the tenant identifier, a microservice cluster corresponding to the tenant identifier in the set of microservice clusters as a target microservice cluster; A service module, used to call the microservices in the target microservice cluster; The determination module is specifically used for: Obtain the real-time load of the microservice cluster corresponding to the tenant, where the real-time load is the real-time access load of the microservice cluster corresponding to the tenant; If the duration that the real-time load is greater than the second load threshold is greater than a preset duration, the association between the tenant and the microservice cluster corresponding to the tenant is released; Re-assigning a microservice cluster to the tenant, and establishing an association between the tenant and the newly assigned microservice cluster; Determine the newly allocated microservice cluster corresponding to the tenant as the target microservice cluster; The device is also used for: Receive a registration request from a tenant, where the registration request carries tenant information; assigning a tenant identifier to the tenant; Based on the tenant information, a microservice cluster is allocated to the tenant; the microservice cluster corresponds to the tenant identifier; Based on the tenant information, determine a load estimate of the tenant, where the load estimate is an estimate of a load access peak value of the tenant; If the load estimate is greater than a first load threshold, an independent microservice cluster is allocated to the tenant; the independent microservice cluster is one of the microservice clusters, and the number of tenants served by the independent microservice cluster is one.

6. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the microservice resource allocation method according to any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the microservice resource allocation method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Gateway dynamic routing method and device, computer equipment and storage medium

    CN111092816A

  • Service request method and device and electronic equipment

    CN114189525A