Resource matching method, device, electronic device and storage medium

By obtaining client identification information to determine the service environment and selecting target service instances, the problems of service environment isolation and resource matching in distributed application environments are solved, which improves processing efficiency and reduces resource waste.

CN117827458BActive Publication Date: 2025-08-12ZHUHAI BOZHONG SECURITIES INVESTMENT CONSULTING CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410012479.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-03
Publication Date
2025-08-12
Estimated Expiration
2044-01-03

AI Technical Summary

Technical Problem

In distributed application environments separated by front and back end, it is difficult for the prior art to effectively isolate the service environment and match resources, resulting in low stability in the test environment and serious waste of resources.

Method used

By obtaining the client's identification information, determining its corresponding service environment, and selecting the target service instance according to the preset load rules, quickly processing of service requests is achieved.

Benefits of technology

It realizes the isolation of the service environment and efficient matching of resources, improves the efficiency of service request processing, and reduces the waste of manpower and computing resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117827458B_ABST
    Figure CN117827458B_ABST
Patent Text Reader

Abstract

The present invention discloses a resource matching method, device, electronic device and storage medium. The resource matching method includes: obtaining a service request and identification information sent by a client; determining the service environment corresponding to the client according to the identification information; determining the target service instance of the service environment according to the service request and preset load rules; and responding to the service request sent by the client based on the target service instance. In an embodiment of the present invention, the environment is isolated by accessing the corresponding service environment in combination with the identification information of the client, and different clients are divided into different service environments. At the same time, the target service instance is determined based on the preset load rules, and the service request is processed based on the target service instance to ensure that the service request can be effectively processed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] A distributed system consists of a group of computer nodes that communicate over a network and coordinate their work to accomplish a common task. In a distributed application environment with separate front-end and back-end servers, all services, middleware, and databases can be deployed on the server. Distributed services are connected by registering with the same service registry and operating using a common message queue through load balancing.

[0003] However, each service can only provide one version, which reduces stability when used as a test environment. Redeploying an environment based on business needs requires rebuilding services, middleware, and environment configurations, wasting significant manpower and computing resources and increasing costs. Therefore, isolating service environments while ensuring resource matching has become a pressing issue. Summary of the Invention

[0004] The present invention provides a resource matching method, device, electronic device and storage medium to achieve isolation of the service environment, while conveniently determining the service instance corresponding to the service request, ensuring that the service request can be processed quickly.

[0005] According to one aspect of the present invention, a resource matching method is provided, wherein the method comprises:

[0006] Get the service request and identification information sent by the client;

[0007] Determining a service environment corresponding to the client according to the identification information;

[0008] Determine a target service instance of the service environment according to the service request and preset load rules;

[0009] Respond to the service request sent by the client based on the target service instance.

[0010] According to another aspect of the present invention, a resource matching device is provided, wherein the device includes:

[0011] Identification information extraction module, used to obtain the service request and identification information sent by the client;

[0012] A service environment determination module, configured to determine a service environment corresponding to the client according to the identification information;

[0013] A service instance determination module, configured to determine a target service instance of the service environment according to the service request and preset load rules;

[0014] The service request processing module is used to respond to the service request sent by the client based on the target service instance.

[0015] According to another aspect of the present invention, an electronic device is provided, comprising:

[0016] at least one processor; and

[0017] a memory communicatively connected to the at least one processor; wherein,

[0018] The memory stores a computer program executable by the at least one processor. The computer program is executed by the at least one processor so that the at least one processor can perform the resource matching method described in any embodiment of the present invention.

[0019] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the resource matching method according to any embodiment of the present invention when executed.

[0020] The technical solution of the embodiment of the present invention obtains the service request and identification information sent by the client, determines the service environment corresponding to the client according to the identification information, determines the target service instance of the service environment according to the service request and preset load rules, responds to the service request sent by the client based on the target service instance, accesses the corresponding service environment by combining the identification information of the client, isolates the environment, divides different clients into different service environments, and determines the target service instance based on the preset load rules, and processes the service request based on the target service instance to ensure that the service request can be effectively processed.

