CN116781528A - Dynamic route management method, device, equipment and storage medium - Google Patents

Dynamic route management method, device, equipment and storage medium Download PDF

Info

Publication number
CN116781528A
CN116781528A CN202211387489.3A CN202211387489A CN116781528A CN 116781528 A CN116781528 A CN 116781528A CN 202211387489 A CN202211387489 A CN 202211387489A CN 116781528 A CN116781528 A CN 116781528A
Authority
CN
China
Prior art keywords
request
resource
gateway
key
service
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211387489.3A
Other languages
Chinese (zh)
Inventor
朱丽华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile Suzhou Software Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN202211387489.3A priority Critical patent/CN116781528A/en
Publication of CN116781528A publication Critical patent/CN116781528A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/12Discovery or management of network topologies
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/66Arrangements for connecting between networks having differing types of switching systems, e.g. gateways
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/04Processing captured monitoring data, e.g. for logfile generation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/12Shortest path evaluation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]

Abstract

The embodiment of the application discloses a dynamic route management method, a device, equipment and a storage medium, wherein the method comprises the following steps: responding to the received access request of a user, and acquiring an interface request log recorded by the gateway; the interface request log is used for representing request operation information of a user on all resources in the application system; the request operation information is a standard HTTP request method; determining key resources in the application system within a preset time period; the processing priority of the key resources is higher than that of other resources in the application system; dynamically managing the route information in the gateway according to a preset management strategy; and the gateway at least comprises dynamic routing information generated for providing the key resource access. Thereby accelerating the access speed to key resources and simultaneously reducing the service unavailability problem caused by the downstream micro-service breakdown.

Description

