Routing address storage method and device, electronic equipment, computer readable storage medium and computer program product
By segmenting and sequence matching of routing addresses and optimizing the structure of address tree, the problems of service routing gateway storage pressure and query efficiency are solved, and efficient routing address query is achieved.
Patent Information
- Application Number
- CN202410932541.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-12-17
AI Technical Summary
As the number of registered services increases, the storage pressure of the service routing gateway increases, affecting the efficiency of querying routing addresses.
By segmenting the routing address, a sequence of address information is generated, and sequence matching and storage is performed in the address tree, child nodes are added to reduce the height of the tree and improve query efficiency.
It effectively reduces the tree height of the address tree, improves the efficiency of querying routing addresses, reduces memory usage, and improves the processing capabilities of the service routing gateway.
Smart Images

Figure CN119155240A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to computer network technology, and in particular to a method, device, electronic device, computer-readable storage medium and computer program product for storing a routing address. Background Art
[0002] When internal and external businesses access services, it is necessary to query the routing address of the accessed service through the pre-set business routing gateway, and then transmit the access request to the service corresponding to the routing address. The service returns the access result, and the business routing gateway forwards the access result to the accessed terminal after receiving the access result.
[0003] In the process of the business routing gateway storing the routing addresses of each service, as the number of registered services increases, the storage pressure of the business routing gateway will increase and the efficiency of the business routing gateway querying the routing address will be affected. Summary of the invention
[0004] The embodiments of the present application provide a method and device for storing a routing address, a computer-readable storage medium, and a computer program product, which can improve the efficiency of querying a routing address.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] An embodiment of the present application provides a method for storing a routing address, the method comprising:
[0007] Segmenting the routing address of the second service to obtain a second address information sequence of the second service;
[0008] Sequence matching of a first address information sequence of a first service and the second address information sequence, wherein the first address information sequence is stored in a first path of an address tree;
[0009] If the second address information sequence includes the first address information sequence and the first element, the first element and the address information stored in the last node of the first path are combined into newly added address information;
[0010] A first child node is added to the parent node of the last node of the first path, and the newly added address information is stored in the first child node.
[0011] An embodiment of the present application provides a storage device for a routing address, including:
[0012] An address segmentation module, used for segmenting the routing address of the second service to obtain a second address information sequence of the second service;
[0013] A sequence matching module, used for performing sequence matching between a first address information sequence of a first service and the second address information sequence, wherein the first address information sequence is stored in a first path of an address tree;
[0014] an address determination module, configured to, if the second address information sequence includes the first address information sequence and a first element, combine the first element and the address information stored in the last node of the first path into newly added address information;
[0015] The address storage module is used to add a first child node to the parent node of the last node of the first path, and store the newly added address information in the first child node.
[0016] In the above scheme, the address storage module is also used to respond to an access request for the second service, query the target address information stored in the target node included in the first path in the address tree, and the newly added address information stored in the first child node, wherein the target node is a node in the first path that does not include the last node; and concatenate the target address information and the newly added address information to obtain the routing address of the second service.
[0017] In the above scheme, the address segmentation module is also used to determine the separator included in the routing address; based on the separator, the routing address is segmented into multiple second address information; based on the position of the second address information in the routing address, the multiple second address information is sorted to obtain the second address information sequence.
[0018] In the above scheme, the address storage module is also used to merge the address information stored in the first node and the address information stored in the child node of the first node to obtain merged address information if the address tree includes a first node with a child node; use the merged address information to update the address information stored in the first node, and delete the child node of the first node.
[0019] In the above scheme, the address storage module is also used to obtain the target address information sequence corresponding to the third service from the address tree in response to the number of visits to the third service exceeding the access number threshold within a preset time period, and merge the target address information sequence into the routing address of the third service; and store the third service and the routing address of the third service in the cache accordingly.
[0020] In the above scheme, the address storage module is also used to query the routing address of the third service from the cache in response to receiving an access request to the third service, and perform access to the third service based on the routing address of the third service.
[0021] In the above scheme, the address storage module is also used to store the routing address of the third service and the unique identifier in the first leaf node if the routing address of the third service has a unique identifier, wherein the first leaf node is a child node directly connected to the root node in the address tree.
[0022] In the above scheme, the address storage module is also used to respond to a registration request for a target service of the second environment, and perform first environment marking processing on the target service of the first environment in the address tree; store the routing address of the target service of the second environment in the address tree, and perform second environment marking processing on the target service of the second environment in the address tree.
[0023] In the above solution, the address storage module is further used to obtain the first path corresponding to the target service of the first environment from the address tree, and store the first environment label representing the first environment in the last node in the first path.
[0024] In the above scheme, the address storage module is also used to add a pointer to the second child node in the parent node of the last node of the first path, so as to store the address information stored in the last node of the first path in the second child node; and store the second environment label representing the second environment in the second child node.
[0025] In the above scheme, the address storage module is also used to respond to an access request to the target service of the target environment, query the target routing address corresponding to the target service of the target environment and the environment tag corresponding to the target environment from the address tree; write the environment tag corresponding to the target environment into the target routing address to obtain the target routing address including the environment tag; and send the access request to the target service of the target environment based on the target routing address including the environment tag.
[0026] An embodiment of the present application provides an electronic device, the electronic device comprising:
[0027] A memory for storing computer executable instructions;
[0028] The processor is used to implement the routing address storage method provided in the embodiment of the present application when executing the computer executable instructions stored in the memory.
[0029] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions for implementing a method for storing a routing address provided in an embodiment of the present application when executed by a processor.
[0030] An embodiment of the present application provides a computer program product, including computer executable instructions, which, when executed by a processor, implement the method for storing a routing address provided in the embodiment of the present application.
[0031] The embodiments of the present application have the following beneficial effects:
[0032] The routing address of the second service is split to obtain the second address information sequence of the second service, the first address information sequence and the second address information sequence of the first service are sequence-matched, and the first address information sequence is stored in the first path of the address tree. If the second address information sequence includes the first address information sequence and the first element, the first element and the address information stored in the last node of the first path are combined to form new address information, a first child node is added to the parent node of the last node of the first path, and the new address information is stored in the first child node. In the related technology, when storing the second address information sequence of the second service, a child node is added to the last node of the first path, and the above-mentioned first element is stored in the newly added child node. In this way, the second path used to store the second address information sequence is equivalent to extending one node on the basis of the first path. This method increases the tree height of the address tree, thereby reducing the subsequent query efficiency. The present application adds a pointer to the first child node in the parent node of the last node of the first path, which is equivalent to adding a child node (first child node) in the last level of the first path, and stores the newly added address information in the first child node, that is, in another child node of the parent node of the last node of the first path. In this way, by increasing the number of the last child nodes of the first path, the tree height of the address tree is reduced, thereby improving the query efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 is a schematic diagram of the architecture of a storage system 100 for routing addresses provided in an embodiment of the present application;
[0034] Figure 2 is a schematic diagram of the structure of an electronic device 500 provided in an embodiment of the present application;
[0035] Figure 3A This is a first flow chart of a method for storing a routing address provided in an embodiment of the present application;
[0036] Figure 3B It is a second flow chart of the method for storing routing addresses provided in an embodiment of the present application;
[0037] Figure 3C This is a third flow chart of the method for storing a routing address provided in an embodiment of the present application;
[0038] Figure 4 is a schematic diagram of an address tree provided in an embodiment of the present application;
[0039] Figure 5 is a schematic diagram of nodes in the address tree provided in an embodiment of the present application;
[0040] Figure 6 is a schematic diagram of a first leaf node provided in an embodiment of the present application;
[0041] Figure 7 It is an architectural diagram of a method for storing routing addresses provided in an embodiment of the present application;
[0042] Figure 8 It is an implementation flow chart of the method for storing routing addresses provided in an embodiment of the present application.
[0043] It should be pointed out that the above-mentioned "first" and "second" are only used to distinguish different solutions, and do not represent the degree of superiority or inferiority of the solutions or the priority in the implementation process. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.
[0045] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it can 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.
[0046] 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 here can be implemented in an order other than that illustrated or described here.
[0047] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0048] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meanings as those commonly understood by those skilled in the art. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.
[0049] The relevant data collection and processing in the embodiments of this application should be strictly in accordance with the requirements of relevant national laws and regulations when applied in examples, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of authorization of laws and regulations and the personal information subject.
[0050] 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.
[0051] 1) Compact prefix tree: A compact prefix tree is a more space-saving prefix tree. A prefix tree, also known as a dictionary tree, is a k-way search tree used to search for specific keys in a set. These keys are usually strings, but can also be other data types. In a prefix tree, corresponding values can be saved for keys, and these values are usually saved in leaf nodes. Unlike a binary search tree, the nodes of a prefix tree do not save complete keys, but single characters. To obtain the key corresponding to a node, it is necessary to traverse from the root node to the corresponding node according to the depth-first principle, and connect the characters of each node on the traversal path.
[0052] 2) Fan-out: An important attribute of the compressed dictionary tree is the pointer of a node to its child nodes. The fan-out value is the number of pointers corresponding to the fan-out. The fan-out value determines the height of the dictionary tree. For a string of length k, the height of the dictionary tree is [k / s], where s is the fan-out value.
[0053] 3) Request response time (RT): The total time it takes to execute a request from the beginning to the end of receiving the response data, that is, the time from the client initiating the request to receiving the server's response result. The numerical value of RT represents the speed of system response.
[0054] 4) Multiple lanes for test environment: A complete set of service links is one lane. Common and unchanging general services are concentrated in the main lane, and other variable services are deployed in multiple secondary lanes. The main lane can access the secondary lanes, and the secondary lanes do not affect each other through physical or logical isolation, thereby ensuring the stability of the test environment.
[0055] As an indispensable middleware in the microservice system of modern companies, the business routing gateway plays an important role in managing internal service governance, external traffic governance, service tracking, circuit breaking and downgrading. In traditional microservice systems, gateways often only focus on the service group of a single internal environment. With the development of business and the migration of services to the cloud, the internal microservice system has transformed into a multi-environment and multi-form service scenario. At this time, the routing gateway in a single environment will carry more traffic. The performance of the traditional compressed dictionary tree will gradually decline and memory consumption will increase after the storage of more strings. In the development and testing of multiple environments, multiple sets of gateways also need to be deployed, which increases the cost of R&D and maintenance, and cannot well cope with problems such as traffic control in multiple environments and multi-lane test releases.
[0056] The embodiments of the present application provide a method, apparatus, device, computer-readable storage medium, and computer program product for storing a routing address, which can improve the efficiency of querying a routing address.
[0057] The following describes an exemplary application of the electronic device provided by the embodiment of the present application. The electronic device provided by the embodiment of the present application can be implemented as various types of terminals such as a laptop computer, a tablet computer, a desktop computer, a set-top box, a mobile device, a smart device, a vehicle terminal, an aircraft, etc., and can also be implemented as a server. The following describes an exemplary application when the device is implemented as a server.
[0058] See also Figure 1 , Figure 1 It is a schematic diagram of the architecture of the storage system 100 of the routing address provided in the embodiment of the present application. To implement a storage application supporting a routing address, the terminal 400 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.
[0059] The terminal 400 is used to receive a service registration request and send the service registration request to the service 200 through the network 300 .
[0060] The server 200 is used to split the routing address of the second service after receiving the registration request of the service through the network 300, obtain the second address information sequence of the second service, match the first address information sequence of the first service with the second address information sequence, store the first address information sequence in the first path of the address tree, and if the second address information sequence includes the first address information sequence and the first element, the first element and the address information stored in the last node of the first path are combined into the newly added address information, add the first child node to the parent node of the last node of the first path, and store the newly added address information in the first child node. The registration result is returned to the terminal through the network 300, and the terminal displays the registration result to the user.
[0061] The storage method of the routing address provided in the embodiment of the present application can be applied to the business gateway of the cloud service. When the user sends a service registration request to the business gateway of the cloud service through the terminal, the business gateway can segment the routing address of the second service to obtain the second address information sequence of the second service, and perform sequence matching on the first address information sequence of the first service and the second address information sequence. The first address information sequence is stored in the first path of the address tree. If the second address information sequence includes the first address information sequence and the first element, the address information stored in the last node of the first path is combined with the first element to form the newly added address information, and the first child node is added to the parent node of the last node of the first path, and the newly added address information is stored in the first child node. Then the business gateway returns the registration result to the terminal.
[0062] When the terminal sends a service access request to the business gateway, the business gateway can find the address information stored in the node corresponding to the service from the address tree, and then splice the address information stored in each node according to the order of the nodes in the address tree to obtain the complete routing address of the service, and then send the access request to the service corresponding to the routing address. The service returns the access result, and the business gateway returns the access result to the terminal.
[0063] In some embodiments, the server 200 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. The terminal and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present application.
[0064] See also Figure 2 , Figure 2 is a schematic diagram of the structure of an electronic device 500 provided in an embodiment of the present application, Figure 2 The electronic device 500 shown includes: at least one processor 510, a memory 550, at least one network interface 520 and a user interface 530. The various components in the electronic device 500 are coupled together via a bus system 540. It is understood that the bus system 540 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 540 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 540 is not described in detail. Figure 2 Various buses are labeled as bus system 540 .
[0065] The processor 510 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.
[0066] The user interface 530 includes one or more output devices 531 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 530 also includes one or more input devices 532, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0067] The memory 550 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. The memory 550 may optionally include one or more storage devices that are physically remote from the processor 510.
[0068] The memory 550 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 550 described in the embodiments of the present application is intended to include any suitable type of memory.
[0069] In some embodiments, the memory 550 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.
[0070] Operating system 551, including system programs for processing various basic system services and performing hardware-related tasks, such as framework layer, core library layer, driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0071] A network communication module 552, used to reach other electronic devices via one or more (wired or wireless) network interfaces 520, exemplary network interfaces 520 include: Bluetooth, Wireless Compatibility Certification (WiFi), and Universal Serial Bus (USB), etc.;
[0072] a presentation module 553 for enabling presentation of information via one or more output devices 531 (e.g., display screen, speaker, etc.) associated with the user interface 530 (e.g., a user interface for operating peripherals and displaying content and information);
[0073] The input processing module 554 is used to detect one or more user inputs or interactions from one of the one or more input devices 532 and translate the detected inputs or interactions.
[0074] In some embodiments, the device provided in the embodiments of the present application can be implemented in software. Figure 2 The storage device 555 of the routing address stored in the memory 550 is shown, which can be software in the form of a program and a plug-in, etc., including the following software modules: an address segmentation module 5551, a sequence matching module 5552, an address determination module 5553 and an address storage module 5554. These modules are logical, so they can be arbitrarily combined or further split according to the functions implemented. The functions of each module will be explained below.
[0075] In other embodiments, the device provided in the embodiments of the present application can be implemented in hardware. As an example, the device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the storage method of the routing address provided in 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 (Application Specific Integrated Circuit, ASIC), digital signal processors (Digital Signal Processor, DSP), programmable logic devices (Programmable Logic Device, PLD), complex programmable logic devices (Complex Programmable Logic Device, CPLD), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other electronic components.
[0076] The following describes the method for storing the routing address provided in the embodiment of the present application. As mentioned above, the electronic device for implementing the method for storing the routing address in the embodiment of the present application may be a terminal, a server, or a combination of the two. Therefore, the execution subject of each step will not be repeatedly described below.
[0077] See also Figure 3A , Figure 3A This is a first flow chart of the method for storing routing addresses provided in an embodiment of the present application, which will be combined with Figure 3ASteps 101 to 104 are shown for explanation.
[0078] In step 101, the routing address of the second service is segmented to obtain a second address information sequence of the second service.
[0079] As an example, before segmenting the routing address of the second service, an address tree needs to be obtained first, wherein a first path in the address tree stores a first address information sequence of the first service.
[0080] As an example, the routing address of the first service is http: / / abc / def / gh. When storing the routing address of the first service, the routing address of the first service can be first divided into the first address information sequence "http", "abc", "def" and "gh". If the first path includes four nodes A\B\C\D, since the order of the address information in the first address information sequence is positively correlated with the level of the node storing the address information in the first path, that is, the higher the order of the address information, the higher the level of the node corresponding to the address storage, the address information "http" can be stored in node A, the address information "abc" can be stored in node B, the address information "def" can be stored in node C, and the address information "gh" can be stored in node D, so as to store the routing address of the first service in the first path of the address tree.
[0081] As an example, when storing the routing address of each service, a tree structure (address tree) may be used to store the routing address of each service.
[0082] As an example, the address information included in the first address information sequence is respectively stored in the nodes of the first path, and the order of the address information in the first address information sequence is positively correlated with the level of the node storing the address information in the first path.
[0083] As an example, the first address information sequence is address information A, address information B and address information C, node D stores address information A, node E stores address information B, and node F stores address information C, wherein address information A is sorted before address information B in the first address information sequence, and address information B is sorted before address information C in the first address information sequence. Therefore, in the first path, the level of node D is higher than that of node E, and the level of node E is higher than that of node F.
[0084] Combine the following Figure 4 Introduce the structure of the address tree, Figure 4 It is a schematic diagram of the address tree provided in the embodiment of the present application.
[0085] exist Figure 4 In FIG. 4 , node 401 is the root node of the address tree, and the root node does not store address information. Figure 4 The first path in the address tree is shown, and the first path includes node 402, node 403, and node 404. Each node included in the first path stores address information. The first address information sequence obtained by dividing the routing address of the first service is "a, b, c". Since the first address information sequence is address information a, address information b, and address information c, according to the query logic of the address tree, the routing address of the first service is queried from the root node downward, so the order of an address information in the first address information sequence is positively correlated with the level of the node storing the address information in the first path. For example, address information a is ranked first in the first address information sequence, and node 402 storing address information a is at the first level in the first path. Address information a is stored in node 402, address information b is stored in node 403, and address information c is stored in node 404.
[0086] In some embodiments, the segmentation of the routing address of the second service in the above step 101 to obtain the second address information sequence of the second service can be implemented by the following technical solution: determining the separator included in the routing address; based on the separator, segmenting the routing address into multiple second address information; based on the position of the second address information in the routing address, sorting the multiple second address information to obtain the second address information sequence. Through the above implementation, the routing address is segmented only by the separator of the routing address itself, which improves the efficiency of segmentation of the routing address and reduces the subsequent maintenance cost of the address tree.
[0087] As an example, there are natural separators in the routing address, and the routing address can be divided into multiple second address information based on the position of each separator. Then, the multiple second address information are sorted to obtain a second address information sequence.
[0088] In some embodiments, the segmentation of the routing address of the second service in step 101 to obtain the second address information sequence of the second service can be achieved by the following technical solution: segmentation of all information of the routing address of the second service to obtain the second address information sequence of the second service, or segmentation of the path information in the routing address of the second service to obtain the second address information sequence of the second service. That is, the second address information sequence here can be a sequence including all information of the routing address, or a sequence including only the path information of the routing address. Through the above implementation, segmentation of all information can realize more diversified routing address storage in an address tree, and segmentation of path information can save storage resources of the address tree and improve matching efficiency.
[0089] A routing address (Uniform Resource Locator) may include a protocol, a host address (domain name and port), a path (the path to the resource on the web server, equivalent to the path information above), a query string (additional parameters provided to the web server), and an anchor (an anchor to another part of the resource itself).
[0090] The protocol can be http, https, and so on. The domain name (for example, www.example.com) indicates the server being requested. Ports correspond to different services. For the front end, http: / / corresponds to the standard port 80, and https: / / corresponds to the standard port 443. The path is the path of the resource on the network server. Using different paths on the same server can get different pages. The query string (for example? key1 = value1) is a query parameter, and each server has its own parameter rules. Anchors (for example #Anchor1), anchors will not be passed to the server, and can be understood as bookmarks, just as bookmarks can help quickly locate the specified page.
[0091] If the protocols or host addresses of the services stored in the address tree are different, or the protocol or host address of the second service is different from that of the service stored in the address tree, all the information of the routing address of the second service is segmented to obtain the second address information sequence of the second service. As an example, if the routing address is http: / / abc / def / gh / i, where http represents the protocol, abc represents the host address, and def / gh / i represents the path, the composition of the routing address can be ignored, and the routing address can be directly segmented into "http", "abc", "def", "gh" and "i" based on the separator " / " or ": / / ", wherein each "" contains a second address information obtained by segmentation, and then the multiple second address information are sorted based on the position of each second address information in the routing address to obtain the second address information sequence of "http", "abc", "def", "gh" and "i".
[0092] As an example, in addition to segmenting the routing address according to the natural separator of the routing address, the routing address can also be segmented according to a preset number of characters. For example, if the routing address is http: / / abc / def / gh / i, and each second address information is preset to include four characters, the routing address can be segmented into "http", "abcd", "efgh" and "i", and then the multiple second address information can be sorted according to the position of each second address information in the routing address, and the second address information sequence is obtained as "http", "abcd", "efgh" and "i".
[0093] When the protocol and host address of the second service are the same as those of all services stored in the address tree, the path information in the routing address of the second service is segmented to obtain a second address information sequence for the second service. Since the protocol of the routing address can be fixed, and the host address is also fixed for the same host, only the path can be stored in the address tree, and therefore only the path in the routing address can be divided.
[0094] As an example, if the routing address is http: / / abc / def / gh / i, where http represents the protocol, abc represents the host address, and def / gh / i represents the path, the path of the routing address can be segmented by the natural separator of the routing address, and the obtained second address information are "def", "gh", and "i" respectively. Then, the multiple second address information can be sorted according to the position of each second address information in the routing address, and the obtained second address information sequence is "def", "gh" and "i".
[0095] In step 102, a first address information sequence and a second address information sequence of a first service are sequence-matched, and the first address information sequence is stored in a first path of an address tree.
[0096] As an example, if the first address information sequence is obtained based on the path information in the routing address, then the second address information sequence is also obtained based on the path information in the routing address; if the first address information sequence is obtained based on all the information in the routing address, then the second address information sequence is also obtained based on all the information in the routing address.
[0097] As an example, the first address information sequence is "http", "abc", "def", and "gh". The second address information sequence is "http", "abc", "def", "gh", and "i". The different part between the first address information sequence and the second address information sequence is that the second address information sequence also includes "i", and the same part between the first address information sequence and the second address information sequence is "http", "abc", "def", and "gh". The different parts and the same parts constitute the sequence matching result.
[0098] As an example, if the first address information sequence is "def" and "gh", and the second address information sequence is "def", "gh" and "i", then the different part between the first address information sequence and the second address information sequence is "i", and the same part between the first address information sequence and the second address information sequence is "def" and "gh", and the different parts and the same parts constitute the sequence matching result, and the different part "i" between the first address information sequence and the second address information sequence can be used as the first element.
[0099] In step 103, if the second address information sequence includes the first address information sequence and the first element, the first element and the address information stored in the last node of the first path are combined into newly added address information.
[0100] As an example, the first element may be a difference sequence between the second address information sequence and the first address information sequence, and the second address information sequence may be obtained by concatenating the first address information sequence with the first element (the first address information sequence is before the first element).
[0101] As an example, here the second address information sequence includes the first address information sequence and the first element, which can be interpreted as the first address information sequence and the second address information sequence are repeated from the starting position of the sequence, the first address information sequence is a subset of the second address information sequence, and the difference between the first address information sequence and the second address information sequence is the first element.
[0102] In step 104, a first child node is added to the parent node of the last node of the first path, and the newly added address information is stored in the first child node.
[0103] For example, if the first address information sequence is "abc", "def", and "gh", the second address information sequence is "abc", "def", "gh", and "i", and the first element is "i". At this time, the address information stored in the last node of the first path is "gh", and at this time, "gh" and "i" can be combined into the newly added address information.
[0104] Combine the following Figure 5 Describe the process of storing newly added address information. Figure 5 Schematic diagram of nodes in the address tree provided in the embodiment of the present application. Figure 5 In the example, node 501 is the root node and does not store the routing address. If the first address information sequence is "http", "abc", "def" and "gh", and the second address information sequence is "http", "abc", "def", "gh" and "i", then the routing address "http" is stored in node 502, the routing address "abc" is stored in node 503, the routing address "def" is stored in node 504, and the routing address "gh" is stored in node 505. At this time, a pointer is added to node 504 to point to the first child node 506, and the newly added address information "gh / i" is stored in node 506. Node 505 and node 506 have the same parent node.
[0105] By adding a pointer in node 504, the routing address of the second service is stored without adding a child node of node 505 in node 505 to store the routing address of the second service, thereby reducing the height of the address tree and further reducing the memory usage of the address tree.
[0106] In some embodiments, after executing the above step 106, the following technical solution can also be executed: if the address tree includes a first node with a child node, the address information stored in the first node and the address information stored in the child node of the first node are merged to obtain merged address information; the address information stored in the first node is updated using the merged address information, and the child node of the first node is deleted.
[0107] As an example, the following combination Figure 5 To explain, Figure 5 In the example, node 501 is the root node and does not store the routing address. Node 503 has only one child node 504. At this time, the routing address "def" stored in child node 504 can be merged with the routing address "abc" stored in node 503 to obtain the merged address information "abc / def". Then, the routing address stored in node 503 can be updated to "abc / def", and then node 504 can be deleted. Similarly, node 502 has only one child node, node 503. Therefore, the routing address "http" stored in node 502 can be merged with the routing address "abc / def" stored in node 503 to obtain the merged address information "http: / / abc / def". Then, the routing address stored in node 502 can be updated to "http: / / abc / def", and node 503 can be deleted. Then, the following is obtained. Figure 5 Address tree 507 is shown.
[0108] Through the above method, the height of the address tree can be reduced while retaining the routing address, thereby reducing the memory occupied by the storage address tree.
[0109] In some embodiments, after executing the above step 106, the following technical solution can also be executed: in response to an access request for a second service, query the target address information stored in the target node included in the first path in the address tree, and the newly added address information stored in the first child node, wherein the target node is a node in the first path that does not include the last node; concatenate the target address information and the newly added address information to obtain the routing address of the second service.
[0110] As an example, the following combination Figure 5 To illustrate, in response to the access request for the second service, it is necessary to query the address tree to obtain the routing address of the second service. Specifically, the target node included in the first path (i.e. Figure 5 The target address information stored in nodes 502, 503, and 504 in FIG. 1 and the first child node (i.e. Figure 5 The newly added address information stored in node 506) is then concatenated with the target address information and the newly added address information, that is, "http" stored in node 502, "abc" stored in node 503, "def" stored in node 504, and "gh / i" stored in node 506 are concatenated to obtain the routing address of the second service as "http: / / abc / def / gh / i".
[0111] In some embodiments, after executing the above step 106, the following technical solution can also be executed: if the routing address of the third service has a unique identifier, the routing address and the unique identifier of the third service are stored in the first leaf node, wherein the first leaf node is a child node directly connected to the root node in the address tree.
[0112] As an example, the following combination Figure 6 To explain, Figure 6 602 is a schematic diagram of the first leaf node provided by the embodiment of the present application. If the routing address of the third service has a unique identifier "x", and the routing address of the third service is "http: / / a / b / c", the unique identifier "x" and the routing address "http: / / a / b / c" of the third service can be stored in the first leaf node 602, and the first leaf node is directly connected to the root node 601.
[0113] In the above manner, the routing address of the corresponding service can be found based on the unique identifier, so the routing address of the service can be stored in a node, reducing the memory occupation of the address tree.
[0114] In some embodiments, after executing the above step 104, the following steps may also be performed: Figure 3B Step 105 and step 106 are shown.
[0115] In step 105, in response to a registration request for a target service of a second environment, a first environment marking process is performed on the target service of a first environment in an address tree.
[0116] In some embodiments, the first environment labeling processing of the target service of the first environment in the above step 105 can be implemented by the following technical solution: obtaining the first path corresponding to the target service of the first environment from the address tree, and storing the first environment label representing the first environment in the last node in the first path.
[0117] As an example, in an embodiment of the present application, the environment for accessing a service may be a test environment, an application environment, etc. In a test environment, since the functions of each test may be different, the test environment may be divided into multiple test environments according to the content of the test. The services to be accessed in different environments may be different, and the results generated for accessing the same service may also be different. For example, when shopping service A is accessed in an application environment, shopping service A may feedback item information, while when shopping service A is accessed in a test environment, feedback may be the number of times the item has been accessed. Therefore, each service needs to be labeled with an environment in the address tree so that when accessing services in different environments, the access results in the corresponding environment can be obtained.
[0118] As an example, if the nodes corresponding to the first path are node A, node B, and node C, where node C is the last node, the first environment label corresponding to the first path may be stored in node C.
[0119] Through the above method, services corresponding to multiple environments can be stored in the same address tree, without the need to maintain an address tree for each environment, thereby reducing memory usage.
[0120] In step 106, the routing address of the target service of the second environment is stored in the address tree, and the target service of the second environment is marked with the second environment in the address tree.
[0121] In some embodiments, storing the routing address of the target service of the second environment in the address tree in step 106 can be achieved by the following technical solution: adding a pointer to the second child node in the parent node of the last node of the first path to store the address information stored in the last node of the first path in the second child node.
[0122] As an example, if the nodes corresponding to the first path are node A, node B and node C, where node A is the parent node of node B and node B is the parent node of node C, then the parent node of the last node of the first path is node B. At this time, the pointer of node B can be increased to increase the child node D (second child node) of node B. At this time, the address information stored in the last node C of the first path can be stored in the second child node D.
[0123] In some embodiments, the second environment tagging process for the target service of the second environment in the address tree in step 106 may be implemented by the following technical solution: storing the second environment tag representing the second environment in the second child node.
[0124] As an example, following the above example, the second environment tag representing the second environment may be stored in the second child node D.
[0125] Through the above method, when adding different environment labels for the same service, you only need to add a node at the lowest level to add a different environment label, without having to re-store a complete path, thereby reducing memory usage.
[0126] In some embodiments, after executing the above step 108, the following technical solution can also be executed: in response to an access request to a target service of a target environment, query the target routing address corresponding to the target service of the target environment and the environment tag corresponding to the target environment from the address tree; write the environment tag corresponding to the target environment into the target routing address to obtain the target routing address including the environment tag; based on the target routing address including the environment tag, send the access request to the target service of the target environment.
[0127] As an example, when an access request for a target service of a target environment is received, the target routing address corresponding to the target service and the environment label corresponding to the target environment can be queried from the address tree, and then the access request is forwarded to the target service of the target environment.
[0128] For example, if the target environment is environment A and the target service is service B, the routing address corresponding to service B can be found from the address tree as http: / / c / b / d. At this time, the environment labels corresponding to service B include environment A, environment B, and environment C, so the access request can be forwarded to the target service with environment label A and routing address http: / / c / b / d.
[0129] In some embodiments, after executing the above step 104, the following steps may also be performed: Figure 3C Step 107 and step 108 are shown.
[0130] In step 107, in response to the number of visits to the third service exceeding the access number threshold within the preset time period, the target address information sequence corresponding to the third service is obtained from the address tree, and the target address information sequence is merged into the routing address of the third service.
[0131] As an example, when the number of visits to the third service exceeds the access number threshold within a preset time period, it indicates that the third service is frequently visited during this period, so the target address information sequence corresponding to the third service can be merged into the routing address of the third service.
[0132] As an example, within 10 minutes, the third service is accessed 50 times, which exceeds the access number threshold of 40 times, and the target address information sequence "http", "a", and "c" corresponding to the third service can be merged into "http: / / a / c".
[0133] In step 108, the third service and the routing address of the third service are stored in a cache in correspondence.
[0134] As an example, the routing address of the third service is "http: / / a / c", then the third service-http: / / a / c may be stored in the cache as a corresponding relationship.
[0135] In some embodiments, after executing step 108, the following technical solution may also be executed: in response to receiving an access request to a third service, querying the routing address of the third service from the cache, and accessing the third service based on the routing address of the third service.
[0136] As an example, in response to receiving an access request for a third service, the routing address corresponding to the third service may be directly queried from the cache without having to re-query the routing address of the third service from the address tree.
[0137] As an example, when the number of visits to the third service within a preset time period is lower than the access number threshold, it can be characterized that the third service is not frequently accessed during this period. In order to save storage space, the correspondence between the third service stored in the cache and the routing address of the third service can be deleted.
[0138] Through the above method, the efficiency of querying the routing address can be improved.
[0139] Next, we will combine Figure 7 Describe an exemplary application of the embodiment of the present application in a practical application scenario. Figure 7 This is an architectural diagram of a method for storing routing addresses provided in an embodiment of the present application.
[0140] exist Figure 7 In the case of receiving external requests, the gateway will use the address tree to store and forward routing addresses. The address tree can adjust the fan-out value of the address tree through an adaptive algorithm. The fan-out here represents the pointer of the node pointing to the child node in the address tree. By adding a pointer, a child node corresponding to the pointer can be added. The fan-out value represents the number of child nodes of a node in the address tree. Therefore, adjusting the fan-out value here is equivalent to adjusting the number of child nodes of the node, thereby improving the space utilization of the routing dictionary tree. When registering a service, different services in each environment will be obtained according to the different environments when registering the service. For example, Figure 7 The environment one shown includes service A and service B, the environment two also includes service A and service B, and the environment three also includes service A and service B.
[0141] In addition, the storage method of the routing address provided by the embodiment of the present application can also realize dynamic caching of hot requests based on the query rate per second (QPS). Specifically, when the QPS grows to exceed the set threshold, the request and the forwarding path can be kv cached, and the next request can obtain the corresponding routing address by querying the kv cache without searching from the address tree. When the QPS drops below the threshold, the corresponding kv cache can be cleared after a period of time.
[0142] When registering routes for the same service in different environments, you can tag the route addresses of multi-environment services so that they can be forwarded to different environment services according to different environment tags during subsequent forwarding routes, thereby realizing the gateway function of multi-lane testing. Services deployed in multiple environments do not need to repeatedly deploy multiple gateways for registration, but only need to register with the same gateway and tag different environment tags.
[0143] Combine the following Figure 8 The application process of the routing address storage method provided in the embodiment of the present application in actual scenarios is introduced in detail. Figure 8 It is an implementation flow chart of the method for storing routing addresses provided in an embodiment of the present application.
[0144] exist Figure 8 In , you first need to register services in different environments, such as Figure 8 Service A (environment A) and service A (environment B) shown in the figure are registered and marked in the gateway.
[0145] In some embodiments, in response to receiving an access request to service A (environment A), a routing address corresponding to service A is queried in the address tree, where the routing address of service A includes the environment tag of environment A, and the access request is forwarded to service A of environment A, which returns the access result. If service A of environment A is a hotspot request, the correspondence between service A of environment A and the routing address of service A of environment A can be stored in the cache.
[0146] In some embodiments, in response to receiving an access request to service A (environment B), a search can be performed in the hotspot cache to determine whether there is a corresponding relationship between service A (environment B) and the routing address of service A (environment B). If not, the routing address of service A is queried from the address tree, where the routing address of service A includes the environment tag of environment B. The access request is forwarded to service A in environment B, and service A in environment B returns the access result.
[0147] When there are multiple test and development environments, it is necessary to deploy service A in environment A and environment B respectively, deploy the gateway under the test main lane, and start service A in environment A and service A in environment B respectively. The service discovery registration center registers with the gateway and configures the corresponding gateway configuration.
[0148] After completing the registration of each service, the fan-out of each node in the address tree can be adjusted to balance the query performance and memory consumption in the process of querying the routing address. Specifically, if the routing address corresponding to service A is divided into routing address A and routing address B, routing address A is stored in node 1 in the address tree, routing address B is stored in node 2 in the address tree, node 1 is the parent node of node 2, and the routing address corresponding to service B is divided into routing address A, routing address B and routing address C, then if the address tree has already stored the routing address of service A, that is, the number of child node pointers is increased for the current routing node (that is, node 1 in the above example), which reduces the time for searching the path (the higher the fan-out value, the lower the tree, the higher the query performance, and the higher the memory consumption. Conversely, the higher the tree, the lower the query performance, and the lower the memory consumption. The optimal value is selected here comprehensively).
[0149] If we consider increasing fan-out and reducing tree height, we can store routing address B and routing address C in node 3, and use node 1 as the parent node of node 3. In this case, node 1 has two child nodes, namely node 2 and node 3. If we consider reducing fan-out, we can store routing address C in node 4, and use node 2 as the parent node of node 4. In this case, node 1 has only one child node.
[0150] If an internal node has only one child node, the tree height will increase and storage space will be wasted, so the internal node and its child nodes need to be compressed. Specifically, in the address tree, if there is a parent node corresponding to a child node that has only one child node, the child node and the parent node can be merged into one node to reduce the height of the address tree.
[0151] In the address tree, if the path of service A only needs to be distinguished by one character, that is, the path can be determined by a unique identifier, then the unique identifier and the complete path of service A can be stored in a node so that the complete routing address can be found by the unique identifier when querying the routing address.
[0152] Therefore, when a large number of service paths are registered, the address tree maintains a tree data structure with high performance query and low memory consumption to save the path index information of the service. After the address tree is built, the gateway will add an environment label to the corresponding path, where the environment label can be stored in the node at the bottom of the address tree.
[0153] In actual applications, if the user selects environment A as the test lane for testing, the user initiates a test request and passes through the gateway. If it is a hot request, the relevant path is queried in the cache. If it is not a hot request, the gateway route in the address tree matches the relevant address and injects the environment label into the header of the routing address for transparent transmission (that is, the request is sent to the corresponding service). By marking the current request, it is convenient to track the request and verify the downstream service, and then forward the request result to service A in environment A to complete the request response.
[0154] If the user selects environment B as the test lane to perform another test at the same time, the request is forwarded to service A in environment B through the same process as environment A to complete the request response. The services A of the two environments are physically isolated from each other, and multiple lanes are tested simultaneously without affecting each other, and the results are returned correctly.
[0155] The core idea of the traditional address tree is to trade space for time, but the consequence is that as the string prefix increases, if the tree has many forks, the memory will increase greatly, and there is a lot of unnecessary space waste. The storage method of the routing address provided by the embodiment of the present application can greatly increase the space utilization and improve the query performance by adaptively adjusting the fan-out of each node. At the same time, the routing query performance is further increased through the automatic caching of hotspot requests and the hotspot drop cache clearing mechanism. Finally, by distinguishing the routes under multiple environments through multi-environment labels, combined with the adaptive compression dictionary tree, a set of environmental gateways completes the multi-environment service routing forwarding and the testing and traffic management requirements under multiple lanes, which is more maintainable and saves deployment costs compared to the traditional multi-environment multi-set deployment.
[0156] It is understandable that in the embodiments of the present application, related data such as user information is involved. When the embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0157] The following continues to describe an exemplary structure of the storage device 555 of the routing address provided in the embodiment of the present application being implemented as a software module. In some embodiments, such as Figure 2 As shown, the software modules stored in the storage device 555 of the routing address of the memory 550 may include:
[0158] The address segmentation module 5551 is used to segment the routing address of the second service to obtain a second address information sequence of the second service;
[0159] A sequence matching module 5552, configured to perform sequence matching between a first address information sequence of a first service and the second address information sequence, wherein the first address information sequence is stored in a first path of an address tree;
[0160] The address determination module 5553 is configured to, if the second address information sequence includes the first address information sequence and the first element, combine the first element and the address information stored in the last node of the first path into newly added address information;
[0161] The address storage module 5554 is used to add a first child node to the parent node of the last node of the first path, and store the newly added address information in the first child node.
[0162] In some embodiments, the address storage module 5554 is also used to respond to an access request for the second service, query the target address information stored in the target node included in the first path in the address tree, and the newly added address information stored in the first child node, wherein the target node is a node in the first path that does not include the last node; and concatenate the target address information and the newly added address information to obtain the routing address of the second service.
[0163] In some embodiments, the address segmentation module 5551 is also used to determine the separator included in the routing address; based on the separator, segment the routing address into multiple second address information; based on the position of the second address information in the routing address, sort the multiple second address information to obtain the second address information sequence.
[0164] In some embodiments, the address storage module 5554 is also used to merge the address information stored in the first node and the address information stored in the child node of the first node to obtain merged address information if the address tree includes a first node having a child node; use the merged address information to update the address information stored in the first node, and delete the child node of the first node.
[0165] In some embodiments, the address storage module 5554 is also used to obtain a target address information sequence corresponding to the third service from the address tree in response to the number of visits to the third service exceeding an access number threshold within a preset time period, and merge the target address information sequence into a routing address of the third service; and store the third service and the routing address of the third service in a cache.
[0166] In some embodiments, the address storage module 5554 is further used to query the routing address of the third service from the cache in response to receiving an access request to the third service, and perform access to the third service based on the routing address of the third service.
[0167] In some embodiments, the address storage module 5554 is also used to store the routing address of the third service and the unique identifier in the first leaf node if the routing address of the third service has a unique identifier, wherein the first leaf node is a child node in the address tree directly connected to the root node.
[0168] In some embodiments, the address storage module 5554 is also used to respond to a registration request for a target service of a second environment, and perform first environment marking processing on the target service of the first environment in the address tree; store the routing address of the target service of the second environment in the address tree, and perform second environment marking processing on the target service of the second environment in the address tree.
[0169] In some embodiments, the address storage module 5554 is further used to obtain a first path corresponding to the target service of the first environment from the address tree, and store a first environment label representing the first environment in the last node of the first path.
[0170] In some embodiments, the address storage module 5554 is also used to add a pointer to a second child node in the parent node of the last node of the first path, so as to store the address information stored in the last node of the first path in the second child node; and store a second environment label representing the second environment in the second child node.
[0171] In some embodiments, the address storage module 5554 is also used to respond to an access request to a target service of a target environment, query from the address tree the target routing address corresponding to the target service of the target environment and the environment tag corresponding to the target environment; write the environment tag corresponding to the target environment into the target routing address to obtain the target routing address including the environment tag; and send the access request to the target service of the target environment based on the target routing address including the environment tag.
[0172] The embodiment of the present application provides a computer program product, which includes a computer program or a computer executable instruction, and the computer program or the computer executable instruction is stored in a computer-readable storage medium. The processor of the electronic device reads the computer executable instruction from the computer-readable storage medium, and the processor executes the computer executable instruction, so that the electronic device executes the above-mentioned method for storing the routing address in the embodiment of the present application.
[0173] The present application embodiment provides a computer-readable storage medium, in which computer executable instructions or computer programs are stored. When the computer executable instructions or computer programs are executed by a processor, the processor will execute the method for storing routing addresses provided in the present application embodiment, for example, Figure 3A The storage method of the routing address is shown.
[0174] In some embodiments, the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or may be various devices including one or any combination of the above memories.
[0175] 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.
[0176] 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 storing other programs or data, such as 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 coordinated files (e.g., files storing one or more modules, subroutines, or code portions).
[0177] As an 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 at multiple sites and interconnected by a communication network.
[0178] In summary, the following beneficial effects can be achieved through the embodiments of the present application:
[0179] The routing address of the second service is segmented to obtain the second address information sequence of the second service, the first address information sequence of the first service and the second address information sequence are sequence matched, and the first address information sequence is stored in the first path of the address tree. If the second address information sequence includes the first address information sequence and the first element, the first element and the address information stored in the last node of the first path are used to form the newly added address information, and the first child node is added to the parent node of the last node of the first path, and the newly added address information is stored in the first child node. The above-mentioned first element is stored in the newly added child node, so that the second path for storing the second address information sequence is equivalent to extending one node on the basis of the first path. This method increases the tree height of the address tree, thereby reducing the subsequent query efficiency. The present application adds a pointer to the first child node in the parent node of the last node of the first path, which is equivalent to adding a child node (first child node) in the last level of the first path, and stores the newly added address information in the first child node, that is, in another child node of the parent node of the last node of the first path. In this way, by increasing the number of the last child nodes of the first path, the tree height of the address tree is reduced, thereby improving the query efficiency.
[0180] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.
Claims
1. A method for storing routing addresses, It is characterized in that The method comprises: Segmenting the routing address of the second service to obtain a second address information sequence of the second service; Sequence matching of a first address information sequence of a first service and the second address information sequence, wherein the first address information sequence is stored in a first path of an address tree; If the second address information sequence includes the first address information sequence and the first element, the first element and the address information stored in the last node of the first path are combined into newly added address information; A first child node is added to the parent node of the last node of the first path, and the newly added address information is stored in the first child node.
2. The method according to claim 1, It is characterized in that The method further comprises: In response to an access request for the second service, query the target address information stored in the target node included in the first path in the address tree, and the newly added address information stored in the first child node, wherein the target node is a node in the first path that does not include the last node; The target address information and the newly added address information are concatenated to obtain a routing address for the second service.
3. The method according to claim 1, It is characterized in that The step of segmenting the routing address of the second service to obtain a second address information sequence of the second service includes: Determining a separator included in the routing address; Based on the separator, dividing the routing address into a plurality of second address information; The plurality of second address information are sorted based on the position of the second address information in the routing address to obtain a second address information sequence.
4. The method according to claim 1, It is characterized in that The method further comprises: If the address tree includes a first node having a child node, merging the address information stored in the first node and the address information stored in the child node of the first node to obtain merged address information; The address information stored in the first node is updated using the merged address information, and the child nodes of the first node are deleted.
5. The method according to claim 1, It is characterized in that The method further comprises: In response to the number of visits to the third service exceeding an access number threshold within a preset time period, a target address information sequence corresponding to the third service is obtained from the address tree, and the target address information sequence is merged into a routing address of the third service; the third service and the routing address of the third service are stored in a cache in correspondence.
6. The method according to claim 5, It is characterized in that The method further comprises: In response to receiving an access request to the third service, querying the routing address of the third service from the cache, and performing access to the third service based on the routing address of the third service.
7. The method according to claim 1, It is characterized in that The method further comprises: If the routing address of the third service has a unique identifier, the routing address of the third service and the unique identifier are stored in a first leaf node, wherein the first leaf node is a child node directly connected to the root node in the address tree.
8. The method according to claim 1, It is characterized in that The first service is a target service of the first environment; the method further includes: In response to a registration request for a target service of a second environment, performing first environment marking processing on the target service of the first environment in the address tree; The routing address of the target service of the second environment is stored in the address tree, and the target service of the second environment is subjected to second environment tagging in the address tree.
9. The method according to claim 8, It is characterized in that The performing first environment marking processing on the target service of the first environment includes: A first path corresponding to the target service of the first environment is obtained from the address tree, and a first environment label representing the first environment is stored in the last node of the first path.
10. The method according to claim 8, It is characterized in that The storing the routing address of the target service of the second environment into the address tree comprises: Adding a pointer to a second child node in the parent node of the last node of the first path, so as to store the address information stored in the last node of the first path in the second child node; The performing second environment marking processing on the target service of the second environment in the address tree includes: A second environment tag representing the second environment is stored in the second child node.
11. The method according to claim 8, It is characterized in that The method further comprises: In response to an access request to a target service of a target environment, querying from the address tree a target routing address corresponding to the target service of the target environment and an environment tag corresponding to the target environment; Writing the environment tag corresponding to the target environment into the target routing address to obtain the target routing address including the environment tag; The access request is sent to a target service of the target environment based on the target routing address including the environment tag.
12. A storage device for a routing address, It is characterized in that The device comprises: An address segmentation module, used for segmenting the routing address of the second service to obtain a second address information sequence of the second service; A sequence matching module, configured to perform sequence matching between a first address information sequence of a first service and the second address information sequence, wherein the first address information sequence is stored in a first path of an address tree; an address determination module, configured to, if the second address information sequence includes the first address information sequence and a first element, combine the first element and the address information stored in the last node of the first path into newly added address information; The address storage module is used to add a first child node to the parent node of the last node of the first path, and store the newly added address information in the first child node.
13. An electronic device, It is characterized in that The electronic device comprises: A memory for storing computer executable instructions; A processor, configured to implement the method for storing a routing address as described in any one of claims 1 to 11 when executing computer executable instructions stored in the memory.
14. A computer-readable storage medium storing computer-executable instructions, It is characterized in that When the computer executable instructions are executed by a processor, the method for storing the routing address described in any one of claims 1 to 11 is implemented.
15. A computer program product comprising computer executable instructions, It is characterized in that When the computer executable instructions are executed by a processor, the method for storing the routing address described in any one of claims 1 to 11 is implemented.