[0021] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0023] Figure 1This is a flowchart of a resource matching method provided according to the first embodiment of the present invention;

[0024] Figure 2 is a flowchart of another resource matching method provided according to the second embodiment of the present invention;

[0025] Figure 3 is a timing diagram of resource matching provided according to embodiment 3 of the present invention;

[0026] Figure 4 This is a schematic diagram of the structure of a resource matching device provided according to a fourth embodiment of the present invention;

[0027] Figure 5 It is a structural diagram of an electronic device for implementing the resource matching method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0028] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described 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 should fall within the scope of protection of the present invention.

[0029] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0030] Example 1

[0031] Figure 1 This is a flow chart of a resource matching method provided according to the first embodiment of the present invention. This embodiment is applicable to the case of matching target service resources corresponding to service requests in a set of deployment environments. The method can be executed by a resource matching device, which can be implemented in the form of hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes:

[0032] S110: Obtain the service request and identification information sent by the client.

[0033] Among them, the client can also be called the user end, which refers to a computer connected to the network. It accepts the control and management of the server, is the other party that receives the service, corresponds to the server, and provides local services to customers. In the actual operation process, the client may include but is not limited to a personal computer (PC) end and a mobile phone end. A service request refers to a service demand sent by a client. For example, a service request can be a request for the server to access a page. Identification information refers to information used to identify the client. For example, identification information can include but is not limited to an account number, a user's Internet Protocol (IP), an identity document (ID), WeChat openid, an application (APP) device number, etc.

[0034] In an embodiment of the invention, when a client initiates a service request, the service request may pass through a gateway. The gateway may receive the service request and extract the client's identification information to determine the service environment corresponding to the user terminal. In actual operation, the client's identification information may include one or more pieces of information, which is not limited to this.

[0035] S120: Determine the service environment corresponding to the client according to the identification information.

[0036] Among them, the service environment refers to the environment that provides services to the client. In the actual operation process, the service environment may include but is not limited to the gray environment, production environment and test environment. Accordingly, different service environments may correspond to different service resources.

[0037] In an embodiment of the invention, the service environment corresponding to each client may be pre-configured, and the service environment may be matched according to the identification information, with the successfully matched service environment being used as the service environment corresponding to the client. In one embodiment, the service environment corresponding to the client may be stored in association with the identification information, and the service environment corresponding to the client may be queried according to the identification information. If the service environment cannot be queried according to the identification information, the default service environment may be determined as the service environment corresponding to the client.

[0038] S130: Determine a target service instance of the service environment according to the service request and preset load rules.

[0039] Among them, the preset load rule can be a pre-set rule for allocating service requests to the target service instance. In the actual operation process, the preset load rule can be based on the Ribbon load balancing algorithm. The Ribbon load balancing algorithm may include a polling strategy, a weight strategy, a region-sensitive strategy, a random strategy, a minimum number of connections strategy, etc. Customized load rules can be used as preset load rules based on the Ribbon load balancing algorithm. Exemplarily, load balancing can be performed in combination with the client's identification information. When the identification information is the user IP, a region-sensitive strategy is used to determine the service instance corresponding to the client; when the identification information is an identity identification number, a polling strategy is used or the weight of each service instance is set to determine the target service instance corresponding to the client. At the same time, the priority of each load rule is set, and the load rule with the set priority is used as the preset load rule.

[0040] A service instance refers to the software implementation of a service, or rather, the instantiation of a service. A target service instance refers to the service instance used to respond to client requests. Different service instances can belong to different service environments. Different clients can correspond to different target instances, and the target service instance for a client can be determined based on pre-defined load balancing rules.

[0041] In an embodiment of the invention, the service instance associated with the service request can be pulled based on the gateway, and then the service instance associated with the service environment can be determined within each service instance, and the service instance that matches the service request among the service instances associated with the service environment can be determined as the target service instance according to the preset load balancing rule. In the actual operation process, there can be a corresponding environment identifier for each service environment, and each service instance can carry the corresponding environment identifier. The service instance associated with the service request can be determined as the service instance to be determined, and the service instance to be determined that matches the service request can be determined as the target service instance according to the preset load rule. In one embodiment, when there is one service instance to be determined, the service instance to be determined can be used as the target service instance; when there are multiple service instances to be determined, the target load rule can be determined according to the priority in the preset load rule, and the target service instance can be determined according to the target load rule.