Dynamic route management method, device, equipment and storage medium
Technical Field
The present application relates to, but not limited to, the field of computer application technologies, and in particular, to a dynamic route management method, apparatus, device, and storage medium.
Background
The distributed application adopts a micro-service architecture mode, the application is split into a plurality of micro-service modules, and interfaces are exposed through gateway services, the design of the interfaces can adopt RESTful style design, and the interfaces in the design style are more conveniently called by an external system. When an external request arrives at the gateway, the request is forwarded to a specific micro-service module according to the routing information configured in the gateway, and a request result is finally returned to a user through a series of calling among services.
With the increase of the number of micro services, a call chain of one request can finally acquire a response result through a plurality of micro services, so that the response time of the interface is increased. Meanwhile, although the architecture mode of the micro-service avoids the defect that the single service is "pulled and moved to the whole body", the complex call relationship among the services also causes that once a certain micro-service module fails, a service fusing mechanism is triggered, the result cannot be responded normally, and the use experience of the system is affected.
Disclosure of Invention
In view of this, embodiments of the present application provide a method, apparatus, device and storage medium for dynamic route management, which at least solve the problem that the resource access speed is slow and service unavailability is easy to be caused by a breakdown of a certain micro service at the downstream.
The technical scheme of the embodiment of the application is realized as follows:
in one aspect, an embodiment of the present application provides a dynamic route management method, applied to a gateway of an application system, where the method includes:
responding to the received access request of a user, and acquiring an interface request log recorded by the gateway; the interface request log is used for representing request operation information of a user on all resources in the application system; the request operation information is a standard HTTP request method;
determining key resources in the application system within a preset time period based on the interface request log; the processing priority of the key resources is higher than that of other resources in the application system;
dynamically managing the route information in the gateway according to a preset management strategy; and the gateway at least comprises dynamic routing information generated for providing the key resource access.
In another aspect, an embodiment of the present application provides a dynamic route management device, applied to a gateway of an application system, where the device includes:
the log acquisition module is used for responding to the received access request of the user and acquiring an interface request log recorded by the gateway; the interface request log is used for representing request operation information of a user on all resources in the application system; the request operation information is a standard HTTP request method;
The resource screening module is used for determining key resources in the application system within a preset time period; the processing priority of the key resources is higher than that of other resources in the application system;
the route management module dynamically manages the route information in the gateway according to a preset management strategy; and the gateway at least comprises dynamic routing information generated for providing the key resource access.
In yet another aspect, an embodiment of the present application provides a computer device including a memory and a processor, where the memory stores a computer program executable on the processor, and where the processor implements some or all of the steps of the above method when the program is executed.
In yet another aspect, embodiments of the present application provide a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs some or all of the steps of the above-described method.
The embodiment of the application has at least the following technical effects:
in the embodiment of the application, the gateway records the interface request log, dynamically screens key resources, generates dynamic routing information in the gateway aiming at the key resources, and dynamically manages the routing information in the gateway according to a preset management strategy. Therefore, the access request reaching the gateway is directly forwarded through the dynamic routing information generated by the gateway on the key resources without calling a plurality of micro-service modules, so that the response time of an interface can be reduced, and meanwhile, the probability of failure of the micro-service modules can be reduced due to the shortened request link, and the stability of the system can be improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the aspects of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
Fig. 1 is an optional flow chart of a dynamic route management method according to an embodiment of the present application;
fig. 2 is an alternative flow chart of a dynamic route management method according to an embodiment of the present application;
fig. 3 is an alternative flow chart of a dynamic route management method according to an embodiment of the present application;
fig. 4 is a schematic diagram of a system frame of a dynamic route management method according to an embodiment of the present application;
fig. 5 is a schematic diagram of a composition structure of a dynamic route management device according to an embodiment of the present application;
fig. 6 is a schematic diagram of a hardware entity of a computer device according to an embodiment of the present application.
Detailed Description
The technical solution of the present application will be further elaborated with reference to the accompanying drawings and examples, which should not be construed as limiting the application, but all other embodiments which can be obtained by one skilled in the art without making inventive efforts are within the scope of protection of the present application.
In the following description, reference is made to "some embodiments" which describe a subset of all possible embodiments, but it is to be understood that "some embodiments" can be the same subset or different subsets of all possible embodiments and can be combined with one another without conflict.
The term "first/second/third" is merely to distinguish similar objects and does not represent a particular ordering of objects, it being understood that the "first/second/third" may be interchanged with a particular order or precedence, as allowed, to enable embodiments of the application described herein to be implemented in other than those illustrated or described herein.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing the application only and is not intended to be limiting of the application.
Before describing embodiments of the present application in further detail, the terms and terminology involved in the embodiments of the present application will be described, and the terms and terminology involved in the embodiments of the present application are suitable for the following explanation.
The back-end service of the large-scale distributed system at present mostly adopts the architecture mode of micro service, and the architecture mode of micro service is more flexible compared with the original monomer architecture mode in the development and deployment process. The conventional micro service architecture mode sets a Gateway service (Gateway) at the entrance of the system, and forwards a request to a corresponding micro service at the back end through routing information configured at the Gateway after the request arrives at the Gateway service.
Different micro-services typically have different network addresses, while external clients may need to invoke interfaces for multiple services to fulfill a business need. Such as a movie ticket purchase APP, may invoke movie classification micro-services, user micro-services, payment micro-services, etc. The micro service gateway is an intermediate layer between the client and the server, and all external requests will first pass through the micro service gateway. The micro service gateway is not responsible for processing specific services, and only has the functions of load balancing, safety protection, flow control, routing forwarding and other public basic classes.
Microservices are a design style on system architecture that advocates splitting an otherwise independent system into multiple small services that all run on separate processes, with communication collaboration between the services based on lightweight communication mechanisms such as RESTful APIs for HTTP.
RESTful (i.e., representational state transfer style) is an architectural style, a design style, whose key is to define the resources or objects in the application, and the operation on the resources can be embodied by the standard HTTP request method (get\post\delete\put). The RESTful style API interface may be designed more succinctly and hierarchically. Design specifications are also currently adopted by many micro-service applications as interfaces and these interfaces are exposed for external system calls through a gateway.
The interface exposed by the API gateway adopting RESTful design style can directly intuitively understand the function of the interface through the requested URL and the requested HTTP method. For example, we have an interface for querying product information, where the URL may be designed as/api/products, the request method is GET, and not as/api/getProducts, where the former design may indicate that the resource to be operated is products, and the specific operation is GET (query operation). And exposing the RESTful interface at the gateway, so that the caller can quickly understand the meaning of the interface, thereby improving the development speed.
Embodiments of the present application provide a dynamic route management method that may be performed by a processor of a computer device. The computer device may be a server, a notebook computer, a tablet computer, a desktop computer, a smart television, a set-top box, a mobile device (such as a mobile phone, a portable video player, a personal digital assistant, a dedicated messaging device, and a portable game device) and the like with dynamic routing management capability. Fig. 1 is an optional flowchart of a dynamic route management method according to an embodiment of the present application, as shown in fig. 1, the method includes steps S110 to S120 as follows:
Step S110, obtaining an interface request log recorded by the gateway in response to receiving an access request of a user.
The interface request log is used for representing request operation information of a user on all resources in the application system; the request operation information is a standard HTTP request method, such as a query (GET) method, a create (POST) method, a DELETE (DELETE) method, a modify (PUT) method.
The gateway is an entrance of an application system, and after the access request reaches the gateway, the access request is forwarded to a downstream micro-service module through the configured routing information in the gateway to process the specific request. Since all requests will go through the gateway, it can be used to log interface requests.
In some implementations, for each request, the interface request log can record at least one of the following information: user identification, standard HTTP request methods, URI request paths, timestamp information of the request's arrival at the gateway, the time it takes to process each request. In some embodiments, according to the URI request path of each request recorded in the interface request log and the standard HTTP request method, the corresponding relationship between the resource information and the request URI in the application system is determined and recorded in the interface request log, for example, for a resource such as book class in the image management system, including a request method such as GET, POST, PUT, DELETE, so that the resource can correspond to four request URIs.
It should be noted that, the interface exposed by the API gateway adopting RESTful design style can directly understand the function of the interface through the URL of the request and the HTTP method of the request. For example, there is an interface for querying product information, where the URL may be designed as/api/products, the request method is GET, and not as/api/getProducts, where the former design may indicate that the resource to be operated is products, and the specific operation is GET (query operation). And exposing the RESTful interface at the gateway, so that the caller can quickly understand the meaning of the interface, thereby improving the development speed.
For example, for the main resource in the book management system, namely the book class, the corresponding API gateway interface may include: GET/api/bookauthor = zhangsan query author is book information of zhangsan; creating new book information by POST/api/book (book information is input into http body); DELETE/api/bookname = bookname DELETE book information for bookname; PUT/api/bookname = bookname modifies book information with bookname.
Step S120, determining key resources in the application system within a preset time period based on the interface request log.
Here, the preset time period is a fixed time period in the past, for example, in the past one hour or one day, which is set according to the frequency of actual access, and the embodiment of the present application is not limited thereto.
The processing priority of the key resource is higher than that of other resources in the application system, such as resources with higher access frequency or resources with longer request processing time. Where Resource (Resource) is understood to be a network data object or service identified by a URI. The embodiment of the application screens the key resources, aims to add dynamic routing to the requests of the resources in the gateway, reduces the response time of the requests and improves the use experience of an application system.
Step S130, dynamically managing the route information in the gateway according to a preset management strategy.
Here, the gateway includes at least dynamic routing information generated for providing the key resource access. The client sends an access request to a gateway of an application system, the gateway receives the access request, matches information such as a request Path (Path), a request Header (Header), a request method (POST/GET) and the like according to dynamic routing information configured in the gateway, forwards the access request to a corresponding micro-service application, and the gateway realizes a core routing forwarding function according to dynamic routing rules.
Because the resource information which is accessed frequently or the resource information which takes longer time in the application system is not invariable, the dynamic route management service provided by the embodiment of the application needs to dynamically update the dynamic route information generated aiming at key resources and adopts a proper strategy to add and delete.
In some embodiments, for the selected key resource, dynamic routing information may be added to the gateway, and if a subsequent request needs to access the key resource, the subsequent request directly responds to the interface request through the dynamic routing information. In other embodiments, dynamic routing information corresponding to the key resources is dynamically added or deleted to update the routing information in the gateway.
In the embodiment of the application, the gateway records the interface request log, dynamically screens key resources, generates dynamic routing information in the gateway aiming at the key resources, and dynamically manages the routing information in the gateway according to a preset management strategy. Therefore, the access request reaching the gateway is directly forwarded through the dynamic routing information generated by the gateway on the key resources without calling a plurality of micro-service modules, so that the response time of an interface can be reduced, and meanwhile, the probability of failure of the micro-service modules can be reduced due to the shortened request link, and the stability of the system can be improved.
Fig. 2 is a schematic flowchart of an alternative method for dynamic route management according to an embodiment of the present application, as shown in fig. 2, the method includes steps S210 to S250 as follows:
step S210, responding to the received access request of the user, and acquiring an interface request log recorded by the gateway;
step S220, determining key resources in the application system within a preset time period based on the interface request log;
here, the steps S210 to S220 correspond to the steps S110 to S120, respectively, and reference may be made to the specific embodiments of the steps S110 to S120 when implemented.
Step S230, generating a fusion micro-service for providing the key resource access under the condition that the access request is a query request for the key resource;
here, the converged microservice primarily provides GET requests to the key resources externally.
In some embodiments, the step S230 may include the following steps S231 to S232:
step S231, when the access request is a non-query request for the key resource, generating a code module for the key resource by using a resource query code template;
here, the resource query code template refers to a basic operation function of a database or a persistent layer in a common query application system when the resource query code template is processed by a computer, that is, a GET request method for a heavy resource is mainly provided.
And step S232, creating the fusion micro-service corresponding to the code module in the application system through an automatic release platform.
The converged micro service is mainly used for accessing resources added into dynamic routing, and simultaneously, a piece of mirror image data which is the same as the bottom layer data in the original service is saved. The embodiment of the application automatically generates the fusion micro-service for accessing the key resources while adding the dynamic routing information of the key resources in the gateway.
It should be noted that, according to the conventional request processing manner in the micro service system, information of a resource may be queried and processed together by a plurality of micro services, and then a result is finally returned to the user. In the embodiment of the application, the process that the result can be obtained by only requesting access to a plurality of micro services is finished by automatically generating a new micro service, namely the fusion micro service, so that the fusion micro service replaces the resource inquiry function provided by a plurality of micro service modules which originally provide key category access.
Step S240, adding the dynamic route information of the fusion micro service in the gateway;
here, the dynamic routing information includes information such as an access path, an access method, and the like, through which an access request can be directly forwarded to a corresponding converged micro service.
Step S250, deleting the dynamic routing information in the gateway when the access request is a non-query request for the key resource.
Here, the non-query request refers to POST, PUT, or DELETE requests, for which the access request needs to temporarily DELETE dynamic routing information for the key resource in a routing table managed by the gateway, in addition to a micro-service that would normally be requested downstream through the gateway. Because the non-query type request may modify the information of the original resource without a corresponding modification in the mirror data, if the resource information is continuously accessed through dynamic routing, the information before the modification is likely to be obtained.
In the embodiment of the application, all interface request logs are recorded in the gateway of the application service, the key resources which are time-consuming by high-frequency access or processing in the application system are dynamically identified, the dynamic routing information aiming at the key resources is generated, the fusion micro-service for providing the key resource access is constructed, and the response speed of the interface is improved. Meanwhile, the dynamic routing information is dynamically deleted under the condition that a non-query request for key resources is subsequently received, so that the routing information in the gateway can be dynamically managed, and errors are reduced.
In some embodiments, the converged microservice caches a data image in the application system; the method further comprises the following steps S260 to S270:
step S260, in the case that the access request is a query request for the key resource, forwarding the query request to the converged micro service through the dynamic routing information;
here, when a user requests dynamic routing information generated at the gateway, the gateway will route the query request to the aggregated micro service, which directly queries the mirror data to return the result.
Step S270, the query result is obtained by accessing the data mirror image stored in the fusion micro service.
Here, since the data image is the same as the underlying data in the original application service, it can be directly acquired,
in the embodiment, the query request of the heavy point resource is directly forwarded to the generated fusion micro-service through the dynamic routing information generated by the gateway, so that the whole query request can return a user result only by one fusion micro-service, and the risks of request delay and service breakdown caused by accessing a plurality of micro-service modules are avoided.
In some embodiments, the method further comprises the steps of: and re-determining the key resources according to the fixed period, and generating a new fusion micro-service of the key resources.
Here, the fixed period is an update period set according to the time access condition, so as to realize dynamic management of dynamic routing information and corresponding fusion micro-services generated in the gateway.
In some embodiments, the interface request log includes at least one of the following information: user identification, standard HTTP request method, URI request path, resource representation of request, timestamp information of request arrival at gateway, time spent processing request; the standard HTTP request method comprises a query method, a creation method, a deletion method and a modification method; the requested resource representation is used to characterize the correspondence between resource information and request URIs in the application system. Fig. 3 is an optional flowchart of the dynamic route management method according to the embodiment of the present application, as shown in fig. 3, the step S120 of determining, based on the interface request log, key resources in the application system in a preset period of time may include the following steps S310 to S330:
Step S310, determining an access duration of each resource in the application system in the preset time period based on the URI request path, the timestamp information and the processing spending duration;
step S320, determining the number of accesses to each resource in the preset time period based on the URI request path, the timestamp information and the requested resource representation;
step S330, presetting the duty ratio of the access duration and/or presetting the duty ratio of the access frequency as the key resource in the application system.
In the above embodiment, based on the interface request log recorded by the gateway, key resources with higher access frequency or longer processing time in the application system are counted, so that micro service modules providing access to the key resources are respectively integrated, and dynamic routing information is generated in the gateway, so that the access request to the key resources can return results more quickly.
The above-described dynamic route management method is described below in connection with a specific embodiment, however, it should be noted that the specific embodiment is only for better illustrating the present application, and is not meant to be a undue limitation of the present application.
The embodiment of the application provides a dynamic route management method suitable for a gateway designed by using a RESTful style interface. For an application system designed by using a RESTful style API interface, various resource information and operations on resources involved in the application can be rapidly classified. According to the conventional request processing mode in the micro-service system, information for querying a resource may be processed together by a plurality of micro-services and then a result is returned to the user. By recording the operation logs of the user on all the resources in the gateway, the resources with more inquiry times can be dynamically identified, the micro-service modules providing the access to the resources are integrated, the routing information is dynamically generated in the gateway, the inquiry request of the resources is directly forwarded to the new routing information, the access speed to the resources is accelerated, and the service unavailability problem caused by the down-stream micro-service breakdown is reduced.
Firstly, the interface adopts a RESTful style design, main resource information and main attribute information of the resources in the application need to be positioned, the API interface mainly performs various operations on the resources in the application, and a standard HTTP request method is used for representing the operations on the resources, specifically: the GET method represents a resource object of a query server and supports the query of specific attributes of the resource; the POST method represents that a new resource object is created at a server; the DELETE method indicates that a resource object is deleted at the server; the PUT method represents modifying an existing resource object on the server.
For example, a common book management system, the main resource in the system is book class, the attribute corresponding to the main resource is information such as book name (name), author (price), price (price), etc., and the interface conforming to RESTful style of the system can be designed as follows:
GET/api/bookauthor = zhangsan query author is book information of zhangsan;
creating new book information by POST/api/book (book information is input into http body);
DELETE/api/bookname = bookname DELETE book information for bookname;
PUT/api/bookname = bookname modifies book information with bookname.
Similar scenarios are also commodity Item class in warehouse management system, personnel information Person class in personnel management system, etc.
The gateway is an entrance of an application system, and after the request reaches the gateway, the request is forwarded to a downstream micro-service module through the configured routing information in the gateway to process the specific request. Since all requests will go through the gateway, it is well suited for logging request logs of interfaces. The interface request log records mainly comprise:
1) User identification, if to the interface that needs to log in to visit, can record the relevant information of user in the gateway; if the interface is an interface which does not need login access, anonymous user identification can be uniformly recorded.
2) Standard HTTP request methods, including GET, POST, PUT, DELETE and other request methods
3) URI request paths, recording URI paths of each request.
4) The requested resource represents that the resource information and the corresponding information of the request URI in the system are pre-arranged, and note that a plurality of URIs may correspond to the same resource information. For example, as in the example scenario described above, there are four request URIs listed for the book-like resource, and similar correspondence for other resource information in the system.
5) The time stamp information of the arrival gateway is requested.
6) The time it takes to process each request is time consuming.
Fig. 4 is a schematic diagram of a system frame of a dynamic route management method according to an embodiment of the present application, as shown in fig. 4, a gateway 41 is a request entry of an application system, and after a request reaches the gateway 41, the request is forwarded to a plurality of downstream micro services 42 through route information configured in the gateway to process specific requests, such as database storage, ES storage, object storage, etc. The dynamic route management module 43 manages dynamic routes in the gateway 41 according to the interface request log recorded by the gateway 41.
When accessing a resource in the system, a result is usually required to be returned through the cooperation of a plurality of micro services, and the process that the result can be requested by the original process that the result can be obtained by accessing the plurality of micro services is completed by a new fusion micro service 44 which is automatically generated, and the fusion micro service 44 is configured with a uniform resource query code template and simultaneously caches a piece of mirror image data 45 in the original application system. When a user request arrives at the dynamic routing information generated at gateway 41, gateway 41 will route the request onto converged micro service 44 to access mirror data 45 that is the same as the underlying data in the original application service. That is, the embodiment of the present application can return the user result only by integrating the micro service 44, thereby avoiding the risks of request delay and service breakdown caused by accessing a plurality of micro service modules.
The dynamic route management module 42 manages dynamic routes in the gateway according to the interface request log recorded by the gateway. Assuming that n resources are predefined in the application (which depends on the service system itself and enumerates all resource classes related to the service system), they are respectively denoted as R 1 、R 2 、......,R n Two strategies can be devised as follows: in some embodiments, counting the class of resources that have been accessed the first 30% of the number of times in the past hour, the query requests for these resources are dynamically routed in the gateway without obtaining results by accessing the original microservice. In other embodiments, the resource categories for which the access time was last 30% of the past hour are counted, and more time-consuming requests are added to the dynamic routing of the gatewayThe time for requesting a response is reduced.
For non-query class requests (POST, PUT, and DELETE requests), such as a POST create a new resource information request, the request is sent to the dynamic route management module 42 in addition to the micro-services that would normally be requested downstream through the gateway 41. The dynamic route management module 42, upon receiving a non-query class request for a resource, temporarily deletes the route information of the resource in the route table. Because non-query-like requests may modify the information of the resource without a corresponding modification in the mirror data 45, if access to the resource information continues through dynamic routing, it is likely that the information prior to the modification will be obtained.
When accessing a resource in the system, a result is often required to be returned through the cooperation of a plurality of micro services, the concept of the fusion micro service is that the process that the original process of accessing a plurality of micro services to request to obtain the result is completed by a new micro service which is automatically generated, and the fusion micro service is configured with a uniform resource query code template and simultaneously caches a data mirror image in the original system. The detailed process of generating a converged microservice is described below:
the first step: a code module for the heavy point resource is generated by using a resource query code template (a GET request method for the resource is mainly provided in the template), and the data source is configured as a mirror image data source.
And a second step of: through an automatic release platform, a fusion micro-service of the code module generated in the first step is created in the system, and the fusion micro-service mainly provides GET requests for key resources to the outside.
And a third step of: the dynamic route management module adds the route information of the micro-service generated in the second step to the gateway, and the GET request for the specific resource is directly routed to the newly generated micro-service.
When a user requests a dynamic route generated at the gateway, the gateway routes the request to an automatically generated fusion micro-service, and the fusion micro-service directly inquires mirror image data and returns a result. The whole request can return the user result by only integrating the micro-service, thereby avoiding the request time delay and the service breakdown risk caused by accessing a plurality of micro-service modules.
The embodiment of the application records all interface request logs in the gateway of the service, dynamically identifies the resource information in the system accessed by high frequency as key resource, fuses the related micro-service modules to construct a new fused micro-service module, and dynamically adds the dynamic routing information for accessing the fused micro-service module in the gateway. If the subsequent request needs to access the key resource, the subsequent request is directly routed to the fused micro-service module to quickly respond to the interface request, and the probability of failure of the micro-service module is reduced due to the shortened request link, so that the stability of the system is improved.
And meanwhile, dynamically managing the fused micro-services, and dynamically adding and deleting the fused micro-service module. The resource information accessed by high frequency in the application system is not invariable, so the management service needs to dynamically update the fusion micro-service, and the application system adopts a proper strategy to add and delete.
The embodiment of the application has at least the following technical advantages:
on the one hand, for the API interface using RESTful style design, the resource information defined in the system and the request detailed information of the recording interface can be predetermined, and the dynamic route management module dynamically adds the route information into the gateway, so that the request for the heavy point resource can return the result more quickly.
On the other hand, after the dynamic route of the heavy-point resource is added, a micro-service module for resource access needs to be automatically generated, the micro-service module is mainly used for accessing the heavy-point resource added into the dynamic route, meanwhile, a part of mirror image data which is the same as the bottom data in the original service is stored, the request which can only obtain the result after a plurality of micro-services are originally accessed is directly accessed to the fusion micro-service module through the dynamic route, so that the mirror image data is accessed, and then the mirror image data is returned to the user.
Based on the foregoing embodiments, the embodiments of the present application provide a dynamic route management device, where the device includes each module included, and each sub-module and each unit included in each module may be implemented by a processor in a computer device; of course, the method can also be realized by a specific logic circuit; in practice, the processor may be a central processing unit (Central Processing Unit, CPU), microprocessor (Microprocessor Unit, MPU), digital signal processor (Digital Signal Processor, DSP) or field programmable gate array (Field Programmable Gate Array, FPGA), etc.
Fig. 5 is a schematic diagram of a composition structure of a dynamic route management device according to an embodiment of the present application, and as shown in fig. 5, a dynamic route management device 500 includes: a log acquisition module 510 and a route management module 520, wherein:
The log obtaining module 510 is configured to obtain an interface request log recorded by the gateway in response to receiving an access request of a user; the interface request log is used for representing request operation information of a user on all resources in the application system; the request operation information is a standard HTTP request method;
a resource screening module 520, configured to determine key resources in the application system within a preset time period; the processing priority of the key resources is higher than that of other resources in the application system;
the route management module 530 dynamically manages the route information in the gateway according to a preset management policy; and the gateway at least comprises dynamic routing information generated for providing the key resource access.
In some possible embodiments, the route management module 530 includes: generating a sub-module and a route adding sub-module; the generation sub-module is used for generating a fusion micro-service for providing the key resource access under the condition that the access request is a query request aiming at the key resource; the fusion micro-service at least comprises a query code of at least one micro-service for providing service for the key resource in the application system; and the route adding sub-module is used for adding the dynamic route information of the fusion micro-service in the gateway.
In some possible embodiments, the route management module 530 further includes a route deletion sub-module for deleting the dynamic route information in the gateway if the access request is a non-query request for the key resource.
In some possible embodiments, the interface request log includes at least one of the following information: user identification, standard HTTP request method, URI request path, resource representation of request, timestamp information of request arrival at gateway, time spent processing request; the standard HTTP request method comprises a query method, a creation method, a deletion method and a modification method; the resource representation of the request is used for representing the corresponding relation between the resource information and the request URI in the application system; the resource screening module 520 includes a first determining unit, a second determining unit, and a third determining unit, where: the first determining unit is configured to determine an access duration of each resource in the application system in the preset time period based on the URI request path, the timestamp information and the processing spending duration; the second determining unit is configured to determine, according to the URI request path, the timestamp information, and the requested resource representation, the number of access times of each resource in the preset time period; the third determining unit is configured to preset the access duration at a later time to a duty ratio, and/or use the resource with the access frequency at the earlier preset duty ratio as an important resource in the application system.
In some possible embodiments, the generating submodule includes a generating unit and a creating unit, wherein: the generating unit is used for generating a code module for the key resource by utilizing a resource query code template under the condition that the access request is a non-query request for the key resource; the creation unit is used for creating the fusion micro-service corresponding to the code module in the application system through an automatic release platform.
In some possible embodiments, the converged microservice caches a data image in the application system; the route management module further comprises: a forwarding sub-module and a query sub-module; the forwarding sub-module is used for forwarding the query request to the fusion micro-service through the dynamic routing information under the condition that the access request is the query request aiming at the key resource; and the query sub-module is used for obtaining a query result by accessing the data mirror image stored in the fusion micro-service.
In some possible embodiments, the route management module further includes an update sub-module, configured to redetermine the key resource according to a fixed period, and generate a new converged micro service of the key resource.
The description of the apparatus embodiments above is similar to that of the method embodiments above, with similar advantageous effects as the method embodiments. In some embodiments, the functions or modules included in the apparatus provided by the embodiments of the present disclosure may be used to perform the methods described in the embodiments of the methods, and for technical details that are not disclosed in the embodiments of the apparatus of the present disclosure, please refer to the description of the embodiments of the methods of the present disclosure for understanding.
It should be noted that, in the embodiment of the present application, if the above-mentioned dynamic routing management method is implemented in the form of a software functional module, and sold or used as a separate product, the dynamic routing management method may also be stored in a computer readable storage medium. Based on such understanding, the technical solution of the embodiments of the present application may be essentially or some of contributing to the related art may be embodied in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read Only Memory (ROM), a magnetic disk, an optical disk, or other various media capable of storing program codes. Thus, embodiments of the application are not limited to any specific hardware, software, or firmware, or any combination of hardware, software, and firmware.
The embodiment of the application provides a computer device, which comprises a memory and a processor, wherein the memory stores a computer program capable of running on the processor, and the processor realizes part or all of the steps in the method when executing the program.
Embodiments of the present application provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs some or all of the steps of the above-described method. The computer readable storage medium may be transitory or non-transitory.
Embodiments of the present application provide a computer program comprising computer readable code which, when run in a computer device, causes a processor in the computer device to perform some or all of the steps for carrying out the above method.
Embodiments of the present application provide a computer program product comprising a non-transitory computer-readable storage medium storing a computer program which, when read and executed by a computer, performs some or all of the steps of the above-described method. The computer program product may be realized in particular by means of hardware, software or a combination thereof. In some embodiments, the computer program product is embodied as a computer storage medium, in other embodiments the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK), or the like.
It should be noted here that: the above description of various embodiments is intended to emphasize the differences between the various embodiments, the same or similar features being referred to each other. The above description of apparatus, storage medium, computer program and computer program product embodiments is similar to that of method embodiments described above, with similar advantageous effects as the method embodiments. For technical details not disclosed in the embodiments of the apparatus, the storage medium, the computer program and the computer program product of the present application, reference should be made to the description of the embodiments of the method of the present application.
It should be noted that fig. 6 is a schematic diagram of a hardware entity of a computer device according to an embodiment of the present application, and as shown in fig. 6, the hardware entity of the computer device 600 includes: a processor 601, a communication interface 602, and a memory 603, wherein:
the processor 601 generally controls the overall operation of the computer device 600.
The communication interface 602 may enable a computer device to communicate with other terminals or servers over a network.
The memory 603 is configured to store instructions and applications executable by the processor 601, and may also cache data (e.g., image data, audio data, voice communication data, and video communication data) to be processed or processed by various modules in the processor 601 and the computer device 600, which may be implemented by a FLASH memory (FLASH) or a random access memory (Random Access Memory, RAM). Data transfer may be performed between the processor 601, the communication interface 602, and the memory 603 via the bus 604.
It should be appreciated that reference throughout this specification to "one embodiment" or "an embodiment" means that a particular feature, structure or characteristic described in connection with the embodiment is included in at least one embodiment of the present application. Thus, the appearances of the phrases "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. It should be understood that, in various embodiments of the present application, the sequence number of each step/process described above does not mean that the execution sequence of each step/process should be determined by its functions and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. The foregoing embodiment numbers of the present application are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above described device embodiments are only illustrative, e.g. the division of the units is only one logical function division, and there may be other divisions in practice, such as: multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. In addition, the various components shown or discussed may be coupled or directly coupled or communicatively coupled to each other via some interface, whether indirectly coupled or communicatively coupled to devices or units, whether electrically, mechanically, or otherwise.
The units described above as separate components may or may not be physically separate, and components shown as units may or may not be physical units; can be located in one place or distributed to a plurality of network units; some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may be separately used as one unit, or two or more units may be integrated in one unit; the integrated units may be implemented in hardware or in hardware plus software functional units.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the above method embodiments may be implemented by hardware related to program instructions, and the foregoing program may be stored in a computer readable storage medium, where the program, when executed, performs steps including the above method embodiments; and the aforementioned storage medium includes: a mobile storage device, a Read Only Memory (ROM), a magnetic disk or an optical disk, or the like, which can store program codes.
Alternatively, the above-described integrated units of the present application may be stored in a computer-readable storage medium if implemented in the form of software functional modules and sold or used as separate products. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the related art in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a removable storage device, a ROM, a magnetic disk, or an optical disk.
The foregoing is merely an embodiment of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the present application, and the changes and substitutions are intended to be covered by the scope of the present application.

