Micro-service access method, electronic terminal and computer readable storage medium

By establishing a mapping table between service identification information and deployment address in the microservice deployment system, and combining it with load balancing and access control modules, the complexity of accessing large-scale service models is solved, enabling fast access and smooth updates, and improving access efficiency.

CN121940443APending Publication Date: 2026-04-28ZHEJIANG DAHUA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ZHEJIANG DAHUA TECH CO LTD
Filing Date
2025-12-11
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

In existing technologies, the access process for large model services is complex, resulting in low access efficiency.

Method used

A method for accessing microservices is provided. By storing a mapping table between storage identification information and deployment address in the microservice deployment system, access request information is received, the target service identification information is identified, and the target deployment address is found according to the mapping table to access the target microservice. The access path is optimized by combining load balancing and access control modules.

Benefits of technology

It enables fast access to microservices, improves access efficiency, and ensures smooth updates and reasonable resource allocation during large model version iterations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121940443A_ABST
    Figure CN121940443A_ABST
Patent Text Reader

Abstract

The invention provides a micro-service access method, an electronic terminal and a computer readable storage medium, and the micro-service access method is applied to a micro-service deployment system. A mapping relation table of service identification information corresponding to each micro-service and a deployment address is stored in the micro-service deployment system; comprising the steps that access request information of a client is received, and the access request information comprises service identification information; identifying the access request information to obtain target service identification information corresponding to the access request information; searching a target deployment address corresponding to the target service identification information in a mapping relation table; and accessing a target micro-service corresponding to the access request information according to the target deployment address. According to the application, the target deployment address corresponding to the target service identification information is determined through the mapping relation table between the service identification information corresponding to each micro-service stored in the micro-service deployment system and the deployment address, so that rapid access of the target micro-service corresponding to the access request information is realized, and the access efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method for accessing microservices, an electronic terminal, and a computer-readable storage medium. Background Technology

[0002] In recent years, the widespread application of large-scale deep learning models (such as DeepSeek and GPT) across various industries has driven a rapid increase in the demand for locally deployed large-scale model services. However, various large-scale model versions are frequently updated, and the resources (such as GPU computing power) and environments (such as operating systems and CUDA versions) that different large-scale model services rely on may vary. When a large-scale model version is iterated, it is necessary to frequently change the external access method, which affects access efficiency. Summary of the Invention

[0003] The main technical problem addressed by this application is to provide a method for accessing microservices, an electronic terminal, and a computer-readable storage medium, thereby resolving the complexity of accessing large-scale services in the prior art.

[0004] To address the aforementioned technical problems, the first technical solution adopted in this application is: providing a microservice access method applied to a microservice deployment system; the microservice deployment system includes at least one microservice; the microservice deployment system stores a mapping table between service identifier information and deployment addresses corresponding to each microservice; there is a one-to-one correspondence between microservices and service identifier information; the microservice access method includes: Receive access request information from the client. The access request information is used to access the target microservice in at least one microservice. The access request information includes service identification information. The access request information is identified to obtain the target service identifier information corresponding to the access request information; Find the target deployment address corresponding to the target service identifier information in the mapping table; Based on the target deployment address, access the target microservice corresponding to the access request information.

[0005] The microservice deployment system also includes an access control module and a network interface; the access control module corresponds one-to-one with the network interface, and the access control module is set on the access path between the corresponding network interface and at least one microservice; the access request information also includes the network address. The access request information is identified to obtain the target service identifier information corresponding to the access request information, including: Based on the network address in the access request information, determine the network interface that receives the access request information; The access control module corresponding to the network interface identifies the service identifier information in the access request information to obtain the target service identifier information corresponding to the access request information.

[0006] The microservice deployment system includes at least one Kubernetes cluster, which comprises multiple servers, with each microservice containerized and deployed on the server; each Kubernetes cluster has at least one network interface.

[0007] Microservices have unique service identifiers and deployment records; they are deployed on servers using the StatefulSet resource type in the Kubernetes cluster.

[0008] The microservice deployment system also includes a load balancing module, which is connected to the access control module and the network interface; the load balancer is set on the access path between the network interface and multiple microservices. Microservice access methods include: If the target service identification information corresponds to at least two target deployment locations, the load balancing module will perform load balancing on the microservices corresponding to each of the at least two target deployment locations.

[0009] The access methods for microservices also include: The target microservice sends the access result corresponding to the access request information to the client.