[0042] S140: Respond to the service request sent by the client based on the target service instance.

[0043] In an embodiment of the invention, service resources associated with a target service instance can be determined, where the service resources include a message queue and a database, and service requests sent by a client are processed based on the target service instance and the service resources. In actual operation, the service resources corresponding to each target service resource can be pre-set, and an environment identifier of the service environment can be extracted. The service resources associated with the target service instance can be searched based on the environment identifier, and the service request sent by the client can be processed based on the target service instance and the corresponding service resources.

[0044] An embodiment of the present invention obtains a service request and identification information sent by a client, determines the service environment corresponding to the client based on the identification information, determines the target service instance of the service environment based on the service request and preset load rules, responds to the service request sent by the client based on the target service instance, accesses the corresponding service environment in combination with the identification information of the client, isolates the environment, divides different clients into different service environments, and determines the target service instance based on the preset load rules, and processes the service request based on the target service instance to ensure that the service request can be processed quickly.

[0045] In one embodiment, before obtaining the service request and identification information sent by the client, the method further includes:

[0046] Extract the access identifier of each service instance and the environment identifier of the service environment to which each service instance belongs, and associate the access identifier and environment identifier of each service instance and upload them to the service registration center; the access identifier includes the access address and access port;

[0047] Extracting identification information of each initial client and determining the environment identifier corresponding to each identification information based on preset environment configuration rules;

[0048] The environment identification corresponding to each identification information is associated with the identification information and stored as a dynamic identification.

[0049] The access identifier refers to the identifier for accessing a service instance. The access identifier includes the access address and access port. The service instance can be accessed using the access identifier. The environment identifier is identification information used to indicate the service environment. Each service environment corresponds to an environment identifier. In one embodiment, the service resources associated with the service instance can be determined based on the identification information. The service registration center is used to store information related to service requests.

[0050] The preset environment configuration rules refer to the rules for configuring the service environment of each initial client. The preset environment configuration rules can be rules customized according to user needs. In one embodiment, the preset environment configuration rules can include multiple environment configuration rules. For example, the service environment corresponding to the initial client can be configured according to the IP address in the identification information of the initial client; or, a weight can be configured for each service environment to calculate the initial client corresponding to each service environment; or, the service environment corresponding to each initial client can be randomly configured. The initial client refers to the client that initially configures the service environment. For example, the initial client can be the client that exists at the current moment.

[0051] The dynamic identifier is used to store the environment identifier and identification information. The corresponding dynamic identifier can be extracted according to the environment identifier to determine the associated stored identification information; or the corresponding dynamic identifier can be extracted according to the identification information to determine the associated stored environment identifier.

[0052] In an embodiment of the invention, the service instances belonging to each service environment can be determined, the access address and access port of each service instance can be extracted as access identifiers, and the environment identifier of the service environment to which the service instance belongs can be determined, and the access identifier of the service instance can be associated with the environment identifier of the service environment to which it belongs and uploaded to the service registration center to facilitate the subsequent determination of the target service instance. The identification information of each initial client is extracted, and the environment identifier corresponding to each identification information is determined according to the preset environment configuration rules, that is, the service environment corresponding to the initial client is configured, and the environment identifier corresponding to each identification information is associated with the identification information and stored as a dynamic identifier, so as to facilitate the determination of the service environment according to the identification information. In one embodiment, Redis can be used to configure the mapping relationship between the client and the service environment as a dynamic identifier.

[0053] In one embodiment, after determining the service environment corresponding to the client according to the identification information, the method further includes:

[0054] Add the environment identifier corresponding to the service environment to the request header of the service request.

[0055] In an embodiment of the invention, the Hypertext Transfer Protocol (HTTP) header is a data area divided into two types: request headers and response headers. When a client sends a request to a service area, it carries a request header, while when a server responds to the client's data, it carries a response header. After determining the service environment corresponding to the client based on the identification information, the environment identifier corresponding to the service environment can be added to the request header of the service request, so that the environment identifier is subsequently transmitted along with the client's service request.

[0056] Example 2

[0057] Figure 2 This is a flow chart of another resource matching method provided according to the second embodiment of the present invention. This embodiment is a further description of a resource matching method based on the above embodiment. Figure 2 As shown, the method includes:

[0058] S210: Obtain the service request and identification information sent by the client.

[0059] S220: Search for a dynamic identifier stored in association with the identifier information.

[0060] In an embodiment of the invention, the dynamic identifier may be an identifier that stores the environment identifier corresponding to each identification information in association with the identification information. The dynamic identifier may be queried according to the identification information to determine the dynamic identifier stored in association with the identification information.

[0061] S230: Determine the service environment corresponding to the environment identifier in the dynamic identifier as the service environment corresponding to the client.

[0062] In an embodiment of the invention, after the dynamic identifier is determined, the service environment corresponding to the environment identifier in the dynamic identifier may be determined, and the service environment may be used as the service environment corresponding to the client.

[0063] S240: When there is no dynamic identifier that matches the identification information, extract a default service environment as the service environment corresponding to the client.

[0064] The default service environment may be a pre-set service environment. For example, the default service environment may be a grayscale environment, a production environment, and a test environment.

[0065] In an embodiment of the invention, when the corresponding dynamic identifier cannot be found according to the identifier information, a default service environment may be extracted and used as the service environment corresponding to the client.

[0066] S250: Extract at least one service instance associated with the service request.

[0067] In the embodiment of the invention, the service instance associated with the service request can be determined based on the service instance pulled from the registry by the gateway. In the actual operation process, there can be one or more service instances associated with the service request.

[0068] S260. Determine a to-be-determined service instance that carries an environment identifier of a service environment within at least one service instance, and determine a to-be-determined service instance that matches the service request as a target service instance according to a preset load rule; wherein the preset load rule includes a Ribbon load balancing algorithm.

[0069] In an embodiment of the invention, an environment identifier corresponding to a service instance associated with a service request can be determined, and a service instance carrying the environment identifier of the service environment can be determined as a target service instance among the service instances. Then, according to a preset load balancing rule, a service instance among the service instances associated with the service environment that matches the service request can be determined as a target service instance. In one embodiment, when there is only one target service instance, the target service instance can be used as the target service instance. When there are multiple target service instances, a target load rule can be determined according to a priority in a preset load rule, and the target service instance can be determined according to the target load rule.

[0070] S270. Search for service resources associated with the target service instance based on the environment identifier corresponding to the service environment; wherein the service resources include: a message queue and a database.

[0071] Service resources refer to the resources used to process service requests.

[0072] In an embodiment of the invention, the service resources corresponding to the environment identifier may also be stored in the dynamic identifier, and the message queue and database associated with the target service instance may be searched according to the environment identifier as the service resources associated with the target service instance.

[0073] S280: Process the service request sent by the client based on the target service instance and service resources.

[0074] In an embodiment of the invention, after the target service instance and service resource are determined, the service request sent by the client can be processed according to the target service instance and service resource.

[0075] An embodiment of the present invention obtains a service request and identification information sent by a client, searches for a dynamic identifier stored in association with the identification information, determines a service environment corresponding to the environment identifier in the dynamic identifier as the service environment corresponding to the client, and when there is no dynamic identifier matching the identification information, extracts a default service environment as the service environment corresponding to the client, extracts at least one service instance associated with the service request, determines a to-be-determined service instance carrying an environment identifier of the service environment within at least one service instance, and determines a to-be-determined service instance matching the service request as a target service instance according to a preset load rule, searches for service resources associated with the target service instance based on the environment identifier corresponding to the service environment, processes the service request sent by the client based on the target service instance and the service resources, thereby determining the target service instance based on the preset load rule, and determining the corresponding service resources to process the service request. At the same time, according to the identification information and dynamic identifier of the client, the service environment is determined more conveniently, thereby improving the user experience.

