A method for improving gateway link performance and availability
By reading data from a relational database and caching relevant service instances in the API gateway, the problems of resource shortages and request failures caused by caching irrelevant data are resolved, thereby improving the performance and availability of the microservice architecture.
Patent Information
- Application Number
- CN202211154997.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-21
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2042-09-21
Smart Images

Figure CN115499509B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of gateway services, and in particular to a method for improving gateway link performance and availability. Background Art
[0002] Service registration and service discovery are core capabilities in the microservice architecture, and the registry component that provides these capabilities has become an indispensable core component in the microservice architecture. The registry reduces the coupling between services while supporting capabilities such as high availability and service data management.
[0003] In order to avoid the delay and failure probability caused by extending the request link, the existing mainstream technical solution will cache a copy of the full service instance data of the registration center server in the registration center client integrated in each application. When a business request is made, the service instance data is directly obtained from the memory, and the target instance is selected for request forwarding after load balancing.
[0004] At present, there are technical problems such as resource shortage and frequent GC caused by caching most of the irrelevant service data, as well as batch request failures caused by physical latency issues. Summary of the invention
[0005] In response to the defects in the prior art, the present application provides a method for improving gateway link performance and availability, thereby solving the current technical problems of resource shortage and frequent GC caused by caching most of the irrelevant service data, and batch request failure caused by physical delay problems. The application achieves the technical effect of saving a lot of gateway resource consumption, alleviating resource shortage and increasing platform stability by splitting and managing gateway service data.
[0006] On the one hand, the present application provides a method for improving gateway link performance and availability, the method comprising: starting an API gateway, reading data from a relational database and initializing it, and building a website server; collecting routing data and service data based on the front end of the website server, and storing the routing data and the service data in the relational database; when the relational database receives the service data, obtaining a service data list according to the service data; connecting to a registration center to perform data consistency interaction on the service data list, and outputting a service instance list, wherein the service instance list is stored in a memory; obtaining a real-time request from a website user, sending the real-time request to the API gateway, connecting to the service through the routing data, and obtaining the address of a target service instance; forwarding the address of the target service instance to a backend service instance, querying the service instance list for connection, and obtaining an instance response result; sending the instance response result to the API gateway for anomaly detection, and when the detection result is that the connection is normal, sending the instance response result to the website user.
[0007] On the other hand, the present application also provides a system for improving gateway link performance and availability, the system comprising: a gateway startup module, used to start the API gateway, read data from a relational database and initialize, and build a website server; a data reading module, used to collect routing data and service data based on the front end of the website server, and store the routing data and the service data in the relational database; a list generation module, used to obtain a service data list according to the service data when the relational database receives the service data; a data interaction module, used to connect to the registration center to perform data consistency interaction on the service data list, and output a service instance list, wherein the service instance list is stored in the memory; an instance request module, used to obtain a real-time request from a website user, send the real-time request to the API gateway, connect to the service through the routing data, and obtain the address of the target service instance; an instance connection response module, used to forward the address of the target service instance to the backend service instance, query the service instance list for connection, and obtain an instance response result; an instance abnormality inspection module, used to send the instance response result to the API gateway for abnormality inspection, and when the inspection result is that the connection is normal, send the instance response result to the website user.
[0008] In a third aspect, the present invention also provides a system for batch processing and monitoring of large files, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in the first aspect when executing the program.
[0009] A fourth aspect is an electronic device, comprising a processor and a memory;
[0010] The memory is used for storing;
[0011] The processor is used to execute any one of the methods in the first aspect by calling.
[0012] In a fifth aspect, a computer program product comprises a computer program and / or instructions, which, when executed by a processor, implement the steps of any one of the methods described in the first aspect.
[0013] The method for improving gateway link performance and availability proposed in this application has the following technical effects:
[0014] Since the API gateway is started, and data is read from the relational database and initialized, the routing data and service data are collected from the built website server front end, and the routing data and the service data are stored in the relational database, the subsequent data call can also be realized by flashing the storage memory. Furthermore, after the service data is stored, the service data list is stored, and the data consistency interaction with the registration center is maintained through this list. The service instance list is stored in the memory. After the user initiates a request to the API gateway, the service is found according to the route, and then the service instance address is found from the memory for forwarding. The request is forwarded to the back-end service instance. After processing, the back-end service instance returns the response to the API gateway. The API gateway determines whether the response is normal. If it is a connection exception and needs to be processed by the exception protection strategy, the API gateway returns the response to the user to complete this request. The technical effect of splitting the gateway service data, saving a lot of gateway resource consumption, alleviating resource tension and increasing the stability of the platform is achieved.
[0015] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0017] Figure 1 A flowchart of a method for improving gateway link performance and availability according to an embodiment of the present application;
[0018] Figure 2 A flowchart of an example abnormality check of a method for improving gateway link performance and availability according to an embodiment of the present application;
[0019] Figure 3 A schematic diagram of a process flow of service splitting management of a method for improving gateway link performance and availability according to an embodiment of the present application;
[0020] Figure 4 A schematic diagram of the structure of a system for improving gateway link performance and availability according to an embodiment of the present application;
[0021] Figure 5 This is a schematic diagram of the structure of an electronic device in an embodiment of the present application.
[0022] Explanation of the accompanying drawings: gateway startup module 11, data reading module 12, list generation module 13, data interaction module 14, instance request module 15, instance connection response module 16, instance anomaly detection module 17, bus 300, receiver 301, processor 302, transmitter 303, memory 304, bus interface 305.
[0023] The exemplary embodiments of the present application will be described in detail in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application, and it should be understood that the present application is not limited to the exemplary embodiments described here. DETAILED DESCRIPTION
[0024] Embodiment 1
[0025] like Figure 1 As shown, an embodiment of the present application provides a method for improving gateway link performance and availability, the method comprising:
[0026] Step S100: Start the API gateway, read and initialize data from the relational database, and build a website server;
[0027] At present, when there are too many instance data registered to the server and the metadata information carried by the instance is redundant, the client needs to cache a considerable number of irrelevant service instances locally. This part of data needs to be updated every time it is refreshed, but it is not used at all when processing business request forwarding, which is a huge waste of resources. And if this part of the memory occupancy is too large, it will also cause frequent GC and other problems, causing more unpredictable internal exceptions and causing resource shortages. Therefore, a gateway link performance and availability improvement method is proposed to reduce the number of cached services (only cache related services) to reduce memory usage and alleviate resource shortages. At the same time, because resources are alleviated, frequent GC problems will also be improved, and throughput will be improved. When a service instance has three consecutive connection exceptions, it is considered that the instance has been offline and the instance is removed from the memory to avoid avalanches such as continuous failures.
[0028] The embodiment of the present application includes four components: API gateway, Nacos registration center, MySQL database, and backend service instance. The data of API gateway is persistently stored in MySQL database. When processing north-south traffic, it relies on obtaining the service instance address from Nacos registration center, and finally forwards the traffic to the backend service instance to complete a business request.
[0029] Therefore, by starting the API gateway, reading data from the Mysql database (relational database) and performing initialization operations, we further build and start the website server based on this, share service capabilities through a unified API gateway, provide the ability to publish, manage, protect and monitor APIs, and achieve cross-system and cross-protocol service capability interoperability, thereby building a real-time network environment to facilitate the execution of subsequent steps.
[0030] Step S200: collecting routing data and service data based on the front end of the website server, and storing the routing data and the service data in the relational database;
[0031] Step S300: when the relational database receives the service data, a service data list is obtained according to the service data;
[0032] Furthermore, step S300 of the embodiment of the present application further includes:
[0033] Step S310: Obtain a related service data list according to the service data list, wherein the related service data list is based on the service data corresponding to the related service, and the service data list is a minimum condition set for querying service instance details with the server of the registration center.
[0034] Specifically, based on the collection of routing data and service data by the front end of the website server, the page or content corresponding to the routing is handed over to the front end for execution. Generally speaking, application services are services provided by the business side. The microservice architecture ensures the stable and continuous operation of business services and provides functional interfaces closely related to the business to support the normal operation of the business. On the other hand, the routing data and the service data are stored in the relational database and then refreshed into the memory to provide routing forwarding, service caching and other functions. Furthermore, after obtaining the service data, the service data list is stored. Among them, the service data list is the service data that is highly correlated with itself, which can save resources and reduce throughput.
[0035] Furthermore, the service data list performs related service analysis to obtain a related service list, which is maintained according to the gateway's own operations of adding and deleting service data. The service data list here refers to the minimum set of conditions for querying service instance details at the registration center server.
[0036] Step S400: connecting to the registration center to perform data consistency interaction on the service data list and outputting a service instance list, wherein the service instance list is stored in the memory;
[0037] Further, such as Figure 3 As shown, step S400 of the embodiment of the present application also includes:
[0038] Step S410: Obtain the interaction process between the API gateway and the registration center;
[0039] Step S420: analyzing the correlation between the interaction process and the gateway link performance to obtain an interaction correlation set;
[0040] Step S430: Filtering N interaction processes having a correlation greater than or equal to a preset correlation from the interaction correlation set;
[0041] Step S440: Using the N interaction processes, all services in the API gateway are managed by splitting them into related services and irrelevant services.
[0042] Furthermore, step S400 in the embodiment of the present application further includes:
[0043] Step S450: Connecting to the registration center and configuring a preset timing period;
[0044] Step S451: The server of the registration center performs a timed query on the input service data list according to the preset time period to obtain the service instance list.
[0045] Specifically, the registration center includes a client and a server. The registration center client is a registration center component that is generally a C / S architecture. The client is usually integrated by the business application itself and is used to interact with the server, including service registration, service heartbeat maintenance, service data synchronization and other capabilities; the registration center server is a registration center component that is generally a C / S architecture. The server is deployed separately (supporting high availability and disaster recovery capabilities) and provides service registration, service instance data management and other functions to business services and microservice components. The registration center reduces the coupling between services and supports high availability and service data management capabilities.
[0046] Connect to the registration center. Since a large number of service instances are stored in the client of the registration center and data is retrieved through the API gateway, a large amount of cached service instance data can easily cause system resource redundancy. Therefore, load balancing is taken as the goal, correlation analysis is performed, and only related services are cached, which reduces memory usage and alleviates resource shortages. Furthermore, the service instance list is queried regularly at the registration center server according to the service data list, rather than pulling all service instance local caches at once, reducing network, memory and other resource losses.
[0047] By analyzing the correlation that affects the performance of the gateway link, the process of caching only related services is as follows: obtaining the interaction process between the API gateway and the registration center, and further analyzing the correlation between the interaction process and the gateway link performance, identifying the interaction process that affects the correlation of the gateway link performance, obtaining the process with greater correlation, and realizing service instance transmission between each interaction process, and further splitting the service instances cached by the system according to their own correlation, obtaining related services and irrelevant services, and caching related services on the registration center client, so as to improve the frequent GC problem and increase throughput.
[0048] Step S500: obtaining a real-time request from a website user, sending the real-time request to the API gateway, and obtaining the address of a target service instance through the routing data connection service;
[0049] Step S600: forwarding the address of the target service instance to the backend service instance, querying the service instance list for connection, and obtaining the instance response result;
[0050] Specifically, the real-time request of the website user is obtained, wherein the real-time request is used to call the relevant service instance, that is, the real-time request information includes the target service instance. Therefore, according to the real-time request, the API gateway is used as a condition, and the routing data stored in the memory is used to connect to obtain the address of the target service instance, so that after the back-end service instance receives the address of the target service instance, it can connect and obtain the instance, thereby obtaining the response result of the instance. In other words, after the user initiates a request and reaches the API gateway, the service is found according to the route, and then the service instance address is found in the memory for forwarding, and the request is forwarded to the back-end service instance. After processing, the back-end service instance returns the response to the API gateway.
[0051] Step S700: Send the instance response result to the API gateway for abnormality detection. When the detection result shows that the connection is normal, send the instance response result to the website user.
[0052] Further, such as Figure 2 As shown, step S700 of the embodiment of the present application also includes:
[0053] Step S710: sending the instance response result to the API gateway, wherein the API gateway includes an instance anomaly detection module;
[0054] Step S720: judging whether the instance response result is a connection abnormality according to the instance abnormality detection module, and obtaining an abnormality detection result, wherein the abnormality detection result includes a normal connection and an abnormal connection;
[0055] Step S730: If the abnormality check result is a connection abnormality, the target service instance is processed.
[0056] Specifically, after obtaining the instance response result, it is necessary to further analyze the instance response result. If the instance response result is a response failure caused by instance unavailability, it is necessary to further perform an exception analysis to determine the status of the instance response result, so as to take different means and measures to resolve this abnormal situation. When the service scales up or down the instance, the instance list cached by the client cannot recognize the instance changes in real time, and still uses the old instance data for load balancing and forwarding requests. Scaling up will cause the newly added instance to have no business traffic access for a period of time, while scaling down will cause all business requests during this period to fail. Therefore, regardless of whether the instance is unavailable due to service scaling down or instance abnormality, an exception recovery is required. That is, to prevent occasional connection timeouts or connection rejections due to network fluctuations, which may cause failures to connect to the same instance.
[0057] Therefore, the main process is as follows: first, the instance response result is sent to the API gateway, and the API gateway includes an instance exception detection module, through which it is determined whether the instance response result is a connection exception, wherein the connection exception is determined to be an unavailable instance after judgment, and measures are taken to process the target service instance.
[0058] Furthermore, step S730 of the embodiment of the present application further includes:
[0059] Step S731: if the abnormality check result is a connection abnormality, obtain an instance identification instruction;
[0060] Step S732: marking the target service instance for abnormality according to the instance identification instruction, and obtaining an instance removal instruction after successful identification;
[0061] Step S733: Send the instance removal instruction to the processor in the memory to remove the target service instance.
[0062] Furthermore, step S720 of the embodiment of the present application further includes:
[0063] Step S721: analyzing the instance response result according to the abnormality check condition, and obtaining a refresh instruction if the instance response result is a connection failure;
[0064] Step S722: Obtain a secondary instance response result according to the refresh instruction. If the secondary instance response result is a connection failure, obtain a secondary refresh instruction.
[0065] Step S723: according to the secondary refresh instruction, three instance response results are obtained. If the three instance response results are connection failures, a connection abnormality inspection result is output.
[0066] Specifically, if the abnormality inspection result of the instance abnormality inspection module shows that the connection is abnormal, the instance needs to be marked, so that the instance can be identified based on the marked information to remove the target service instance. Further, the instance is removed from the memory and the traffic is forwarded to other healthy instances that respond normally. After being removed, the abnormal instance may be manually pulled up or self-recovered to a normal state. Therefore, it can still be synchronized from the registration center server through the next data synchronization to continue forwarding.
[0067] Furthermore, the process of the instance exception detection module mainly adopts an exception protection strategy, with three responses and abnormal status as the judgment condition for whether the connection is abnormal or not. When the first instance response is a connection failure, a refresh instruction is obtained to obtain a secondary instance response result. If the corresponding secondary instance response result is a connection failure, a secondary refresh is obtained to obtain three instance response results. If the three instance response results are connection failures, the inspection result output by the instance exception detection module is a connection exception. Therefore, when a service instance has three consecutive connection exceptions, it is considered that the instance has been offline, ensuring that the API gateway will not cause platform avalanche and other problems that seriously affect the request success rate due to the inability to perceive instance exceptions in real time, thereby improving system throughput and request success rate.
[0068] In combination with the above embodiments, the present invention has the following beneficial effects:
[0069] Since the API gateway is started, and data is read from the relational database and initialized, the routing data and service data are collected from the built website server front end, and the routing data and the service data are stored in the relational database, the subsequent data call can also be realized by flashing the storage memory. Furthermore, after the service data is stored, the service data list is stored, and the data consistency interaction with the registration center is maintained through this list. The service instance list is stored in the memory. After the user initiates a request to the API gateway, the service is found according to the route, and then the service instance address is found from the memory for forwarding. The request is forwarded to the back-end service instance. After processing, the back-end service instance returns the response to the API gateway. The API gateway determines whether the response is normal. If it is a connection exception and needs to be processed by the exception protection strategy, the API gateway returns the response to the user to complete this request. The technical effect of splitting the gateway service data, saving a lot of gateway resource consumption, alleviating resource tension and increasing the stability of the platform is achieved.
[0070] The method adopts the method of analyzing the correlation that affects the performance of the gateway link, caching only related services, splitting the service instances cached by the system according to their own correlation, obtaining related services and irrelevant services, and caching related services in the registration center client, so as to improve the frequent GC problem and improve the throughput.
[0071] Embodiment 2
[0072] Based on the same inventive concept as the method for improving gateway link performance and availability in the aforementioned embodiment, the present invention also provides a system for improving gateway link performance and availability, such as Figure 4 As shown, the system comprises:
[0073] The gateway startup module 11 is used to start the API gateway, read data from the relational database and initialize it, and build a website server;
[0074] A data reading module 12, used for collecting routing data and service data based on the website server front end, and storing the routing data and the service data in the relational database;
[0075] A list generating module 13, configured to obtain a service data list according to the service data when the relational database receives the service data;
[0076] The data interaction module 14 is used to connect to the registration center to perform data consistency interaction on the service data list and output a service instance list, wherein the service instance list is stored in the memory;
[0077] The instance request module 15 is used to obtain the real-time request of the website user, send the real-time request to the API gateway, and obtain the address of the target service instance through the routing data connection service;
[0078] An instance connection response module 16 is used to forward the address of the target service instance to the backend service instance, query the service instance list for connection, and obtain an instance response result;
[0079] The instance anomaly detection module 17 is used to send the instance response result to the API gateway for anomaly detection. When the detection result shows that the connection is normal, the instance response result is sent to the website user.
[0080] Furthermore, the system also includes:
[0081] An instance verification sending unit, configured to send the instance response result to the API gateway, wherein the API gateway includes an instance anomaly verification module;
[0082] A connection judgment unit, configured to judge whether the instance response result is a connection abnormality according to the instance abnormality detection module, and obtain an abnormality detection result, wherein the abnormality detection result includes a normal connection and an abnormal connection;
[0083] The instance processing unit is used to process the target service instance if the abnormality check result is a connection abnormality.
[0084] Furthermore, the system also includes:
[0085] An instance status analysis unit, configured to obtain an instance identification instruction if the abnormality check result is a connection abnormality;
[0086] An instance abnormality identification unit, used to identify the abnormality of the target service instance according to the instance identification instruction, and obtain an instance removal instruction after successful identification;
[0087] The instance culling processing unit is used to send the instance culling instruction to the processor in the memory to perform culling processing on the target service instance.
[0088] Furthermore, the system also includes:
[0089] an abnormal connection judgment unit, configured to analyze the instance response result according to the abnormal inspection condition, and obtain a refresh instruction if the instance response result is a connection failure;
[0090] A secondary refresh unit, configured to obtain a secondary instance response result according to the refresh instruction, and if the secondary instance response result is a connection failure, obtain a secondary refresh instruction;
[0091] The verification result output unit is used to obtain three instance response results according to the secondary refresh instruction, and if the three instance response results are connection failures, output a connection abnormality verification result.
[0092] Furthermore, the system also includes:
[0093] An interaction process acquisition unit, used to acquire the interaction process between the API gateway and the registration center;
[0094] A correlation analysis unit, used to analyze the correlation between the interaction process and the gateway link performance to obtain an interaction correlation set;
[0095] A process screening unit, used to screen N interaction processes having a correlation greater than or equal to a preset correlation from the interaction correlation set;
[0096] The service splitting management unit is used to perform relevant splitting management on all services in the API gateway, including relevant services and irrelevant services, based on the N interaction processes.
[0097] Furthermore, the system also includes:
[0098] A timing configuration unit, used to connect to the registration center and configure a preset timing period;
[0099] The timing query unit is used for the server of the registration center to perform a timing query on the input service data list according to the preset timing period to obtain the service instance list.
[0100] Those of ordinary skill in the art can appreciate that the devices and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, or a combination of computer software and electronic hardware. The above embodiments are only specific implementations of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or replacements within the technical scope disclosed by the present invention, which should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
[0101] Exemplary Electronic Devices
[0102] Reference below Figure 5 The electronic device of the present invention will be described.
[0103] Figure 5 The figure shows a schematic structural diagram of an electronic device according to the present invention.
[0104] Based on the inventive concept of a scheduling resource management method based on batch program analysis in the aforementioned embodiment, the present invention also provides a scheduling resource management system based on batch program analysis, on which a computer program is stored, and when the program is executed by a processor, the steps of any method of the aforementioned method for batch processing and monitoring of large files are implemented.
[0105] Among them, Figure 5 In the embodiment of the present invention, a bus architecture (represented by bus 300) is shown, which may include any number of interconnected buses and bridges, and bus 300 links various circuits including one or more processors represented by processor 302 and memory represented by memory 304. Bus 300 may also link various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are not further described herein. Bus interface 305 provides an interface between bus 300 and receiver 301 and transmitter 303. Receiver 301 and transmitter 303 may be the same element, namely a transceiver, which provides a unit for communicating with various other devices over a transmission medium.
[0106] The processor 302 is responsible for managing the bus 300 and general processing, while the memory 304 may be used to store data used by the processor 302 when performing operations.
[0107] The present invention provides a method for improving gateway link performance and availability, the method comprising: starting an API gateway, reading data from a relational database and initializing it, and building a website server; collecting routing data and service data based on the front end of the website server, and storing the routing data and the service data in the relational database; when the relational database receives the service data, obtaining a service data list according to the service data; connecting to a registration center to perform data consistency interaction on the service data list, and outputting a service instance list, wherein the service instance list is stored in a memory; obtaining a real-time request of a website user, sending the real-time request to the API gateway, connecting to a service through the routing data, and obtaining an address of a target service instance; forwarding the address of the target service instance to a backend service instance, querying the service instance list for connection, and obtaining an instance response result; sending the instance response result to the API gateway for abnormality inspection, and when the inspection result shows that the connection is normal, sending the instance response result to the website user. It solves the current technical problems of resource shortage and frequent GC caused by caching most of the irrelevant service data, as well as batch request failures caused by physical delay problems. It achieves the technical effect of saving a lot of gateway resource consumption, alleviating resource shortage and increasing platform stability by splitting and managing gateway service data.
[0108] The present invention also provides an electronic device, which includes a processor and a memory;
[0109] The memory is used for storing;
[0110] The processor is used to execute any one of the methods in the above-mentioned embodiment 1 by calling.
[0111] The present invention also provides a computer program product, including a computer program and / or instructions, which, when executed by a processor, implement the steps of the method described in any one of the above-mentioned embodiments.
[0112] It should be understood by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the present invention may adopt the form of a complete software embodiment, a complete hardware embodiment, or a combination of software and hardware embodiments. In addition, the present invention is in the form of a computer program product that can be implemented on one or more computer-usable storage media containing computer-usable program codes. The computer-usable storage medium includes, but is not limited to, various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), disk memories, compact disc read-only memories (CD-ROM), optical memories, etc.
[0113] The present invention is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A system that specifies the functions of a box or multiple boxes.
[0114] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction system, which is implemented in the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0115] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they understand the basic creative concepts.
[0116] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention belong to the scope of the present invention and its equivalent technologies, the present invention is also intended to include these changes and variations.
Claims
1. A method for improving gateway link performance and availability, characterized in that: The method comprises: Start the API gateway, read and initialize data from the relational database, and build the website server; Collecting routing data and service data based on the website server front end, and storing the routing data and the service data in the relational database; When the relational database receives the service data, a service data list is obtained according to the service data; Connecting to the registration center to perform data consistency interaction on the service data list and outputting a service instance list, wherein the service instance list is stored in the memory; Obtaining a real-time request from a website user, sending the real-time request to the API gateway, and obtaining the address of a target service instance through the routing data connection service; Forward the address of the target service instance to the backend service instance, query the service instance list to connect, and obtain the instance response result; Sending the instance response result to the API gateway for abnormality inspection, and when the inspection result shows that the connection is normal, sending the instance response result to the website user; The method further comprises: Obtain the interaction process between the API gateway and the registration center; Analyzing the correlation between the interaction process and the gateway link performance to obtain an interaction correlation set; Filtering N interaction processes having a correlation greater than or equal to a preset correlation from the interaction correlation set; Based on the N interaction processes, all services in the API gateway are managed by splitting them, including related services and irrelevant services; Obtaining a service data list using the service data, the method further includes: According to the service data list, a related service data list is obtained, wherein the related service data list is based on the service data corresponding to the related service, and the service data list is a minimum condition set for querying service instance details with the server of the registration center.
2. The method according to claim 1, characterized in that The method further comprises: Sending the instance response result to the API gateway, wherein the API gateway includes an instance anomaly detection module; According to the instance abnormality detection module, determine whether the instance response result is a connection abnormality, and obtain an abnormality detection result, wherein the abnormality detection result includes a normal connection and an abnormal connection; If the abnormality check result is a connection abnormality, the target service instance is processed.
3. The method according to claim 2, characterized in that If the abnormality check result is a connection abnormality, processing the target service instance, the method further includes: If the abnormality check result is a connection abnormality, obtain an instance identification instruction; According to the instance identification instruction, the target service instance is marked as abnormal, and after the identification is successful, an instance removal instruction is obtained; The instance removal instruction is sent to the processor of the memory to remove the target service instance.
4. The method according to claim 2, characterized in that The instance anomaly detection module includes an anomaly detection condition, and the method further includes: Analyze the instance response result according to the abnormality check condition, and if the instance response result is a connection failure, obtain a refresh instruction; According to the refresh instruction, a secondary instance response result is obtained, and if the secondary instance response result is a connection failure, a secondary refresh instruction is obtained; According to the secondary refresh instruction, three instance response results are obtained. If the three instance response results are connection failures, a connection abnormality inspection result is output.
5. The method according to claim 1, characterized in that The method further comprises: Connecting to the registration center and configuring a preset timing period; The server of the registration center performs a regular query on the input service data list according to the preset timing period to obtain the service instance list.
6. A system for improving gateway link performance and availability, characterized in that: The system comprises: The gateway startup module is used to start the API gateway, read data from the relational database and initialize it, and build the website server; A data reading module, used for collecting routing data and service data based on the website server front end, and storing the routing data and the service data in the relational database; A list generating module, configured to obtain a service data list according to the service data when the relational database receives the service data; A data interaction module, used to connect to the registration center to perform data consistency interaction on the service data list and output a service instance list, wherein the service instance list is stored in the memory; An instance request module is used to obtain a real-time request from a website user, send the real-time request to the API gateway, and obtain the address of a target service instance through the routing data connection service; An instance connection response module is used to forward the address of the target service instance to the backend service instance, query the service instance list for connection, and obtain the instance response result; An instance anomaly detection module is used to send the instance response result to the API gateway for anomaly detection, and when the detection result shows that the connection is normal, send the instance response result to the website user; The system further comprises: Obtain the interaction process between the API gateway and the registration center; Analyzing the correlation between the interaction process and the gateway link performance to obtain an interaction correlation set; Filtering N interaction processes having a correlation greater than or equal to a preset correlation from the interaction correlation set; Based on the N interaction processes, all services in the API gateway are managed by splitting them, including related services and irrelevant services; The service data list is obtained by using the service data, and the system further comprises: According to the service data list, a related service data list is obtained, wherein the related service data list is based on the service data corresponding to the related service, and the service data list is a minimum condition set for querying service instance details with the server of the registration center.
7. An electronic device, characterized in that: including a processor and a memory; The memory is used for storing; The processor is used to execute the method according to any one of claims 1 to 5 by calling.
8. A computer program product comprising a computer program and / or instructions, characterized in that: When the computer program and / or the instructions are executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