[0010] The access methods for microservices also include: The first microservice deployed in the microservice deployment system is updated to obtain the second microservice; the first and second microservices correspond to the same service identifier information; the deployment address of the first microservice is different from that of the second microservice; the second microservice and the first microservice have the same access URL; the access URL is constructed using the network address and service identifier information corresponding to the first microservice. Update the deployment address corresponding to the service identifier information in the mapping table to the deployment address of the second microservice.

[0011] The method for constructing the mapping table between service identifier information and deployment address for microservices includes: Obtain the deployment instructions from the deployer; the deployment instructions include the required quota and deployment address corresponding to the microservice to be deployed; each deployer has a corresponding remaining quota of deployment resources; each microservice to be deployed is configured with unique service identifier information; Compare the demand quota of the microservice to be deployed with the remaining deployment resource quota of the corresponding client. If the demand quota of the microservice to be deployed does not exceed the remaining quota of deployment resources, the microservice to be deployed will be deployed in the microservice deployment system according to the deployment address. Associate and save the service identifier information corresponding to the microservice deployed in the microservice deployment system with the deployment address.

[0012] To solve the above-mentioned technical problems, the second technical solution adopted in this application is: to provide an electronic terminal, which includes a memory and a processor coupled to each other, the processor being used to execute program instructions stored in the memory, and the processor being used to execute program data to implement the steps in the above-mentioned microservice access method.

[0013] To solve the aforementioned technical problems, the third technical solution adopted in this application is: providing a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, implementing the steps in the microservice access method described above. The beneficial effects of this application are as follows: Unlike existing technologies, this application provides a microservice access method, electronic terminal, and computer-readable storage medium. The microservice access method is applied to a microservice deployment system. The microservice deployment system includes at least one microservice. The system stores a mapping table between service identifier information and deployment addresses for each microservice. Each microservice corresponds one-to-one with its service identifier information. The method includes: receiving access request information from a client, whereby the access request information is used to access a target microservice within the at least one microservice, and the access request information includes service identifier information; identifying the access request information to obtain the target service identifier information corresponding to the access request information; searching the mapping table for the target deployment address corresponding to the target service identifier information; and accessing the target microservice corresponding to the access request information based on the target deployment address. This application determines the target deployment address corresponding to the target service identifier information by using the mapping table between service identifier information and deployment addresses stored in the microservice deployment system, thereby achieving fast access to the target microservice corresponding to the access request information and improving access efficiency. Attached Figure Description

[0014] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0015] Figure 1 This is a schematic diagram of the structure of a specific embodiment of the microservice deployment system provided in this application; Figure 2 This is a flowchart illustrating an embodiment of the microservice access method provided in this application; Figure 3This is a schematic diagram of a specific embodiment of the microservice access method provided in this application; Figure 4 This is a schematic diagram of the framework of an embodiment of the electronic terminal provided in this application; Figure 5 This is a schematic diagram of a framework of an embodiment of the computer-readable storage medium provided in this application. Detailed Implementation

[0016] The embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0017] In the following description, specific details such as particular system architectures, interfaces, and technologies are presented for illustrative purposes rather than for limiting purposes, in order to provide a thorough understanding of this application.

[0018] In this article, the term "and / or" simply describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Additionally, the character " / " generally indicates that the preceding and following related objects have an "or" relationship. Furthermore, "more" in this article means two or more objects.

[0019] To enable those skilled in the art to better understand the technical solution of this application, the following describes in further detail a microservice access method provided by this application in conjunction with the accompanying drawings and specific embodiments.

[0020] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0021] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.

[0022] Kubernetes (K8s) is an open-source container orchestration platform for automating the deployment, scaling, and management of containerized applications. A K8s cluster typically consists of a group of nodes (servers), divided into a control plane and worker nodes. Each worker node contains multiple Pods, which are the smallest unit of management and scheduling in K8s. A Pod can contain one or more tightly coupled containers. Containers are used to encapsulate large-scale services.

[0023] This application provides a microservice deployment system built on a Kubernetes (K8s) cluster. The K8s cluster consists of multiple servers used to run containerized microservices. The microservice deployment system includes at least one microservice. It stores a mapping table between service identifier information and deployment addresses for each microservice; there is a one-to-one correspondence between microservices and service identifier information. The GPU resource types of the servers in the K8s cluster are different. The microservice attribute information includes key parameters such as hardware requirements (e.g., GPU model) and runtime environment configuration (e.g., CUDA version) to facilitate the selection of appropriate servers for deployment based on the microservice's attribute information.