[0076] Example 3

[0077] Figure 3 This is a timing diagram of resource matching provided by Example 3 of the present invention. This embodiment is based on the further optimization and expansion of the above implementation mode and can be combined with various optional technical solutions in the above implementation mode. This embodiment takes the case where the service request of the client needs to be processed by service instance A, and at the same time, service instance A needs to schedule service instance B to process the service request as an example. Figure 3 As shown, the method includes:

[0078] The client initiates a service request, which passes through the gateway. The gateway can obtain the client's identification information. This identification information may include a unique account identifier, WeChat OpenID identifier, app device number, user IP address, etc. The gateway can also match the dynamic identifier with the identification information to determine the service environment the client wants to access. The request header also stores the environment identifier of the current service request, which will be passed along with subsequent requests. The gateway pulls the service list from the registry, which contains all service instances associated with the service request. A customized Ribbon load balancing algorithm selects the service instance to be determined and routes the request to the service instance in the corresponding service environment. In one embodiment, Ribbon can pull the service list corresponding to the service request from the service registry, such as the four service instances of service A and their identification information (IP address, port, and environment identifier), and compare it with the environment identifier of the service request obtained from the configuration center. For example, if the test environment identifier is compared, two service instances of service A in the test environment are obtained. The environment identifier defines which load balancing method is used to route the service instance. If round-robin is defined, service instances of service A in the two test environments will be polled for access. When accessing a service instance, the service instance retrieves the request context identifier from the request header to determine which service resources to access, such as the database and message queue. Furthermore, if service instance A needs to schedule service instance B during operation, it can generate information about accessing other service instances, obtain a list of service instances, and use Ribbon load balancing to enable service instance B to respond to the service request. This information determines which service resources to access, such as the database and message queue, and then generates a response to the service request and returns it to the client.

[0079] In one embodiment, different service environments can use the same message queue. Messages can be dispatched to the message queue based on the service request environment identifier. Different service environments can use the same database. Table names may differ in different service environments. For example, the user table may be named test_user in the test environment and dev_user in the dev environment. When accessing the database, aspects can be used to intercept the table name and replace it with the table name represented by the corresponding service environment.

[0080] Before a client initiates a service request, when a service instance is started, the instance's IP address, port (access identifier), and environment identifier can be written to the service registration center for subsequent service environment selection. For example, if service A starts two service instances, IP1:Port1=test and IP2:Port2=dev can be configured. Furthermore, the client supports multi-device identification, including H5, Android, and iOS. Client identification information can include login account, device number, WeChat openID, user IP address, and more. Configuration personnel can configure client identification information in the configuration center, allowing different clients to access different environments. For example, the account can be configured as appId=10100001, service=test, mysql=dev, and mq=test. When a client service request is received, the client's identification information is retrieved. If the client's identification information contains the account appId as 10100001, the configuration center will retrieve the service=test, mysql=dev, and mq=test settings. If no match is found for the client's identification information, the client is assigned to the default service environment, such as the test environment. Subsequent access to service instances can access instances in the test environment. When operating the MySQL database, the database in the dev environment will be accessed. When operating the message queue, the test environment will be accessed.

[0081] This embodiment combines Ribbon with the registration center, allowing the same server instance to be configured with different environment configurations, thus achieving environmental isolation. Dynamic tag configuration uses Redis to configure the mapping relationship between the client and server environments. When obtaining a service request, the service environment to be accessed is determined based on the client's dynamic identifier, the IP address of the corresponding environment service instance is obtained through the registration center, and the corresponding service instance is load-balanced based on Ribbon. The corresponding service resources are then accessed within the service instance based on the dynamic identifier. While achieving environmental isolation, customized resource sharing and isolation are achieved.

[0082] Example 4

[0083] Figure 4 FIG. 1 is a schematic diagram of a resource matching device according to a fourth embodiment of the present invention. Figure 4 As shown, the device includes: an identification information extraction module 41, a service environment determination module 42, a service instance determination module 43 and a service request processing module 44.

[0084] The identification information extraction module 41 is used to obtain the service request and identification information sent by the client.

[0085] The service environment determination module 42 is configured to determine the service environment corresponding to the client according to the identification information.

[0086] The service instance determination module 43 is configured to determine a target service instance of the service environment according to the service request and preset load rules.

[0087] The service request processing module 44 is configured to respond to the service request sent by the client based on the target service instance.

[0088] In an embodiment of the present invention, an identification information extraction module is used to obtain a service request and identification information sent by a client. A service environment determination module determines a service environment corresponding to the client based on the identification information. A service instance determination module determines a target service instance of the service environment based on the service request and preset load rules. A service request processing module responds to a service request sent by the client based on the target service instance. By accessing the corresponding service environment in combination with the identification information of the client, the environment is isolated, and different clients are divided into different service environments. At the same time, a target service instance is determined based on preset load rules, and the service request is processed based on the target service instance to ensure that the service request can be processed quickly.

[0089] In one embodiment, the resource matching device further includes:

[0090] The information upload module is used to extract the access identifier of each service instance and the environment identifier of the service environment to which each service instance belongs, and associate the access identifier and environment identifier of each service instance and upload them to the service registration center; wherein the access identifier includes the access address and access port;

[0091] An environment identification configuration module is used to extract identification information of each initial client and determine the environment identification corresponding to each identification information based on preset environment configuration rules;

[0092] The dynamic identification generation module is used to associate the environment identification corresponding to each identification information with the identification information and store them as a dynamic identification.

[0093] In one embodiment, the service environment determination module 42 includes:

[0094] A dynamic identification search unit, configured to search for a dynamic identification stored in association with the identification information;

[0095] The service environment determining unit is configured to determine the service environment corresponding to the environment identifier in the dynamic identifier as the service environment corresponding to the client.

[0096] In one embodiment, the resource matching device further includes:

[0097] The service environment matching module is used to extract a default service environment as the service environment corresponding to the client when there is no dynamic identifier matching the identification information.

[0098] In one embodiment, the service instance determination module 43 includes:

[0099] A service instance extraction unit, configured to extract at least one service instance associated with the service request;

[0100] A target instance determination unit is used to determine a to-be-determined service instance carrying an environment identifier of a service environment within at least one service instance, and to determine a to-be-determined service instance that matches the service request as a target service instance according to a preset load rule; wherein the preset load rule includes a Ribbon load balancing algorithm.

[0101] In one embodiment, the resource matching device further includes:

[0102] The identification adding module is used to add the environment identification corresponding to the service environment to the request header of the service request.

[0103] In one embodiment, the service request processing module 44 includes:

[0104] A service resource query unit, configured to search for service resources associated with a target service instance based on an environment identifier corresponding to the service environment; wherein the service resources include: a message queue and a database;

[0105] Du Wei request processing unit is used to process the service request sent by the client based on the target service instance and service resources.

[0106] The resource matching device provided in the embodiment of the present invention can execute the resource matching method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0107] Example 5

[0108] Figure 5 1 is a schematic diagram of the structure of an electronic device 10 that implements the resource matching method of an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0109] like Figure 5As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., which is communicatively connected to the at least one processor 11. The memory stores a computer program that can be executed by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. Various programs and data required for the operation of the electronic device 10 can also be stored in the RAM 13. The processor 11, ROM 12, and RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0110] Multiple components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0111] The processor 11 may be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the resource matching method.

[0112] In some embodiments, the resource matching method may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the resource matching method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the resource matching method in any other suitable manner (e.g., via firmware).

[0113] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0114] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0115] In the context of the present invention, computer-readable storage media can be tangible media that can contain or store a computer program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Computer-readable storage media can include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, computer-readable storage media can be machine-readable signal media. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0116] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0117] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0118] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.

[0119] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.

[0120] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.

Claims