Claims (10)

1. A method of dynamic route management, applied to a gateway of an application system, the method comprising:
responding to the received access request of a user, and acquiring an interface request log recorded by the gateway; the interface request log is used for representing request operation information of a user on all resources in the application system; the request operation information is a standard HTTP request method;
determining key resources in the application system within a preset time period based on the interface request log; the processing priority of the key resources is higher than that of other resources in the application system;
dynamically managing the route information in the gateway according to a preset management strategy; and the gateway at least comprises dynamic routing information generated for providing the key resource access.
2. The method of claim 1, wherein the interface request log includes at least one of the following information: user identification, standard HTTP request method, uniform resource identifier URI request path, resource representation of request, timestamp information of request arrival gateway, time spent in processing request; the standard HTTP request method comprises a query method, a creation method, a deletion method and a modification method; the resource representation of the request is used for representing the corresponding relation between the resource information and the request URI in the application system;
The determining key resources in the application system within a preset time period based on the interface request log comprises:
determining the access time length of each resource in the application system in the preset time period based on the URI request path, the timestamp information and the processing spending time length;
determining the access times of each resource in the preset time period according to the URI request path, the timestamp information and the resource representation of the request;
and presetting the duty ratio of the access duration at the back and/or presetting the resources with the duty ratio at the front of the access times as key resources in the application system.
3. The method of claim 1, wherein dynamically managing the routing information in the gateway according to a preset management policy comprises:
generating a fusion micro-service for providing the key resource access under the condition that the access request is a query request aiming at the key resource; the fusion micro-service at least comprises a query code of at least one micro-service for providing service for the key resource in the application system;
and adding the dynamic routing information of the converged micro service in the gateway.
4. The method of claim 3, wherein the dynamically managing the routing information in the gateway according to a preset management policy based on the interface request log, further comprises:
and deleting the dynamic routing information in the gateway under the condition that the access request is a non-query request for the key resource.
5. The method of claim 3, wherein the generating a converged micro service providing access to the key resource if the access request is a non-query request for the key resource comprises:
generating a code module for the key resource by utilizing a resource query code template under the condition that the access request is a non-query request for the key resource;
and creating the fusion micro-service corresponding to the code module in the application system through an automatic release platform.
6. The method of any of claims 3 to 5, wherein the converged microservice caches a data image in the application system; the method further comprises the steps of:
forwarding the query request to the converged micro service through the dynamic routing information under the condition that the access request is the query request for the key resource;
And accessing the data mirror image stored in the fusion micro-service to acquire a query result.
7. The method according to any one of claims 3 to 5, further comprising:
and re-determining the key resources according to the fixed period, and generating a new fusion micro-service of the key resources.
8. A dynamic route management device, characterized by a gateway applied to an application system, the device comprising:
the log acquisition module is used for responding to the received access request of the user and acquiring an interface request log recorded by the gateway; the interface request log is used for representing request operation information of a user on all resources in the application system; the request operation information is a standard HTTP request method;
the resource screening module is used for determining key resources in the application system within a preset time period; the processing priority of the key resources is higher than that of other resources in the application system;
the route management module dynamically manages the route information in the gateway according to a preset management strategy; and the gateway at least comprises dynamic routing information generated for providing the key resource access.
9. A computer device comprising a memory and a processor, the memory storing a computer program executable on the processor, characterized in that the processor implements the steps of the method of any of claims 1 to 7 when the program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
CN202211387489.3A 2022-11-07 2022-11-07 Dynamic route management method, device, equipment and storage medium Pending CN116781528A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211387489.3A CN116781528A (en) 2022-11-07 2022-11-07 Dynamic route management method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211387489.3A CN116781528A (en) 2022-11-07 2022-11-07 Dynamic route management method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116781528A true CN116781528A (en) 2023-09-19