[0024] In this embodiment, microservices are deployed based on Kubernetes, which effectively improves resource scheduling efficiency. Furthermore, all microservices are deployed using Docker containerization technology, achieving complete isolation of the runtime environment and facilitating environment creation and destruction.

[0025] In one embodiment, the microservice deployment system further includes an access control module and network interfaces. Each access control module corresponds one-to-one with a network interface, and the access control module is configured on the access path between the corresponding network interface and at least one microservice; the access request information also includes the network address.

[0026] Please see Figure 1 , Figure 1 This is a schematic diagram of a specific embodiment of the microservice deployment system provided in this application.

[0027] In one embodiment, the microservice deployment system includes at least one Kubernetes cluster, which comprises multiple servers, and each microservice is containerized and deployed on a server; each Kubernetes cluster has at least one network interface. The network interface can be nginx.

[0028] When a microservice deployment system needs to connect to multiple Kubernetes clusters simultaneously, or when the service access traffic on a single Kubernetes cluster is very high, multiple Nginx instances can be deployed for each Kubernetes system to achieve request traffic distribution, improve system throughput, reduce single point pressure, and significantly improve service response efficiency.

[0029] In one embodiment, the microservice has unique service identification information and deployment records; the microservice is deployed on the server using the StatefulSet resource type in the Kubernetes cluster. Specifically, during the microservice deployment process, after an abnormal pod restart, the file names of the service identification information and deployment records corresponding to the microservice remain unchanged. This feature can be used to manage the deployment records of the microservice, ensuring the continuity of the runtime logs for the same deployment record, and also achieving log isolation between different deployment records of the same microservice, preventing mutual interference.

[0030] In one embodiment, the microservice deployment system further includes a load balancing module, which is connected to the access control module and the network interface; the load balancer is set on the access path between the network interface and multiple microservices.

[0031] In one specific embodiment, the mapping table can be stored in the Hash structure of a Redis database within the microservice deployment system, with the key being the service deployment task ID and the value being the deployment address.

[0032] Please see Figure 2 , Figure 2 This is a flowchart illustrating an embodiment of the microservice access method provided in this application.

[0033] This embodiment provides a method for accessing microservices, applicable to the microservice deployment system described in the above embodiments. The method for accessing microservices includes the following steps.

[0034] S1: Receive access request information from the client. The access request information is used to access the target microservice in at least one microservice. The access request information includes service identification information.

[0035] S2: Identify the access request information to obtain the target service identifier information corresponding to the access request information.

[0036] S3: Find the target deployment address corresponding to the target service identifier information in the mapping table.

[0037] S4: Based on the target deployment address, access the target microservice corresponding to the access request information.

[0038] In one embodiment, receiving the client's access request information in step S1 includes the following specific implementation.

[0039] Specifically, the client sends an access request to the microservice deployment system. This access request is constructed based on a network address and the target service identifier. The network address includes the service IP address and the network port. The microservice deployment system receives the client's access request through the same network port as the one in the access request. For example, the access request could be https: / / 127.0.0.1:8000 / service / {service task id}. Here, "https: / / 127.0.0.1:8000 / service" represents the network address, and "{service task id}" represents the target service identifier.

[0040] In one specific embodiment, the access request information also includes service port information; the service port information is concatenated in a preset position between the network address and the target service identifier information. For example, the access request information can be https: / / 127.0.0.1:8000 / service / {service task id} / api. Here, "api" represents the service port information. The service port information of the microservice is used to implement interaction with the microservice.

[0041] In one embodiment, the step S2 of identifying the access request information and obtaining the target service identifier information corresponding to the access request information specifically includes the following implementation methods.

[0042] Specifically, based on the network address in the access request information, the network interface receiving the access request information is determined. The access control module corresponding to the network interface then identifies the service identifier information in the access request information to obtain the target service identifier information corresponding to the access request information.

[0043] In one specific embodiment, the access control module uses a Lua program to identify the service identifier information in the access request information to obtain the target service identifier information corresponding to the access request information. That is, it identifies "{service taskid}" and then obtains the target service identifier information corresponding to the access request information.

[0044] Since the network interface nginx does not support direct access to mapping tables, it needs to be combined with Lua programs to enhance its parsing capabilities.

[0045] In one embodiment, the microservice access method further includes the following specific implementation.