1. A resource matching method, characterized in that: include: Get the service request and identification information sent by the client; Determining the service environment corresponding to the client according to the identification information includes: searching for a dynamic identifier stored in association with the identification information, and determining the service environment corresponding to the environment identifier in the dynamic identifier as the service environment corresponding to the client; Determine a target service instance of the service environment according to the service request and preset load rules; Responding to the service request sent by the client based on the target service instance; The identification information is information for identifying the client, and determining the service environment corresponding to the client according to the identification information is specifically matching the service environment according to the identification information, and using the successfully matched service environment as the service environment corresponding to the client; Before obtaining the service request and identification information sent by the client, the method further includes: Extracting the access identifier of each service instance and the environment identifier of the service environment to which each service instance belongs, and associating the access identifier of each service instance with the environment identifier and uploading them to a service registration center; wherein the access identifier includes an access address and an access port; Extracting identification information of each initial client, and determining the environment identifier corresponding to each identification information based on a preset environment configuration rule; Associating the environment identifier corresponding to each piece of identification information with the identification information and storing it as a dynamic identifier; The dynamic identifier is used to store the environment identifier and identification information, and the corresponding dynamic identifier is extracted according to the environment identifier to determine the associated stored identification information; or the corresponding dynamic identifier is extracted according to the identification information to determine the associated stored environment identifier.

2. The method according to claim 1, characterized in that Also includes: When the dynamic identifier that matches the identifier information does not exist, a default service environment is extracted as the service environment corresponding to the client.

3. The method according to claim 1, characterized in that The determining the target service instance of the service environment according to the service request and a preset load rule includes: extracting at least one service instance associated with the service request; Determine a to-be-determined service instance carrying the environment identifier of the service environment within the at least one service instance, and determine the to-be-determined service instance that matches the service request as a target service instance according to the preset load rule; wherein the preset load rule includes a Ribbon load balancing algorithm.

4. The method according to claim 1, wherein After determining the service environment corresponding to the client according to the identification information, the method further includes: An environment identifier corresponding to the service environment is added to the request header of the service request.

5. The method according to claim 1, wherein The responding to the service request sent by the client based on the target service instance includes: Searching for service resources associated with the target service instance based on the environment identifier corresponding to the service environment; wherein the service resources include: a message queue and a database; The service request sent by the client is processed based on the target service instance and the service resource.

6. A resource matching device, characterized in that: include: Identification information extraction module, used to obtain the service request and identification information sent by the client; A service environment determination module, configured to determine a service environment corresponding to the client according to the identification information; A service instance determination module, configured to determine a target service instance of the service environment according to the service request and preset load rules; A service request processing module, configured to respond to the service request sent by the client based on the target service instance; The identification information is information for identifying the client, and the service environment determination module is specifically used to match the service environment according to the identification information, and use the successfully matched service environment as the service environment corresponding to the client; Wherein, the resource matching device further includes: The information upload module is used to extract the access identifier of each service instance and the environment identifier of the service environment to which each service instance belongs, and associate the access identifier and environment identifier of each service instance and upload them to the service registration center; wherein the access identifier includes the access address and access port; An environment identification configuration module is used to extract identification information of each initial client and determine the environment identification corresponding to each identification information based on preset environment configuration rules; A dynamic identification generation module is used to associate the environment identification corresponding to each identification information with the identification information and store it as a dynamic identification; The dynamic identifier is used to store the environment identifier and identification information, and the corresponding dynamic identifier is extracted according to the environment identifier to determine the associated stored identification information; or the corresponding dynamic identifier is extracted according to the identification information to determine the associated stored environment identifier; Wherein, the service environment determination module includes: A dynamic identification search unit, configured to search for a dynamic identification stored in association with the identification information; The service environment determining unit is configured to determine the service environment corresponding to the environment identifier in the dynamic identifier as the service environment corresponding to the client.

7. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor. The computer program is executed by the at least one processor to enable the at least one processor to perform the resource matching method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the resource matching method according to any one of claims 1 to 5 when executed.

Citation Information

Patent Citations

  • Service instance determination method and device, storage medium and electronic equipment

    CN110837424A

  • Cloud service management system and method for application service, electronic equipment and storage medium

    CN116112403A

  • Message request processing method and device, electronic equipment and storage medium

    CN116805946A