Service access method and device, equipment, storage medium and program product
By establishing a mapping relationship between the routing path of access requests and the service version number in the microservice architecture, the problem of requiring the full version of the service to be deployed in each storage area in the existing technology is solved, achieving more efficient access and resource utilization.
Patent Information
- Application Number
- CN202510083058.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-17
- Publication Date
- 2025-09-23
AI Technical Summary
In the existing technology, accessing a specific version of an application requires deploying a full version of the service in each storage area, which results in excessive usage of business resources and increased access costs.
By establishing a mapping relationship between the routing path of the access request and the service version number, the services in the routing path are called in sequence, the request results are obtained and returned, and the deployment of the full version of the service in each storage area is avoided.
It effectively reduces business access costs, saves resource usage, and improves access efficiency and response speed.
Smart Images

Figure CN120692307A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device, storage medium, and program product for accessing a service. Background Art
[0002] Microservices is a software development architectural style that builds and deploys applications as a set of small services. These services are organized around business functionality, each of which is independent and can be deployed and scaled independently.
[0003] In related technologies, access to a specific version of an application usually involves directly accessing services in different storage areas. This requires deploying a full version of the service in each storage area, occupying a large amount of business resources and resulting in high business access costs. Summary of the Invention
[0004] Embodiments of the present application provide a service access method, apparatus, electronic device, computer-readable storage medium, and computer program product, which can effectively reduce the cost of service access.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] This embodiment of the present application provides a method for accessing a service, the method comprising:
[0007] In response to an access request for a service, establishing a mapping relationship between a routing path of the access request and a service version number indicated by the access request;
[0008] The routing path includes: multiple services required to be called in response to the access request and the order in which the multiple services are called;
[0009] Based on the mapping relationship, calling corresponding services in the routing path in the order, and obtaining a request result of the access request;
[0010] Based on the routing path, the request result is returned.
[0011] This embodiment of the present application provides a device for accessing a service, the device comprising:
[0012] a response module, configured to, in response to an access request for a service, establish a mapping relationship between a routing path of the access request and a service version number indicated by the access request; wherein the routing path includes: a plurality of services required to be called in response to the access request and the order in which the plurality of services are called;
[0013] A calling module, configured to call corresponding services in the routing path in the order described based on the mapping relationship to obtain a request result of the access request;
[0014] The return module is used to return the request result based on the routing path.
[0015] An embodiment of the present application provides an electronic device, including:
[0016] a memory for storing computer-executable instructions or computer programs;
[0017] The processor is used to implement the service access method provided in the embodiment of the present application when executing the computer executable instructions or computer program stored in the memory.
[0018] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions for causing a processor to execute instructions to implement a method for accessing a service provided by an embodiment of the present application.
[0019] An embodiment of the present application provides a computer program product, which includes a computer program or computer-executable instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the service access method described in the embodiment of the present application.
[0020] The embodiments of the present application have the following beneficial effects:
[0021] By receiving an application access request for an application, a mapping relationship is established between the routing path of the application access request and the service version indicated by the application access request. Based on the mapping relationship, the service of the corresponding service version in the routing path is called in sequence to obtain a request result for responding to the application access request; based on the routing path, the request result is returned. In this way, since the application includes multiple distributed deployed services, and the service includes at least one service version, by calling the service of the corresponding service version in the routing path in sequence based on the mapping relationship, a request result for responding to the application access request is obtained. Therefore, there is no need to deploy the full version of the service in each storage area. Based on the routing path, the request result is returned to respond to the application access request. Therefore, there is no need to deploy the full version of the service in each storage area, and application access can be achieved, thereby effectively saving business resources and reducing business access costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 This is a schematic diagram of the architecture of the application access system provided in the embodiment of the present application;
[0023] Figure 2 is a schematic diagram of the structure of an electronic device for accessing an application provided in an embodiment of the present application;
[0024] Figure 3 This is a flowchart of a method for accessing services provided by an embodiment of the present application;
[0025] Figure 4 This is a schematic diagram of the principle of the service access method provided in the embodiment of the present application. Figure 1 ;
[0026] Figure 5 This is a schematic diagram of the principle of the service access method provided in the embodiment of the present application. Figure 2 . DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solutions and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limiting this application. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0028] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0029] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0030] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.
[0031] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0032] 1) Application: This generally refers to a software program installed on a smartphone, tablet, or other electronic device designed to meet specific user needs. Applications can provide a variety of functions, such as communication, entertainment, education, office work, and shopping, enriching users' digital lives and improving work efficiency.
[0033] 2) Service: refers to the ability or characteristics of an application to achieve a specific purpose. For example: Communication function: sending and receiving messages, voice or video calls, etc. through the application. Entertainment function: providing entertainment content such as music playback, games, and video viewing. Education function: providing educational services such as online courses, learning materials, and knowledge tests. Office function: including business or office-related functions such as document editing, schedule management, and email processing. Shopping function: providing e-commerce services such as product browsing, online transactions, and payment processing. Navigation function: providing map viewing, route planning, location services, etc. Management function: including file management, system settings, application management, etc. Security function: providing security-related services such as password protection, data encryption, and privacy protection.
[0034] 3) Node Cluster: A node cluster is a collection of multiple services (computers or other computing devices) connected via a network and working together to provide distributed computing services. In cloud computing, big data processing, high-performance computing, and other fields, node clusters are often used to share loads and improve processing power and reliability. Each node performs a specific task, while the node cluster as a whole can handle large amounts of data and requests.
[0035] 4) Function Version: A function version is a different iteration or update of a specific feature in an application. As software is developed and maintained, developers may release new versions of a feature to fix bugs, add new features, or improve performance. Each function version is typically assigned a unique identifier for easier tracking and management.
[0036] 5) Link tracing: This method records and aggregates the processing of a request in a distributed system. The goal is to centrally display the call details of a distributed request, such as the time spent on each service, the specific machine the request reached, and the request status of each service. This makes it easy to understand the complete lifecycle of a request in the system, including the services it passed through, the operations invoked, and the latency of each operation.
[0037] During the implementation of the embodiments of this application, the applicant discovered that the related technology has the following problems:
[0038] In related technologies, access to a specific version of an application usually involves directly accessing a specific version of a functional service in a service cluster of different services. This requires deploying a full version of the functional service in each application cluster, occupying a large amount of business resources and resulting in high business access costs.
[0039] Embodiments of the present application provide a service access method, apparatus, electronic device, computer-readable storage medium, and computer program product, which can effectively reduce the access cost of a service. An exemplary application of the application access system provided by embodiments of the present application is described below.
[0040] See also Figure 1 , Figure 1 This is a schematic diagram of the architecture of the application access system 100 provided in an embodiment of the present application. The terminal (terminal 400 is shown as an example) is connected to the server 200 via the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two.
[0041] The terminal 400 is used for the user to use the client 410 and display the test script on the graphical interface 410-1 (graphic interface 410-1 is shown as an example). The terminal 400 and the server 200 are connected to each other via a wired or wireless network.
[0042] In some embodiments, the server 200 can be an independent physical server, or a server cluster or business system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and basic cloud computing services such as big data and artificial intelligence platforms. The terminal 400 can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart TV, a smart watch, a car terminal, etc., but is not limited to this. The electronic device provided in the embodiment of the present application can be implemented as a terminal or as a server. The terminal and the server can be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiment of the present application.
[0043] In some embodiments, the server 200 establishes a mapping relationship between the routing path of the access request and the service version number indicated by the access request in response to an access request for a service, and based on the mapping relationship, calls the corresponding services in the routing path in sequence to obtain the request result of the access request, and sends the request result to the terminal 400, which returns the request result based on the routing path.
[0044] In other embodiments, the terminal pole 400 establishes a mapping relationship between the routing path of the access request and the service version number indicated by the access request in response to the access request for the service, and based on the mapping relationship, calls the corresponding services in the routing path in sequence to obtain the request result of the access request, and sends the request result to the server 200. The server 200 returns the request result based on the routing path.
[0045] In other embodiments, the embodiments of the present application can be implemented with the help of cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and network within a wide area network or local area network to realize data calculation, storage, processing, and sharing.
[0046] Cloud technology is a general term for network, information, integration, management platform, and application technologies used in the cloud computing business model. It can form a resource pool that can be used flexibly and conveniently on demand. Cloud computing technology will become a key support. The backend services of technical network systems require a large amount of computing and storage resources.
[0047] See also Figure 2 , Figure 2 is a structural diagram of an electronic device 500 for accessing an application provided in an embodiment of the present application, wherein: Figure 2 The electronic device 500 shown may be Figure 1 The server 200 or the terminal 400 in Figure 2 The electronic device 500 shown includes: at least one processor 430, a memory 450, and at least one network interface 420. The various components in the electronic device 500 are coupled together via a bus system 440. It is understood that the bus system 440 is used to achieve connection and communication between these components. In addition to including a data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 440 is not described in detail. Figure 2 Various buses are labeled as bus system 440 .
[0048] The processor 430 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0049] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 430.
[0050] The memory 450 includes volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.
[0051] In some embodiments, the memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplified below.
[0052] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, and driver layer, which are used to implement various basic services and process hardware-based tasks;
[0053] The network communication module 452 is used to reach other electronic devices via one or more (wired or wireless) network interfaces 420. Exemplary network interfaces 420 include: Bluetooth, Wireless Fidelity (WiFi), and Universal Serial Bus (USB).
[0054] In some embodiments, the access device for the service provided by the embodiments of the present application can be implemented in software. Figure 2 The device 455 for accessing services stored in the memory 450 is shown. This device 455 may be software in the form of a program or plug-in, and includes the following software modules: a response module 4551, a call module 4552, and a return module 4553. These modules are logical and can be arbitrarily combined or further separated according to the functions they implement. The functions of each module will be described below.
[0055] In other embodiments, the access device for the service provided by the embodiments of the present application can be implemented in hardware. As an example, the access device for the service provided by the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the access method for the service provided by the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs), or other electronic components.
[0056] In some embodiments, the terminal or server can implement the access method of the service provided by the embodiment of the present application by running a computer program or computer executable instructions. For example, the computer program can be a native program (for example, a dedicated script generation program) or a software module in the operating system, for example, a script generation module that can be embedded in any program (such as an instant messaging client, a photo album program, an electronic map client, a navigation client); for example, it can be a local (Native) application (APP, Application), that is, a program that needs to be installed in the operating system to run. In short, the above-mentioned computer program can be any form of application, module or plug-in.
[0057] The method for accessing the services provided in the embodiments of the present application will be described in conjunction with exemplary applications and implementations of the server or terminal provided in the embodiments of the present application.
[0058] For example, see Figure 4 , Figure 4 This is a schematic diagram of the principle of the service access method provided in the embodiment of the present application. Figure 1 The application includes service 1, service 2, and service 3. Service 1 is implemented by a service cluster including function service 1-v1, service 2 is implemented by a service cluster including function service 2-v1, function service 2-v2, and function service 2-v3, and service 3 is implemented by a service cluster including function service 3-v1 and function service 3-v2. Function services correspond one-to-one with the function versions of the corresponding services: function service 1-v1 corresponds to function version v1, function service 2-v1 corresponds to function version v1, function service 2-v2 corresponds to function version v2, and function service 2-v3 corresponds to function version v3.
[0059] See also Figure 3 , Figure 3 This is a flow chart of the method for accessing the service provided by the embodiment of the present application, which will be combined with Figure 3 Steps 101 to 103 are shown for illustration. The method for accessing the service provided in the embodiment of the present application can be implemented by the server or the terminal alone, or by the server and the terminal in collaboration. The following will be described using the example of implementation by the server alone.
[0060] In step 101, in response to an access request for a service, a mapping relationship between a routing path of the access request and a service version number indicated by the access request is established.
[0061] In some embodiments, the aforementioned services typically refer to software programs installed on smartphones, tablets, or other electronic devices designed to meet specific user needs. These services can provide a variety of functions, such as communication, entertainment, education, office work, and shopping, enriching users' digital lives and improving work efficiency.
[0062] In some embodiments, the above-mentioned services refer to the capabilities or characteristics of the service program to achieve specific purposes. For example: Communication function: sending and receiving messages, voice or video calls, etc. through the service. Entertainment function: providing entertainment content such as music playback, games, and video viewing. Education function: providing educational services such as online courses, learning materials, and knowledge tests. Office function: including business or office-related functions such as document editing, schedule management, and email processing. Shopping function: providing e-commerce services such as product browsing, online transactions, and payment processing. Navigation function: providing map viewing, route planning, location services, etc. Management function: including file management, system settings, service management, and other functions. Security function: providing security-related services such as password protection, data encryption, and privacy protection.
[0063] In some embodiments, the service includes M services, different services are implemented through different service clusters, and the service cluster includes at least one functional service, and the functional service has a one-to-one correspondence with a functional version of the corresponding service.
[0064] As an example, consider a microservices architecture application scenario: a large e-commerce platform. Services include order processing, product search, user account management, and payment processing. Service clusters: The order processing cluster runs the order processing service, feature version v1. The search service cluster runs the product search service, feature versions v2 and v1. The user account cluster runs the account management service, feature versions v1, v2, and v3. The payment processing cluster runs the payment service, version v1.
[0065] For example, in a gaming platform application scenario, such as a multiplayer online game, the services include game logic processing, user matching, chat services, and leaderboards. Service clusters: The game logic cluster runs the game logic service, feature version v1. The matching service cluster runs the user matching service, feature versions v2 and v1. The chat service cluster runs the chat service, feature versions v2 and v1. The leaderboard cluster runs the leaderboard service, feature versions v2, v1, and v3.
[0066] In some embodiments, the routing path includes: multiple services required to be called in response to the access request and the order in which the multiple services are called.
[0067] In some embodiments, the routing path refers to the sequence of intermediate service nodes and the order in which they are called from the time the client initiates a request to the final service that is called to respond to the access request. The multiple services that need to be called to respond to the access request may be different servers, microservices, or cloud services distributed in the network. The order in which these services are called determines the processing flow and logic of the request. The routing path ensures that the request can be correctly forwarded to each service in accordance with the predetermined order and rules, and is ultimately processed and a response is returned to the client. In a microservice architecture, the design of the routing path is crucial to achieving effective collaboration and data flow management between services.
[0068] As an example, in an application scenario of an online shopping platform, when a user clicks the "Buy" button on the website, a series of service calls are triggered to complete the purchase process. The routing path is as follows: Gateway (API Gateway): First, the request is sent to the API Gateway. As the only entry point of the system, the gateway is responsible for routing requests to the appropriate service. Authentication Service: The gateway first calls the authentication service to verify the user's login status and permissions. If the user verification is successful, proceed to the next step. Inventory Service: After authentication is passed, the request is forwarded to the inventory service to check whether there is sufficient stock of the required product. If the stock is sufficient, proceed to the next step; if the stock is insufficient, an insufficient stock response is returned.
[0069] For example, see Figure 4 , Figure 4 The routing path in may include: multiple services required to be called in response to the access request and the order in which the multiple services are called, that is, the routing path is: gateway component-service 1-service 2-service 3.
[0070] In some embodiments, before step 101 above, the following processing may also be performed: receiving an access request for the service through a gateway component of the service.
[0071] In some embodiments, a service may refer to a specific service, which may be an independent service in a microservice architecture, such as an order service, a payment service, or a user service. The gateway component is a component in the system that is responsible for managing and communicating between services, and usually acts as an entry point. In a microservice architecture, the gateway component is responsible for receiving requests from clients and then routing these requests to the corresponding service instances. Access requests to a service are first sent to the gateway component of the service. This gateway component acts as the front door of the service and is responsible for receiving these access requests. When the request reaches the gateway component, the gateway forwards the request to the corresponding service instance for processing based on the target of the request, the service discovery mechanism, and possible load balancing strategies.
[0072] For example, see Figure 4 , receiving service access requests through the service's gateway component.
[0073] In some embodiments, when an access request for a specific service is received, the system needs to respond to determine which specific service instance the request should be routed to. In this process, the system will establish a mapping relationship that associates the following two key elements: The routing path of the access request refers to the path of the request from the client, through possible intermediate proxies or gateways, and finally to the target service instance. This path defines the complete route that the request passes through the system, including each jump point and destination. The service version number indicated by the access request: The client's request may specify that it wants to use a specific version of the service. The service version number is used to distinguish between different instances of the same service that may exist, which may differ due to functional updates, performance optimizations, or bug fixes.
[0074] In some embodiments, the specific process of establishing the mapping relationship can be as follows: first, identify the access request and extract the service version number information carried in the request. Then, based on the service version number, determine which specific service instance the request should be routed to. This usually involves a service discovery mechanism, which can find the corresponding service instance based on the service name and version number. After the target service instance is determined, the routing path of the access request is associated with this service instance to establish a mapping relationship. The mapping relationship is particularly important for microservice architectures because it allows fine-grained control between multiple service versions, ensuring that requests can be correctly forwarded to the service version that meets client requirements, thereby implementing advanced deployment strategies such as grayscale releases and A / B testing.
[0075] In step 102, based on the mapping relationship, the corresponding services in the routing path are called in sequence to obtain the request result of the access request.
[0076] In some embodiments, the above request result includes a sub-request result, and the above step 102 can be implemented in the following manner: for any one of the services in the routing path, based on the mapping relationship, determine the service version number corresponding to the service; call the service corresponding to the service version number to obtain the sub-request result of the service.
[0077] In some embodiments, in a microservices architecture, a request may require the coordinated processing of multiple services to complete. During the processing of a request, multiple services may be called sequentially. A mapping relationship has been established that associates each service access request with its corresponding service version number. When a request reaches a service, the system determines the version number that should be used for the service based on the previously established mapping relationship. This version number corresponds to a specific instance of the service, which may be specified in the client request or automatically selected by the system based on a policy (such as load balancing or phased release). Once the service version number is determined, the system calls the corresponding service instance. This call may involve finding the address of the service instance through a service discovery mechanism and then initiating a network request. After calling the corresponding service instance, the service processes the request and returns a result. This result is called a subrequest result because it is often the result of an intermediate step in the entire request processing flow. This subrequest result may then be passed to the next service in the routing path or used to generate the final response returned to the client. This entire process ensures that the request calls the correct service version according to the predefined mapping relationship at each service, thereby ensuring collaboration between services and data consistency.
[0078] For example, see Figure 4 , for service 1 in the routing path, based on the mapping relationship, determine the service version number (for example, service version number v1) corresponding to the service 1; call the service 1 corresponding to the service version number (for example, service version number v1) to obtain the sub-request result of the service 1.
[0079] For example, see Figure 4 , for service 2 in the routing path, based on the mapping relationship, determine the service version number corresponding to the service 2 (for example, service version number v2); call the service 2 corresponding to the service version number (for example, service version number v2) to obtain the sub-request result of the service 2.
[0080] In some embodiments, the above-mentioned determination of the service version number corresponding to the service based on the mapping relationship can be achieved as follows: for the first service in the routing path, according to the identifier of the gateway component and the routing path, the first service version number corresponding to the first service is determined in the mapping relationship.
[0081] In some embodiments, the above-mentioned determination of the first service version number corresponding to the first service in the routing path in the mapping relationship based on the identifier of the gateway component and the routing path can be achieved as follows: for the first service in the routing path, the gateway component determines the service version number corresponding to the first service in the mapping relationship based on the identifier of the routing path.
[0082] In some embodiments, in a multi-service request processing flow, the request will pass through a series of services in a certain order. The gateway component serves as the entry point for the request, and it will know which services the request needs to pass through and the order of these services. In addition, the routing path may have a unique identifier to identify a specific request processing flow. The gateway component uses this information (i.e., its own information and the identifier of the routing path) to query the mapping relationship and find the version number associated with the first service. This version number may be determined based on the name of the service, the characteristics of the request, or a specific routing strategy. It can ensure that each service request is routed to the correct service version. This is crucial for implementing advanced features such as dynamic deployment, version control, and grayscale release of services.
[0083] In some embodiments, a gateway component receives an access request from a client. This request may include metadata such as the target service name, request type, and client information. The gateway component parses the request and extracts a routing path identifier. This identifier may be the request URL, a field in the request header, or part of the request parameters, depending on how the routing information is defined and passed. The gateway component uses the extracted routing path identifier to query a predefined mapping relationship. This mapping relationship may be stored in a database, configuration file, cache, or service registry. If the mapping relationship is stored in a database, the gateway performs a database query. If the mapping relationship is stored in a configuration file or cache, the gateway reads the information from these storage media. If the mapping relationship is managed by a service registry, the gateway initiates a query request to the registry. Based on the query results, the gateway component finds the first service corresponding to the routing path identifier and its associated service version number. This version number may be determined in the following ways: Static configuration: The version number is determined at deployment time and does not change at runtime. Dynamic allocation: The version number may be dynamically assigned based on the current system status, load, or configuration policy.
[0084] In some embodiments, the above-mentioned determination of the service version number corresponding to the service based on the mapping relationship can be achieved in the following manner: for the i-th service in the routing path, when i is an integer greater than 1, the i-th service version number corresponding to the i-th service is determined in the mapping relationship according to the edge gateway of the i-1-th service and the identifier of the routing path.
[0085] In some embodiments, in a request processing flow consisting of multiple services, each service is arranged in a specific order. The i-th service here refers to the i-th service to be called in the routing path sequence. In the case where i is an integer greater than 1, this condition indicates that the process applies to all services except the first service. The version number of the first service is usually determined when the request just enters the gateway. The edge gateway of the i-1th service refers to the gateway directly between the i-1th service and the i-th service. This gateway may be an API gateway for inter-service communication or a component responsible for service discovery and load balancing. The routing path identifier is an identifier that uniquely identifies the request processing flow, which may include the service name, request ID or other relevant information. The edge gateway of the i-1th service and the routing path identifier will be used to search in the mapping relationship to determine the version number that the i-th service should use. The mapping relationship is a record maintained by the system that associates the service identifier with the corresponding version number.
[0086] In some embodiments, after a request is processed by the i-1th service, it needs to be passed on to the i-th service. The edge gateway of the i-1th service identifies the next service to which the request should be passed and obtains the identifier of the routing path. The edge gateway uses this information to query the mapping relationship and find the version number associated with the i-th service. After determining the version number of the i-th service, the edge gateway routes the request to the i-th service instance with the corresponding version.
[0087] In some embodiments, the above-mentioned determination of the i-th service version number corresponding to the i-th service in the mapping relationship based on the identifier of the edge gateway of the i-1-th service and the routing path can be achieved in the following manner: for the i-th service in the routing path, when i is an integer greater than 1, the service version corresponding to the i-th service is determined in the mapping relationship based on the identifier of the routing path through the edge gateway of the i-1-th service.
[0088] In some embodiments, when a request arrives at the i-1th service, that service completes its task and prepares to pass the request to the i-th service. The i-1th service's edge gateway receives the request and examines the routing path identifier to determine which service to route the request to next. The edge gateway uses the routing path identifier to query the mapping relationship and find the service version number corresponding to the i-th service. After determining the service version number, the edge gateway forwards the request to the corresponding version of the i-th service.
[0089] In some embodiments, in a service chain, services are called in a certain order. The i-th service here refers to the i-th service in the calling order. When i is an integer greater than 1, it means that the service in question is not the first service (i.e., i is not 1). In other words, this process applies to the second service and subsequent services. The edge gateway of the i-1th service refers to the gateway component located between the i-1th service and the i-th service. This gateway component is responsible for managing the forwarding of requests from the i-1th service to the i-th service. The routing path identifier is an identifier that uniquely identifies the entire request processing flow. This identifier may include the service name, request ID, user session information, etc., which helps the system track the request flow. The edge gateway uses the routing path identifier to query the mapping relationship maintained in the system. This mapping relationship associates the name or identifier of the service with the service version number. The edge gateway looks up the record of the i-th service in the mapping relationship to determine which version of the service should be called.
[0090] For example, see Figure 4 , for the second service in the routing path ( Figure 4 Service 2) shown, through the first service ( Figure 4 The edge gateway of the service 1) shown in the figure determines the second service ( Figure 4 The service 2) shown corresponds to the service version.
[0091] For example, see Figure 4 , for the third service in the routing path ( Figure 4 Service 3) shown, through the second service ( Figure 4 The edge gateway of the service 2) shown in the figure determines the third service ( Figure 4 The service 3) shown corresponds to the service version.
[0092] In some embodiments, the above-mentioned determination of the service version number corresponding to the service based on the mapping relationship can be achieved in the following manner: based on the mapping relationship, determining the storage area corresponding to the service version number indicated by the access request; based on the service stored in the storage area, determining the service version number corresponding to the service.
[0093] In some embodiments, a mapping relationship is a key concept that associates a service identifier (such as the service name) with its version number and storage location. This mapping is typically stored in a configuration file, database, or specific service registry. When an access request arrives, the system uses the mapping relationship to locate the storage area corresponding to the service indicated in the request. This storage area may be a file server, database, cloud storage, or other type of storage system. After determining the storage area, the system examines the service information stored there, typically reading the service metadata to determine the specific service version number. This version number may be part of the file name or information recorded in the metadata file. The routing path of an access request refers to all services that need to be called from the time the request arrives at the system to the final response, and the order in which these services are called. This path defines the dependencies between services and the execution flow. The routing path includes not only the services that need to be called, but also the order in which they are called. This order is crucial to ensuring that services execute according to the correct business logic. The mapping relationship between the routing path of an access request and the indicated service version number ensures that each access request is routed to the correct service version. This means that even if multiple versions of the same service are available, the system can select the appropriate version based on the specific requirements of the request.
[0094] As an example, suppose we have an online book sales platform that provides multiple services, such as user management service, order management service, and inventory management service. Each service has multiple versions to facilitate feature iteration and bug fixes. The following is a simplified example to illustrate how to use mapping relationships to determine service version numbers and routing paths: the system maintains a mapping relationship table that maps service names to corresponding version numbers and storage areas. For example: User Management Service: Version 1.0->Storage Area / services / user_management / 1.0; Order Management Service: Version 2.0->Storage Area / services / order_management / 2.0; Inventory Management Service: Version 1.1->Storage Area / services / inventory_management / 1.1. Suppose a user initiates a request to create a new order. This request needs to call the User Management Service, Order Management Service, and Inventory Management Service. Based on the mapping table, the system determines the corresponding storage area for each service: the User Management service uses version 1.0, stored in / services / user_management / 1.0; the Order Management service uses version 2.0, stored in / services / order_management / 2.0; and the Inventory Management service uses version 1.1, stored in / services / inventory_management / 1.1. The service metadata in each storage area is checked to confirm the correct service version number. A routing path is defined, which includes the services to be called in order to respond to the access request: Call User Management service version 1.0 to authenticate the user. Call Order Management service version 2.0 to create a new order record. Call Inventory Management service version 1.1 to update inventory information. Following the routing path, each service version is called in sequence, passing the necessary data. Each service performs its function and returns the result to the system. The results returned by all services are collected and a final response is constructed and returned to the user. If all services are successfully executed, the user receives confirmation that the order has been successfully created. In this way, the system ensures that each access request uses the correct service version and that services are executed in the predetermined order, providing a consistent and reliable user experience.
[0095] This mapping mechanism ensures stricter and more automated service version control, reducing the risk of service errors and failures caused by version mismatches. The most appropriate service version can be dynamically selected based on different requests, improving service flexibility and adaptability. By clarifying the routing path of access requests and the order in which they are invoked, the efficiency and response speed of service calls can be optimized, thereby enhancing the user experience and overall system performance.
[0096] In some embodiments, the above-mentioned determination of the service version number corresponding to the service based on the services included in the storage area can be implemented as follows: if the storage area stores a service with the service version number indicated by the access request, the corresponding service version number is determined as the service version number; if the storage area does not store a service with the service version number indicated by the access request, and the service includes multiple service version numbers, the service version number is selected from multiple service version numbers; if the storage area does not store a service with the service version number indicated by the access request, and the service includes one service version number, the baseline version is determined as the service version number.
[0097] In some embodiments, the storage area is checked to see if a service with the specific service version number indicated by the access request is already stored. If the service with that version number is available in the storage area, that version number is directly determined as the requested service version number. If the service with the specific version number indicated by the access request is not available in the storage area, and there are multiple available versions of that service, the system must select one of those versions as the service version number. This selection may be based on version priority, compatibility, stability, performance, or other business rules. If the service with the specific version number indicated by the access request is not available in the storage area, and that service has only one version number, the system determines this unique version number (often called the baseline version) as the service version number. The baseline version may be the default version, the latest version, or a verified stable version. In a direct match of service versions, the requested service version is already available in the storage area and can be used directly without any additional decision or action. When the requested version is not available in the storage area, but multiple other versions are available, a strategy is required to determine which version should be used, such as selecting the latest version, the most compatible version, or a version optimized for a specific environment. The selection process ensures that the selected version meets the requirements of the access request. When a service has only one version number, it usually means that this version is the standard or default version. In this case, the baseline version is used by default because it represents a known and stable state of the service.
[0098] As an example, consider an online e-commerce platform that provides a product search service with different versions to meet different needs. The following three scenarios illustrate how the service version number is determined based on the service in the storage area: The requested service version number exists in the storage area, and the access request requests version 2.5 of the product search service. Version 2.5 of the product search service exists in the storage area. Product search service version 2.5 is determined as the requested service version number, and the access request is processed using this version. Scenario 2: The requested service version number does not exist in the storage area, but multiple other versions exist. The access request requests version 3.0 of the product search service. Version 3.0 of the product search service does not exist in the storage area, but versions 2.5, 2.7, and 4.0 are available. Based on a certain policy (such as selecting the latest version or a compatible version), one of these available versions is selected. Assume that the system selects version 4.0 as the service version number because it is the most recent. The access request is processed using the selected version 4.0. The requested service version number does not exist in the storage area, and the service only has one version number. The access request requests version 3.0 of the product search service. There is no version 3.0 of the product search service in the storage area, and the product search service has only one version number, namely version 2.0. Version 2.0 is determined as the baseline version number of the product search service, and this version is used to process the access request.
[0099] This not only improves the flexibility and efficiency of service calls, but also ensures that even when the requested specific version number is unavailable, a reasonable strategy can still be used to select the appropriate version number to respond to user requests, thereby enhancing system robustness and user experience. It also helps optimize resource utilization, avoids storing unnecessary service versions, and ensures the uniqueness and consistency of service versions. This simplifies version management and maintenance, reduces operation and maintenance costs, provides a standardized process for determining service version numbers, improves reliability and stability, and provides users with more stable and high-quality services.
[0100] In some embodiments, the above-mentioned selection of a service version number from multiple service version numbers can be achieved in the following manner: among the multiple service version numbers, the service version number with the greatest service performance is selected as the service version number; or, a version confirmation request is sent to the requester of the access request, and the version confirmation request includes the multiple service version numbers; and the service version number selected by the requester based on the multiple service version numbers is received.
[0101] In some embodiments, the service version with the highest performance is selected. Among multiple available service versions, the system automatically selects the version with the highest performance metrics as the service version. The system measures the performance of each version based on predefined performance evaluation criteria, such as response time, throughput, and resource consumption. The system then selects the version that performs best across these metrics. This ensures that users always receive the service version with the best performance, thereby improving the user experience.
[0102] In some embodiments, a version confirmation request is sent to the initiator of the access request, which contains all available service version numbers, and the request initiator selects a service version number based on these version numbers. The list of available service version numbers is sent to the requester, and the requester selects the most appropriate version number based on its own needs and preferences, and then returns the selection result to the system. Allowing the requester to select a service version based on its specific needs provides higher customization. The requester can make a choice after understanding all available options, which can reduce misunderstandings and communication costs. In some cases, the requester may have special dependencies or requirements on a specific version of the service. This strategy can ensure that the requester's needs are met.
[0103] In some embodiments, selecting the service version with the highest performance and sending a version confirmation request to the requester each have their own advantages and applicable scenarios. The first strategy is suitable for services with clear performance metrics and priorities, relying on the system's automated decision-making capabilities. The second strategy is more flexible and suitable for scenarios where version selection requires specific context or user needs.
[0104] As an example, the service version number with the highest performance is automatically selected. Suppose an online video platform provides a video streaming service. The service has multiple version numbers, and each version number corresponds to a different performance level. The following is an example of the automatic selection process: a user requests to play a high-definition video. After checking the storage area, it is found that the video streaming service has three available version numbers: 1.0, 2.0, and 3.0. The performance of each version is automatically evaluated based on performance indicators (such as loading speed and smoothness of video playback). It is found that version 3.0 is the best in all performance indicators. Therefore, version 3.0 is automatically selected as the service version number to provide the best user experience.
[0105] As an example, a version confirmation request is sent to the requester. Suppose an online document editing service where users can choose different editor versions, each of which provides different functions and performance. The following is an example of sending a version confirmation request: a user opens a document and requests to use the document editing service. Checking the storage area, it is found that there are two available version numbers of the document editing service: 2.1 and 2.2. It is not sure which version is more suitable for the user's needs, so a version confirmation request is sent to the user. The version confirmation request contains detailed information about version 2.1 and version 2.2, including descriptions of their functions and performance. After reading the version information, the user decides to choose version 2.2 because it provides richer formatting tools and better collaboration capabilities. The user sends the selection result (version 2.2) back to the system. The user's choice is received, and version 2.2 is used to provide document editing services.
[0106] Automatically selecting the version number with the highest service performance ensures optimal system performance, improving user experience and system efficiency. This reduces user wait time and service latency, increasing service reliability and responsiveness. Sending version confirmation requests to the requesting party increases service flexibility and user satisfaction by allowing users to select the most appropriate version based on their specific needs, providing a customized service experience. This user-involved decision-making process also helps reduce misunderstandings and conflicts, ensuring that services better meet user expectations.
[0107] In step 103, based on the routing path, the request result is returned.
[0108] In some embodiments, the above-mentioned request result includes the sub-request result, and the above-mentioned step 103 can be implemented as follows: returning the sub-request result corresponding to the M-th service to the M-1-th service in the routing path, where M is used to indicate the number of the services in the routing path, and M is greater than 1; for the i-th service in the routing path, when i is an integer greater than 1, the i-th service receives the sub-request result returned by the i+1-th service in the routing path, and sends the sub-request result returned by the i+1-th service and the sub-request result corresponding to the i-th service to the i-1-th service in the routing path; the first service in the routing path receives the sub-request result returned by the second service in the routing path; the sub-request result received by the first service and the sub-request result corresponding to the second service are used as the request result, and the request result is returned.
[0109] In some embodiments, when a request is broken down into multiple subrequests and these subrequests are sent to different services in the routing path, each service generates a subrequest result after processing its subrequest. After the Mth service completes processing its subrequest, it needs to return the result to the M-1th service in the routing path. For each service in the routing path except the first service (i.e., for all i where i>1), the ith service receives the subrequest result returned by the i+1th service after processing its subrequest. The ith service then sends the subrequest result returned by the i+1th service, along with its own subrequest result, to the i-1th service. The first service in the routing path is a special case because it does not have a previous service. Therefore, it only needs to receive the subrequest result returned by the second service. The first service combines the subrequest result received from the second service with the subrequest result it processed to construct the final request result. This final request result is then returned to the client that originally initiated the request or the previous request link.
[0110] As an example, let's assume we have an online booking system where a user submits a request to book a trip ticket and hotel. This request needs to be processed by multiple services along the following routing path: a travel date and destination confirmation service (Service 1); a travel ticket booking service (Service 2); and a hotel booking service (Service 3). The user initiates a request containing travel dates, destination information, and the user's preferred hotel type. Service 1 receives the request, confirms the travel dates and destination, and then sends a subrequest to the travel ticket booking service (Service 2) for ticket information. Service 2 receives the subrequest from Service 1, queries the ticket inventory, and returns the ticket booking results to Service 1. Service 1 receives the ticket booking results returned by Service 2 and sends them, along with its own results (the date and destination confirmation results), to the hotel booking service (Service 3). Service 3 receives the subrequest from Service 1 containing the travel ticket booking results and the date and destination confirmation results, then queries the hotel inventory and returns the hotel booking results to Service 1. Service 1 now receives the travel ticket booking results from Service 2 and the hotel booking results from Service 3, along with its own processed results. Service 1 combines all of these sub-request results to form the final request result. Service 1 returns the final request result to the user, which includes the ticket reservation confirmation, hotel reservation confirmation, and travel date and destination confirmation. M represents the number of services, M = 3. So the Mth service is the hotel reservation service (Service 3), which returns the result to the M-1th service, the ticket reservation service (Service 2). Service 2 then sends the result, along with its own sub-request results, to the M-2th service, the travel date and destination confirmation service (Service 1). Finally, Service 1 combines all of the sub-request results and returns them to the user as the final request result.
[0111] By aggregating and returning the subrequest results for each service, the integrity of the request and the completeness of the information are ensured, ensuring that the final result fully reflects the processing status of all aspects of the user request. This step-by-step transmission of subrequest results ensures efficient collaboration between services, allowing each service to perform subsequent operations based on the processing results of the previous service, thereby improving overall processing efficiency. This contributes to service maintainability and scalability, allowing new services to be easily integrated into the existing request processing process without affecting the normal operation of other services.
[0112] In some embodiments, the above-mentioned request result includes the sub-request result. The above-mentioned return of the request result based on the routing path can be achieved in the following manner: the first service in the routing path sends the sub-request result corresponding to the first service to the second service in the routing path; for the i-th service in the routing path, when i is an integer greater than 1, the i-th service receives the sub-request result returned by the i-1-th service in the routing path, and sends the sub-request result corresponding to the i-th service and the sub-request result returned by the i-1-th service to the i+1-th service in the routing path; the sub-request result received by the M-th service and the sub-request result corresponding to the M-th service are used as the request result, and the request result is returned, where M is used to indicate the number of services in the routing path, and M is greater than 1.
[0113] In some embodiments, the request result is composed of a series of sub-request results, and each service generates a sub-request result after processing its sub-request. The first service in the routing path starts this process, processing its own sub-request and sending the result to the second service. For each subsequent service in the routing path (i.e., for all i, where i>1), the i-th service receives the sub-request result returned by the i-1-th service. The i-th service then sends its own sub-request result and the sub-request result received from the i-1-th service to the i+1-th service. When the request reaches the last service in the routing path (the M-th service), the service receives the sub-request result from the M-1-th service and combines it with its own sub-request result to form the final request result. The final request result is constructed by the last service and is returned to the client that originally initiated the request or the previous request link.
[0114] As an example, consider an online shopping platform where a user wants to purchase an item and needs to complete the transaction through the following services: User Authentication Service (Service 1): Verifies the user's login information. Product Inventory Check Service (Service 2): Checks the inventory of the user's selected item. Payment Processing Service (Service 3): Processes the user's payment request. Order Confirmation Service (Service 4): Confirms the order and notifies the user. After the user submits a purchase request, the following implementation process returns the request results based on the routing path: User Authentication Service (Service 1) receives the user's purchase request and performs authentication. After successful authentication, Service 1 sends the verification result (sub-request result) to Product Inventory Check Service (Service 2). Product Inventory Check Service (Service 2) receives the user verification result from Service 1 and checks the product inventory. If the product inventory is sufficient, Service 2 sends the inventory check result (sub-request result) to Payment Processing Service (Service 3), along with Service 1's user verification result. Payment Processing Service (Service 3) receives the inventory check result and user verification result from Service 2 and processes the user's payment request. After payment is successful, Service 3 sends the payment processing result (sub-request result) along with Service 2's inventory check result and Service 1's user verification result to the Order Confirmation Service (Service 4). The Order Confirmation Service (Service 4) receives the payment processing result, inventory check result, and user verification result from Service 3. Service 4 combines these results to form the final request result, the order confirmation result, and returns it to the user. M represents the number of services, M = 4. Therefore, the last service is the Order Confirmation Service (Service 4), which combines all received sub-request results (payment processing result, inventory check result, and user verification result) to form the final request result and returns it to the user.
[0115] This ensures the integrity of request results, as the results of each subrequest processed by each service are aggregated and included in the final result, providing users or systems with comprehensive transaction or processing information. This improves robustness and fault tolerance, as each service can receive and process the results of the previous service accordingly. If a service fails, it is easier to locate and repair the problem. This cascading delivery mechanism also helps optimize resource utilization and improve processing efficiency, avoiding redundant data processing and reducing the complexity of communication between services.
[0116] In this way, by receiving an application access request for an application, a mapping relationship is established between the routing path of the application access request and the service version indicated by the application access request. Based on the mapping relationship, the service of the corresponding service version in the routing path is called in sequence to obtain a request result for responding to the application access request; based on the routing path, the request result is returned. In this way, since the application includes multiple distributed deployed services, and the service includes at least one service version, by calling the service of the corresponding service version in the routing path in sequence based on the mapping relationship, a request result for responding to the application access request is obtained. Therefore, there is no need to deploy the full version of the service in each storage area. Based on the routing path, the request result is returned to respond to the application access request. Therefore, there is no need to deploy the full version of the service in each storage area, and application access can be achieved, thereby effectively saving the occupation of business resources and effectively reducing the access cost of the business.
[0117] Below, an exemplary application of the embodiment of the present application in an actual link tracing application scenario will be described.
[0118] With the prevalence of microservices and containerization technologies, more and more companies are adopting agile development models. This means that a single application may have multiple iterations simultaneously, each responsible for developing different functionalities. To improve R&D efficiency, multiple versions of a single application are deployed in development or testing environments. This leads to the need to determine which version of an application's services should be routed to when accessing the application's services. Furthermore, in a microservices architecture, multiple applications form complex upstream and downstream dependencies. If each application has multiple versions, controlling traffic routing across different application versions becomes a challenge.
[0119] The service access method provided by the embodiments of this application enables non-invasive control of microservice traffic without code changes. Traffic can be routed to a specific version of the service provider as needed, allowing for targeted application deployment. This means only the applications involved in an iteration need to be deployed, eliminating the need to deploy all upstream and downstream dependent applications for a single iteration, significantly saving computing resources.
[0120] In some embodiments, see Figure 5 , Figure 5 This is a schematic diagram of the principle of the service access method provided in the embodiment of the present application. Figure 2, the user initiates a request through the front-end or command line, and specifies the service version in the HTTP request header TrafficLabel. As shown in the 2-1 architecture diagram, the user specifies that traffic should be routed to the v3 environment. After receiving the request, the gateway component will generate a link tracking ID for this request. This ID will remain unique throughout the entire link that this request passes through. The link tracking ID generation process is as follows: first, an uppercase English letter is used to indicate the source of the request, then a timestamp is used to indicate the generation time, and finally a UUID is used to ensure that the current ID is globally unique. For example, the link U-2024062014173912-cdef0123456789abcdef indicates that the request was initiated by the user (U for User, S for System), as well as the initiation time and a globally unique flag. The gateway will then initiate a traffic labeling request to the traffic proxy component.
[0121] In some embodiments, see Figure 5 , the traffic proxy component will establish a mapping relationship based on the id and TrafficLabel in the request, and save the mapping relationship to the cache middleware. After that, the version environment where the request is located can be queried through the link tracking id. The traffic proxy component exposes an interface to the outside world. The sidecar gateway in each service in the link needs to access the traffic proxy component to determine which version the current request should be routed to. The role of the traffic proxy component is to determine the routing path corresponding to the request. The traffic proxy component exposes an interface to the outside world. The sidecar gateway in each service in the link needs to access the traffic proxy component to determine which version the current request should be routed to. After labeling is completed, the gateway component routes the request to the corresponding environment. As shown in the 2-1 architecture diagram, since ServiceA is not deployed in environment v3, the gateway will route the request to the baseline environment v1 by default.
[0122] In some embodiments, see Figure 5After receiving the request, ServiceA needs to call the service of ServiceB. At this time, when the egress network traffic passes through the sidecar gateway of ServiceA, the sidecar gateway will initiate a request to the traffic proxy component based on the link tracking ID in the request to query the environment corresponding to the ID. In this request, since the ID corresponds to environment v3, the sidecar gateway of ServiceA will initiate a call request to ServiceB in environment v3. After receiving the request from ServiceA in environment v1, ServiceB in environment v3 will repeat the previous step of requesting the environment corresponding to the ID from the traffic proxy component, and then call the service of ServiceC. Since ServiceC is not deployed in environment v3, it will default to calling ServiceC in baseline environment v1, completing the request call of the entire link. The request response in the link will be returned along the same path, and the gateway component will respond to the request result to the user, thus completing the entire call link.
[0123] In this way, users do not need to deploy all services for each environment. For example, in environment v3 in the above example, only ServiceB has iteration requirements. In this case, only ServiceB needs to be deployed. Requests for ServiceA and ServiceC in the entire link will default to calling the services in the baseline environment. This can greatly save computing resources required during the development process and effectively save costs.
[0124] In some embodiments, the main reason for this benefit is that the present invention innovatively establishes cache records for link tracking IDs and environment tags, so that the sidecar gateway in the service grid can query the environment corresponding to the ID, thereby correctly routing the request to the specified environment. Moreover, due to the support of the service grid, even if the specified environment does not have the required services, it can be automatically routed to the baseline environment.
[0125] This allows for non-invasive access to the grayscale feature. Users don't need to modify their existing business code; they only need to change their deployment architecture. This effectively reduces the cost of implementing grayscale and improves the user experience.
[0126] In this way, the implementation of basic functions such as traffic grayscale function is sunk into the sidecar and traffic proxy components. Users only need to care about their own business code. Basic functions are provided by external components, realizing the decoupling of business code and basic platform function code.
[0127] In some embodiments, Figure 5The gateway component shown is not required for deployment; its functionality can be delegated to all sidecar gateways. That is, all sidecar gateways can generate link tracking IDs and store the mapping between IDs and request contexts in a middleware cache. However, in actual enterprise-level deployment architectures, gateway components are generally required because they are needed to uniformly control north-south traffic. However, in the traffic control involved in this invention, the gateway component's functionality can be replaced by sidecar gateways.
[0128] In this way, by responding to the application access request for the target version, for each service, each functional version of the service is compared with the target version. If the version comparison result indicates that the target version exists in the functional version of the service, the functional service of the target version of the service is determined as the target functional service in the service cluster of the service, and the application access request is responded to based on the target functional service in each service cluster. In this way, since the service cluster includes at least one functional service, the functional service corresponds one-to-one to the functional version of the corresponding service. By comparing each functional version of the service with the target version, if the version comparison result indicates that the target version exists in the functional version of the service, the functional service of the target version of the service is used. This eliminates the need to deploy the full version of the functional service in each service cluster. It only requires the target version of the functional service to be deployed in at least one service cluster. By comparing each functional version of the service with the target version, if the version comparison result indicates that the target version exists in the functional version of the service, the functional service of the target version of the service is determined as the target functional service in the service cluster of the service. Based on the target functional service in each service cluster, the application access request is responded to. This eliminates the need to deploy the full version of the functional service in each service cluster, thereby achieving application access, effectively saving business resource occupancy and effectively reducing business access costs.
[0129] It is understandable that in the embodiments of the present application, when the relevant data in the application is applied to a specific product or technology, the user's permission or consent must be obtained, and the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0130] The following continues to describe the exemplary structure of the service access device 455 provided by the embodiment of the present application implemented as a software module. In some embodiments, such as Figure 2As shown, the software modules in the service access device 455 stored in the memory 450 may include: a response module, which is used to establish a mapping relationship between the routing path of the access request and the service version number indicated by the access request in response to the access request for the service; wherein the routing path includes: multiple services required to be called in response to the access request and the order of calling the multiple services; a calling module, which is used to call the corresponding services in the routing path in the order based on the mapping relationship to obtain the request result of the access request; and a return module, which is used to return the request result based on the routing path.
[0131] In some embodiments, the request result includes a sub-request result; the above-mentioned calling module is also used to determine the service version number corresponding to any one of the services in the routing path based on the mapping relationship; call the service corresponding to the service version number to obtain the sub-request result of the service.
[0132] In some embodiments, the above-mentioned calling module is also used to receive an access request for the service through the gateway component of the service; the above-mentioned calling module is also used to determine, for the first service in the routing path, the first service version number corresponding to the first service in the mapping relationship based on the identifier of the gateway component and the routing path.
[0133] In some embodiments, the above-mentioned calling module is also used to determine, for the i-th service in the routing path, when i is an integer greater than 1, the i-th service version number corresponding to the i-th service in the mapping relationship based on the edge gateway of the i-1-th service and the identifier of the routing path.
[0134] In some embodiments, the calling module is further configured to determine, based on the mapping relationship, a storage area corresponding to the service version number indicated by the access request; and determine, based on the service stored in the storage area, a service version number corresponding to the service.
[0135] In some embodiments, the above-mentioned calling module is also used to determine the corresponding service version number as the service version number if the service with the service version number indicated by the access request is stored in the storage area; if the service with the service version number indicated by the access request is not stored in the storage area, and the service includes multiple service version numbers, then select the service version number from multiple service version numbers; if the service with the service version number indicated by the access request is not stored in the storage area, and the service includes one service version number, then determine the baseline version as the service version number.
[0136] In some embodiments, the above-mentioned calling module is also used to select the service version number with the greatest service performance among the multiple service version numbers as the service version number; or, send a version confirmation request to the requester of the access request, and the version confirmation request includes the multiple service version numbers; and receive the service version number selected by the requester based on the multiple service version numbers.
[0137] In some embodiments, the request result includes the sub-request result; the above-mentioned return module is also used to return the sub-request result corresponding to the M-th service to the M-1-th service in the routing path, where M is used to indicate the number of services in the routing path, and M is greater than 1; for the i-th service in the routing path, when i is an integer greater than 1, the i-th service receives the sub-request result returned by the i+1-th service in the routing path, and sends the sub-request result returned by the i+1-th service and the sub-request result corresponding to the i-th service to the i-1-th service in the routing path; the first service in the routing path receives the sub-request result returned by the second service in the routing path; the sub-request result received by the first service and the sub-request result corresponding to the second service are used as the request result, and the request result is returned.
[0138] In some embodiments, the above-mentioned return module is also used for the first service in the routing path to send the sub-request result corresponding to the first service to the second service in the routing path; for the i-th service in the routing path, when i is an integer greater than 1, the i-th service receives the sub-request result returned by the i-1-th service in the routing path, and sends the sub-request result corresponding to the i-th service and the sub-request result returned by the i-1-th service to the i+1-th service in the routing path; the sub-request result received by the M-th service and the sub-request result corresponding to the M-th service are used as the request result, and the request result is returned, where M is used to indicate the number of services in the routing path, and M is greater than 1.
[0139] An embodiment of the present application provides a computer program product, which includes a computer program or computer-executable instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the service access method described in the embodiment of the present application.
[0140] The embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the processor will execute the access method of the service provided by the embodiment of the present application, for example, Figure 3 Shows the access method of the service.
[0141] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or various electronic devices including one or any combination of the above memories.
[0142] In some embodiments, computer-executable instructions may be in the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.
[0143] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as, for example, in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinating files (e.g., files storing one or more modules, subroutines, or code portions).
[0144] By way of example, computer-executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed across multiple sites and interconnected by a communication network.
[0145] In summary, the embodiments of the present application have the following beneficial effects:
[0146] (1) By receiving an application access request for an application, a mapping relationship is established between the routing path of the application access request and the service version indicated by the application access request. Based on the mapping relationship, the service of the corresponding service version in the routing path is called in sequence to obtain a request result for responding to the application access request; based on the routing path, the request result is returned. In this way, since the application includes multiple distributed deployed services, and the service includes at least one service version, by calling the service of the corresponding service version in the routing path in sequence based on the mapping relationship, a request result for responding to the application access request is obtained. Therefore, there is no need to deploy the full version of the service in each storage area. Based on the routing path, the request result is returned to respond to the application access request. Therefore, there is no need to deploy the full version of the service in each storage area, and application access can be achieved, thereby effectively saving the occupation of business resources and effectively reducing the access cost of the business.
[0147] (2) The mapping mechanism ensures stricter and more automated version control of services, reducing the risk of service errors and failures caused by version mismatches. The most appropriate service version can be dynamically selected based on different requests, improving the flexibility and adaptability of services. By clarifying the routing path of access requests and the order in which they are called, the efficiency and response speed of service calls can be optimized, thereby enhancing the user experience and the overall performance of the system.
[0148] (3) It not only improves the flexibility and efficiency of service calls, but also ensures that even when the specific version number requested is unavailable, the appropriate version number can still be selected through a reasonable strategy to respond to user requests, thereby enhancing the robustness of the system and user experience. It also helps to optimize resource utilization, avoids storing unnecessary service versions, and ensures the singleness and consistency of service versions, simplifies version management and maintenance, reduces operation and maintenance costs, provides a standardized process for handling the determination of service version numbers, improves reliability and stability, and provides users with more stable and high-quality services.
[0149] (4) Automatically selecting the version number with the highest service performance ensures that the system provides optimal service performance, thereby improving user experience and system efficiency. This reduces user waiting time and service delays, and improves service reliability and response speed. Sending a version confirmation request to the requesting party increases service flexibility and user satisfaction, because it allows users to select the most appropriate version based on their specific needs, providing a customized service experience. This user-involved decision-making process also helps reduce misunderstandings and conflicts, ensuring that the service better meets user expectations.
[0150] (5) By aggregating and returning the sub-request results of each service, the integrity of the request and the completeness of the information are ensured, so that the final result can fully reflect the processing status of all aspects of the user request. This method of passing sub-request results step by step ensures efficient collaboration between services. Each service can perform subsequent operations based on the processing results of the previous service, thereby improving overall processing efficiency. It helps to maintain and scalability of the service. New services can be easily integrated into the existing request processing process without affecting the normal operation of other services.
[0151] (6) The integrity of the request results is ensured because the sub-request results processed by each service are summarized and included in the final result, providing users or systems with comprehensive transaction or processing information. Robustness and fault tolerance are improved because each service can receive the results of the previous service and perform corresponding processing. If a service fails, it is easier to locate the problem and fix it. This hierarchical delivery mechanism also helps optimize resource utilization and improve processing efficiency, avoiding redundant data processing and reducing the complexity of communication between services.
[0152] (7) When multiple functional services are detected to be in operation, the target functional services can be further filtered out based on the operation status, which can avoid unnecessary maintenance operations on inactive services and save resources. Once the target functional service is determined, the system can quickly monitor or repair it, reducing the impact of the failure on the entire system and improving the failure response speed. When it is detected that there are more than one functional services of a specific version, the system can dynamically adjust the load according to the operation status and assign tasks to the most appropriate service, thereby optimizing performance and throughput. By accurately identifying the target functional service, the system can simplify maintenance operations and avoid batch and unnecessary restarts or updates of the entire cluster. Quickly identifying and repairing faulty services can reduce the time of service interruption, thereby improving user satisfaction and trust in the service.
[0153] (8) It can identify and utilize functional services in idle state, avoid waste of resources, and improve the overall efficiency of the system. By determining the target functional service, load balancing can be performed according to the operating status of each service to prevent some services from being overloaded while other services are idle. Under the condition that there are idle services, directly using the idle service as the target functional service can reduce the response time of the system and improve the user experience. When all functional services are in a non-idle state, the strategy selects the target functional service by analyzing the service parameters, which helps to maintain the stability and reliability of the system and avoid system crashes caused by excessive pressure on a single service. It can be dynamically adjusted according to the real-time service status and parameters to adapt to different workloads and environmental changes. By reasonably allocating tasks, idle services can reduce unnecessary energy consumption and contribute to energy conservation and emission reduction. It does not rely on fixed service configurations, is easy to expand and maintain, and is conducive to future upgrades and expansions of the system. When a service fails, this strategy can be used to quickly locate and switch to other services, thereby improving the fault tolerance of the system.
[0154] (9) When there is an idle functional service, it is directly identified as the target functional service, which can quickly respond to service requests and avoid idle resources. When there is only one idle service, the decision-making process becomes simple and clear, reducing the complexity of the system and improving the response speed of the system. When there are multiple idle services, the latest version of the service is selected as the target functional service to ensure that the service provides the most optimized and possibly the most secure functional version. The latest version of the functional service may contain improved functions and performance optimizations, and using such a service can improve the service experience of end users. Selecting the latest version of the service usually also means utilizing the latest security patches and vulnerability fixes, thereby improving the security of the system. Timely updates of services can be encouraged because updated services are more likely to be selected as target functional services, which indirectly promotes the update of the entire system version. By giving priority to the latest version of the service, the cost caused by version compatibility or maintenance of old versions can be reduced. Even when multiple services are idle, the most suitable target service can be quickly located, thereby improving availability. It can be adaptively adjusted according to the actual situation of the idle services, has high flexibility, and can cope with different workloads and service requests.
[0155] (10) Ability to conduct a comprehensive evaluation based on multi-dimensional indicators of service performance (such as processing power, memory usage, etc.), thereby more accurately identifying the best performing services. By setting thresholds, it is possible to ensure that the selected services meet the minimum standards on key performance indicators, thereby improving the stability and reliability of the system. In addition, selecting the service with the largest number of target sub-service parameters as the target functional service helps maximize resource utilization and system performance, while also balancing workloads and preventing certain services from being overloaded. This increases the transparency and predictability of service selection, facilitates maintenance and management, and improves the overall service quality.
[0156] (11) It ensures the continuity and availability of services. Even if a specific version is missing, users can still get basic services, avoiding service interruptions. It simplifies the processing process, eliminating the need for additional interactive confirmation with users, and improving the system's response speed and efficiency. At the same time, the initial version of the service can quickly respond to requests, reducing user waiting time and improving user experience. It ensures that even during the version iteration process, the system can maintain minimum functional operation, enhancing the stability and robustness of the system. Although this may mean that users cannot enjoy the advanced features of the latest version, basic needs can still be met, thus finding a balance between meeting user expectations and system resource management.
[0157] (12) The implementation of basic functions such as traffic grayscale function is sunk into the sidecar and traffic proxy components. Users only need to care about their own business code, and the basic functions are provided by external components, realizing the decoupling of business code and basic platform function code.
[0158] The above description is merely an embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and scope of the present application are included in the scope of protection of the present application.
Claims
1. A method for accessing a service, characterized in that: The method comprises: In response to an access request for a service, establishing a mapping relationship between a routing path of the access request and a service version number indicated by the access request; The routing path includes: multiple services required to be called in response to the access request and the order in which the multiple services are called; Based on the mapping relationship, calling corresponding services in the routing path in the order, and obtaining a request result of the access request; Based on the routing path, the request result is returned.
2. The method according to claim 1, characterized in that The request result includes sub-request results; The calling of corresponding services in the routing path in the order based on the mapping relationship to obtain a request result of the access request includes: For any one of the services in the routing path, determining a service version number corresponding to the service based on the mapping relationship; The service corresponding to the service version number is called to obtain the sub-request result of the service.
3. The method according to claim 2, characterized in that Before responding to the access request for the service, the method further includes: receiving, through a gateway component of the service, an access request for the service; The determining, based on the mapping relationship, a service version number corresponding to the service includes: For a first service in the routing path, a first service version number corresponding to the first service is determined in the mapping relationship according to the identifiers of the gateway component and the routing path.
4. The method according to claim 2, characterized in that The determining, based on the mapping relationship, a service version number corresponding to the service includes: For the i-th service in the routing path, when i is an integer greater than 1, the i-th service version number corresponding to the i-th service is determined in the mapping relationship based on the edge gateway of the i-1-th service and the identifier of the routing path.
5. The method according to claim 2, characterized in that The determining, based on the mapping relationship, a service version number corresponding to the service includes: Based on the mapping relationship, determining a storage area corresponding to the service version number indicated by the access request; Based on the services stored in the storage area, a service version number corresponding to the services is determined.
6. The method according to claim 5, characterized in that The determining, based on the service included in the storage area, a service version number corresponding to the service, includes: If the storage area stores a service with a service version number indicated by the access request, determining the corresponding service version number as the service version number; If the storage area does not store the service with the service version number indicated by the access request, and the service includes multiple service version numbers, then select the service version number from the multiple service version numbers; If the storage area does not store the service with the service version number indicated by the access request, and the service includes only one service version number, the baseline version is determined as the service version number.
7. The method according to claim 6, characterized in that The selecting the service version number from a plurality of service version numbers includes: Among the multiple service version numbers, select the service version number with the greatest service performance as the service version number; Alternatively, sending a version confirmation request to the requester of the access request, wherein the version confirmation request includes the multiple service version numbers; Receive a service version number selected by the requester based on the multiple service version numbers.
8. The method according to claim 1, characterized in that The request result includes the sub-request result; The returning the request result based on the routing path includes: Return the sub-request result corresponding to the Mth service to the M-1th service in the routing path, where M is used to indicate the number of services in the routing path, and M is greater than 1; For the i-th service in the routing path, if i is an integer greater than 1, the i-th service receives the subrequest result returned by the i+1-th service in the routing path, and sends the subrequest result returned by the i+1-th service and the subrequest result corresponding to the i-th service to the i-1-th service in the routing path; The first service in the routing path receives the sub-request result returned by the second service in the routing path; The sub-request result received by the first service and the sub-request result corresponding to the second service are used as the request result, and the request result is returned.
9. The method according to claim 1, characterized in that The request result includes the sub-request result; The returning the request result based on the routing path includes: The first service in the routing path sends the sub-request result corresponding to the first service to the second service in the routing path; For the i-th service in the routing path, when i is an integer greater than 1, the i-th service receives the subrequest result returned by the i-1-th service in the routing path, and sends the subrequest result corresponding to the i-th service and the subrequest result returned by the i-1-th service to the i+1-th service in the routing path; The sub-request result received by the M-th service and the sub-request result corresponding to the M-th service are used as the request result, and the request result is returned. M is used to indicate the number of the services in the routing path, and M is greater than 1.
10. A device for accessing a service, characterized in that: The device comprises: a response module, configured to, in response to an access request for a service, establish a mapping relationship between a routing path of the access request and a service version number indicated by the access request; wherein the routing path includes: a plurality of services required to be called in response to the access request and the order in which the plurality of services are called; A calling module, configured to call corresponding services in the routing path in the order described based on the mapping relationship to obtain a request result of the access request; The return module is used to return the request result based on the routing path.
11. An electronic device, characterized in that: The electronic device comprises: a memory for storing computer-executable instructions or computer programs; A processor is configured to implement the service access method according to any one of claims 1 to 9 when executing the computer executable instructions or computer program stored in the memory.
12. A computer-readable storage medium storing computer-executable instructions, characterized in that: When the computer executable instructions are executed by a processor, the service access method according to any one of claims 1 to 9 is implemented.
13. A computer program product comprising a computer program or computer executable instructions, characterized in that When the computer program or computer executable instructions are executed by a processor, the service access method according to any one of claims 1 to 9 is implemented.
Citation Information
Cited By
Service version control method, device and equipment
CN121143858A