[0046] Specifically, in response to the target service identification information corresponding to at least two target deployment locations, the load balancing module performs load balancing on the microservices corresponding to each of the at least two target deployment locations.

[0047] In one embodiment, the method for constructing the mapping table between service identifier information and deployment address corresponding to microservices includes the following specific implementation.

[0048] Specifically, the deployment instructions from the deployer are obtained. These instructions include the demand quota and deployment address corresponding to the microservice to be deployed. Each deployer has a corresponding remaining deployment resource quota. Each microservice to be deployed is configured with unique service identifier information. The demand quota of the microservice to be deployed is compared with the remaining deployment resource quota corresponding to the client. If the demand quota of the microservice to be deployed does not exceed the remaining deployment resource quota, the microservice to be deployed is deployed to the microservice deployment system according to the deployment address. The service identifier information corresponding to the microservice deployed in the microservice deployment system is associated with the deployment address and saved.

[0049] In this embodiment, by managing resources in a unified manner and allocating quotas to users, the problem of mutual contention under resource shortage is solved, and resources are tilted towards users who need them more.

[0050] In one specific embodiment, the mapping table can be stored in the Hash structure of a Redis database within the microservice deployment system, with the key being the service deployment task ID and the value being the deployment address.

[0051] In one embodiment, the microservice access method further includes the following steps.

[0052] Specifically, the first microservice deployed in the microservice deployment system is updated to obtain the second microservice; the first and second microservices correspond to the same service identifier information; the deployment addresses of the first and second microservices are different; the second and first microservices have the same access URL; the access URL is constructed using the network address corresponding to the first microservice and the service identifier information. The deployment address corresponding to the service identifier information in the mapping table is updated to the deployment address of the second microservice.

[0053] In this embodiment, when a microservice needs to be redeployed due to parameter adjustments, the continuity of the microservice application must be ensured, guaranteeing that the access URL remains unchanged before and after the update, achieving a smooth update that is imperceptible to upper-layer users. These challenges place high demands on the resource scheduling system and service management mechanism, requiring reasonable resource allocation, environment isolation, and dynamic routing strategies to ensure high service availability.

[0054] In one embodiment, the microservice access method further includes: the target microservice sending the access result corresponding to the access request information to the client. Specifically, the target microservice feeds back the access result corresponding to the access request information to the load balancing module, so that the load balancing module sends the access result corresponding to the access request information to the client through the network interface in the access request information.

[0055] Please see Figure 3 , Figure 3 This is a schematic diagram of a specific embodiment of the microservice access method provided in this application.

[0056] In one specific embodiment, the client sends an access request (URL) to the microservice deployment system. The network port (nginx) of the microservice deployment system receives the access request. The access control module uses a Lua program to identify the service identifier information in the access request to obtain the target service identifier information corresponding to the access request. The target deployment address corresponding to the target service identifier information is then looked up in the mapping table of the Redis database. This prompts the access control module to send the access request to the load balancing module, which then forwards the access request to the container corresponding to the target deployment address, thereby enabling access to the target microservice within the container. The target microservice then feeds back the access result corresponding to the access request to the load balancing module, which then sends the access result to the client through the network interface in the access request.

[0057] The microservice access method provided in this embodiment determines the target deployment address corresponding to the target service identifier information by using the mapping relationship table between the service identifier information and the deployment address of each microservice stored in the microservice deployment system, thereby realizing fast access to the target microservice corresponding to the access request information and improving access efficiency.

[0058] Please see Figure 4 , Figure 4 This is a schematic diagram of the framework of an embodiment of the electronic terminal provided in this application.

[0059] The electronic terminal 80 includes a memory 81 and a processor 82 coupled to each other. The processor 82 is used to execute program instructions stored in the memory 81 to implement the steps of any of the above-described microservice access method embodiments. In a specific implementation scenario, the electronic terminal 80 may include, but is not limited to, a microcomputer or a server. In addition, the electronic terminal 80 may also include mobile devices such as laptops and tablets, which are not limited here.

[0060] Specifically, processor 82 controls itself and memory 81 to implement the steps of any of the microservice access method embodiments described above. Processor 82 can also be referred to as a CPU (Central Processing Unit). Processor 82 may be an integrated circuit chip with signal processing capabilities. Processor 82 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor can be a microprocessor or any conventional processor. Furthermore, processor 82 can be implemented using integrated circuit chips.

[0061] Please see Figure 5 , Figure 5 This is a schematic diagram of a framework of an embodiment of the computer-readable storage medium provided in this application. The computer-readable storage medium 90 stores program instructions 901 that can be executed by a processor. The program instructions 901 are used to implement the steps of any of the above-described microservice access method embodiments.

[0062] In some embodiments, the functions or modules of the apparatus provided in this disclosure can be used to perform the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.

[0063] The description of the various embodiments above tends to emphasize the differences between the various embodiments. The similarities or similarities between them can be referred to, and for the sake of brevity, they will not be repeated here.

[0064] In the several embodiments provided in this application, it should be understood that the disclosed methods and apparatus can be implemented in other ways. For example, the apparatus implementations described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.

[0065] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0066] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0067] The above are merely embodiments of this application and do not limit the scope of patent protection of this application. Any equivalent structural or procedural changes made using the content of this application’s specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of this application.

Claims

1. A method for accessing microservices, characterized in that, This is applied to a microservice deployment system; the microservice deployment system includes at least one microservice; the microservice deployment system stores a mapping table between service identifier information and deployment address corresponding to each microservice; Each microservice corresponds one-to-one with the service identifier information; The methods for accessing the microservices include: Receive access request information from the client, the access request information being used to access a target microservice among the at least one microservice, the access request information including the service identification information; The access request information is identified to obtain the target service identifier information corresponding to the access request information; Find the target deployment address corresponding to the target service identifier information in the mapping table; Based on the target deployment address, access the target microservice corresponding to the access request information.

2. The microservice access method according to claim 1, characterized in that, The microservice deployment system also includes an access control module and a network interface; the access control module corresponds one-to-one with the network interface, and the access control module is set on the access path between the corresponding network interface and at least one of the microservices; the access request information also includes a network address. The step of identifying the access request information to obtain the target service identifier information corresponding to the access request information includes: Based on the network address in the access request information, determine the network interface that receives the access request information; The access control module corresponding to the network interface identifies the service identifier information in the access request information to obtain the target service identifier information corresponding to the access request information.

3. The microservice access method according to claim 2, characterized in that, The microservice deployment system includes at least one Kubernetes cluster, which includes multiple servers, and each microservice is containerized and deployed on the server; each Kubernetes cluster has at least one network interface.

4. The microservice access method according to claim 3, characterized in that, The microservice has a unique service identifier and deployment record; the microservice is deployed on the server using the StatefulSet resource type in the Kubernetes cluster.

5. The microservice access method according to claim 2, characterized in that, The microservice deployment system also includes a load balancing module, which is connected to the access control module and the network interface. The load balancer is configured on the access path between the network interface and the multiple microservices; The access methods for the microservices include: In response to the target service identification information corresponding to at least two target deployment locations, the load balancing module performs load balancing on the microservices corresponding to each of the at least two target deployment locations.

6. The microservice access method according to claim 1, characterized in that, The microservice access methods also include: The target microservice sends the access result corresponding to the access request information to the client.

7. The microservice access method according to claim 1, characterized in that, The microservice access methods also include: The first microservice deployed in the microservice deployment system is updated to obtain a second microservice; the first microservice and the second microservice correspond to the same service identifier information; the deployment address of the first microservice is different from the deployment address of the second microservice; the second microservice and the first microservice have the same access URL; the access URL is constructed using the network address corresponding to the first microservice and the service identifier information. Update the deployment address corresponding to the service identifier information in the mapping table to the deployment address of the second microservice.

8. The microservice access method according to claim 1, characterized in that, The method for constructing the mapping table between the service identifier information and the deployment address corresponding to the microservice includes: Obtain the deployment instructions from the deployer; the deployment instructions include the required quota and deployment address corresponding to the microservice to be deployed; each deployer has a corresponding remaining quota of deployment resources; each microservice to be deployed is configured with a unique service identifier. Compare the demand quota of the microservice to be deployed with the remaining deployment resource quota corresponding to the client; If the demand quota of the microservice to be deployed does not exceed the remaining quota of the deployment resources, the microservice to be deployed is deployed in the microservice deployment system according to the deployment address. The service identifier information corresponding to the microservice deployed in the microservice deployment system is associated with the deployment address and saved.

9. An electronic terminal, characterized in that, The electronic terminal includes a memory and a processor coupled to each other. The processor is used to execute program instructions stored in the memory and to execute program data to implement the steps in the microservice access method as described in any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the microservice access method as described in any one of claims 1 to 8.