Family

ID=87995142

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211387489.3A Pending CN116781528A (en) 2022-11-07 2022-11-07 Dynamic route management method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116781528A (en)

Similar Documents

Publication Publication Date Title
US9112712B2 (en) Service subscription method, system and server
CN109639636B (en) Service data forwarding method, service data processing method, service data forwarding device, service data processing device and electronic equipment
KR100989479B1 (en) An arrangement and method for providing integration of different data relating to different services in a communication network with a plurality of service providers and service enablers
US11175796B2 (en) Menu management method, server, and system
US11153362B2 (en) Network communications
US20210294804A1 (en) Configuration-aware micro-database caches
CN107103011B (en) Method and device for realizing terminal data search
US20190182341A1 (en) Global provisioning of millions of users with deployment units
EP3035216A1 (en) Cloud bursting a database
US10885036B2 (en) Obtaining incremental updates from a database using a partial query
CN109600458B (en) Website access method and device
US8352442B2 (en) Determination of an updated data source from disparate data sources
US20060112083A1 (en) Object relation information management program, method, and apparatus
CN111225018A (en) Request message processing method and device and electronic equipment
CN113821307B (en) Method, device and equipment for quickly importing virtual machine images
US11706313B2 (en) Systems, methods, and devices for user interface customization based on content data network priming
US9824227B2 (en) Simulated control of a third-party database
US20200177597A1 (en) Cross-domain authentication in a multi-entity database system
US11580152B1 (en) Using path-based indexing to access media recordings stored in a media storage service
CN116781528A (en) Dynamic route management method, device, equipment and storage medium
WO2022089321A1 (en) Method and apparatus for scheduling access point, and server and storage medium
US11526446B1 (en) Modifying caching amongst services from a history of requests and responses
CN108279924A (en) Program dissemination method and device
US20120023074A1 (en) Scalable rule-based data synchronization systems and methods
CN107222559B (en) Information calling method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination