CN116708527A - Self-adaptive API gateway fusing method, device and medium - Google Patents

Self-adaptive API gateway fusing method, device and medium Download PDF

Info

Publication number
CN116708527A
CN116708527A CN202310856776.2A CN202310856776A CN116708527A CN 116708527 A CN116708527 A CN 116708527A CN 202310856776 A CN202310856776 A CN 202310856776A CN 116708527 A CN116708527 A CN 116708527A
Authority
CN
China
Prior art keywords
fusing
request
rate
amount data
api gateway
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
CN202310856776.2A
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.)
Shanghai Pudong Development Bank Co Ltd
Original Assignee
Shanghai Pudong Development Bank 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 Shanghai Pudong Development Bank Co Ltd filed Critical Shanghai Pudong Development Bank Co Ltd
Priority to CN202310856776.2A priority Critical patent/CN116708527A/en
Publication of CN116708527A publication Critical patent/CN116708527A/en
Pending legal-status Critical Current

Links

Classifications

    • 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/1396Protocols specially adapted for monitoring users' activity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/143Termination or inactivation of sessions, e.g. event-controlled end of session
    • H04L67/145Termination or inactivation of sessions, e.g. event-controlled end of session avoiding end of session, e.g. keep-alive, heartbeats, resumption message or wake-up for inactive or interrupted session

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention relates to a self-adaptive API gateway fusing method, equipment and medium, wherein the method is applied to an API gateway and comprises the following steps: initializing a fusing rate; acquiring an access request, determining whether to release or not according to the current fusing rate, if not, triggering fusing, refusing the access request and ending, and if so, updating the total request amount data and releasing the request; judging whether the released request is successfully processed, if so, updating the successfully processed request quantity data; and adaptively updating the fusing rate based on the total request amount data and the successfully processed request amount data. Compared with the prior art, the method has the advantages of high service quality and the like.

Description

Self-adaptive API gateway fusing method, device and medium
Technical Field
The present invention relates to the field of information technologies, and in particular, to a method, an apparatus, and a medium for fusing an API gateway.
Background
The existing fusing scheme of the API gateway is mainly based on manual judgment of service quality, and the fusing of an API gateway system or an automatic fusing strategy realized based on a micro-service fuse is realized in a manual start-stop mode, and a Close/Open/HalfOpen three-section interception mechanism is set according to a service state, so that the method has the following defects:
the manual start-stop mode is as follows: 1. monitoring alarm service abnormality by a monitoring mechanism occupies service resources 2. Relying on manual operation, labor is consumed, and timeliness of problem processing is poor.
Automatic fusing strategy based on micro-service fuse implementation: the open state intercepts all requests, so that when the server resource waste 2 HalfOpen state switches the Close state, all requests are released, and the back-end service is possibly flushed again 3. The service checking round-robin time is fixed, and the multi-service scene requirement is difficult to meet.
Chinese patent application number CN202110769964.2 discloses a method for implementing dynamic current limiting of intelligent gateway, comprising: starting an intelligent gateway, receiving a service request, and loading configuration information of the cache intelligent gateway into a memory; automatically refreshing the memory cache, and simultaneously recalculating the expiration time of the cache; reading configuration information; performing black-and-white list verification, performing login verification and authority verification, obtaining a request body rewriting mapping rule from a long-term cache, and performing request body rewriting; performing intelligent gateway distributed cluster current limiting control, configuring the local current limiting size of a gateway, and returning a current limiting response code when the flow is overlarge; performing local fusing control; and forwarding the service request to the intelligent gateway cluster, processing the request, and realizing load balancing.
The application provides an intelligent gateway implementation method with distributed deployment, high availability and high concurrency capability, so that the fault tolerance rate of communication abnormality is increased, but the application uses token to check according to a request method and a path, and self-adaptive fusing is not realized.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provide a self-adaptive API gateway fusing method, equipment and medium, which are used for adaptively updating the fusing rate based on total request data and successfully processed request data and realizing the self-adaptive fusing of the API gateway.
The aim of the invention can be achieved by the following technical scheme:
in one aspect of the present invention, an adaptive API gateway fusing method is provided, applied to an API gateway, the fusing method includes the following steps:
initializing a fusing rate;
acquiring an access request, determining whether to release or not according to the current fusing rate, if not, triggering fusing, refusing the access request and ending, and if so, updating the total request amount data and releasing the request;
judging whether the released request is successfully processed, if so, updating the successfully processed request quantity data;
and adaptively updating the fusing rate based on the total request amount data and the successfully processed request amount data.
As a preferable technical scheme, the fusing rate is inversely proportional to a request successful processing proportion, and the request successful processing proportion is a ratio of the successful processing request amount data to the total request amount data.
As a preferable technical scheme, the fusing rate is updated by adopting the following formula:
wherein rate is the fusing rate, max () is a maximum function, requests are total request data, accept is successful processing request data, and K is a fusing coefficient.
As a preferable technical scheme, the fusing coefficient is a preset constant.
As a preferable technical scheme, when the fusing rate is larger than a preset value, an alarm signal is sent out.
As a preferable technical scheme, before the access request is acquired, setting initial values of the total request amount data and the successful processing request amount data according to a service scene.
As a preferable technical scheme, when a preset updating rule is met, updating the fusing rate based on the total request amount data and the successful processing request amount data.
Preferably, the updating rule comprises that the interval time is larger than a preset value and/or
The increase in total requested amount data since the last update is greater than a preset value and/or
Before determining whether to release the request.
In another aspect of the present invention, there is provided an electronic apparatus including: one or more processors and a memory, wherein the memory stores one or more programs, and the one or more programs comprise instructions for executing the adaptive API gateway fusing method.
In another aspect of the invention, a computer-readable storage medium is provided that includes one or more programs for execution by one or more processors of an electronic device, the one or more programs including instructions for performing the adaptive API gateway fusing method described above.
Compared with the prior art, the invention has the following advantages:
(1) Realize self-adaptation fusing: the prior art is different from the prior art in that the prior art is mostly provided with manual fusing or fusing through a micro-service fuse, the method records total access data and successfully processes request data when acquiring and processing the access request, and adaptively updates the fusing rate, so that the self-adaptive fusing of an API gateway is realized, and the method is different from the problems that only Open, halfOpen and Close states of the prior micro-service fuse easily cause resource waste and back end collapse, and can dynamically and adaptively adjust the fusing rate and improve the service quality.
(2) Fuse state switching smoothing: and dynamically controlling the fusing rate, increasing the successful request quantity along with the recovery of abnormal services, naturally reducing the fusing rate, and smoothly rising the release request, thereby avoiding secondary service fusing caused by instantaneous closing of the fusing state.
(3) Switching the fusing state in real time: by adopting the self-adaptive fusing method, the time-round-robin-based fusing state switching in the prior art is abandoned, the real-time switching of the fusing state is realized, and the access request is timely accessed after the service is recovered to be normal.
Drawings
FIG. 1 is a flow chart of an adaptive API gateway fusing method in an embodiment.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
Example 1
As shown in fig. 1, this embodiment provides an adaptive API gateway fusing method, which includes the following steps:
and step S1-S2, the client sends a request.
And S3-S4, the fuse releases the request according to the fusing rate, if the server receives the request but fails to respond, the fuse is triggered, the access request is refused, and the requests are ended in +1.
And step S5-S7, the server receives the request and responds successfully, and the requests are +1 and the acceptors are +1.
S8-S9, recalculating the fusing rate based on the fusing coefficient K and an adaptive formula, wherein the adaptive calculation formula is as follows:
wherein, requests: and setting initial values according to the service scene according to all the request quantities.
accept: and setting initial values according to the service scene for all successful request quantities.
rate: the fusing rate fuses the request with a certain probability.
In the request process, if the fusing rate is larger than a preset value, an alarm signal is sent out. The update rule of the fusing rate is as follows: the interval time is greater than a preset value or the increase in total requested amount data since the last update is greater than a preset value. In addition, the fusing rate may be updated after the request is received and before the fusing determination.
An existing automatic fusing strategy based on the micro-service fuse is used for setting a Close/Open/HalfOpen three-section interception mechanism according to service states. All requests can be intercepted in the Open state, so that server resource waste is caused, and when the HalfOpen state switches the Close state, all requests are released, so that the back-end service can be flushed again, in addition, the service checking round-robin time is fixed, and the multi-service scene requirement is difficult to meet.
Unlike the existing methods, the present invention:
(1) Self-adaptive fusing is realized: and recording the request quantity and the successful request quantity, dynamically calculating the fusing rate, and realizing self-adaptive fusing.
(2) Fuse state switching smoothing: and dynamically controlling the fusing rate, increasing the successful request quantity along with the recovery of abnormal services, naturally reducing the fusing rate, and smoothly rising the release request, thereby avoiding secondary service fusing caused by instantaneous closing of the fusing state.
(3) Switching the fusing state in real time: by adopting the self-adaptive fusing method, the time-round-robin-based fusing state switching in the prior art is abandoned, the real-time switching of the fusing state is realized, and the access request is timely accessed after the service is recovered to be normal.
Example 2
The present embodiment provides an electronic device, including: one or more processors and a memory, the memory having stored therein one or more programs, the one or more programs including instructions for performing the adaptive API gateway fusing method as described in embodiment 1.
Example 3
The present embodiment provides a computer-readable storage medium comprising one or more programs for execution by one or more processors of an electronic device, the one or more programs comprising instructions for performing the adaptive API gateway fusing method as described in embodiment 1.
While the invention has been described with reference to certain preferred embodiments, it will be understood by those skilled in the art that various changes and substitutions of equivalents may be made and equivalents will be apparent to those skilled in the art without departing from the scope of the invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.

Claims (10)

1. An adaptive API gateway fusing method is characterized by being applied to an API gateway, and comprises the following steps:
initializing a fusing rate;
acquiring an access request, determining whether to release or not according to the current fusing rate, if not, triggering fusing, refusing the access request and ending, and if so, updating the total request amount data and releasing the request;
judging whether the released request is successfully processed, if so, updating the successfully processed request quantity data;
and adaptively updating the fusing rate based on the total request amount data and the successfully processed request amount data.
2. The method of claim 1, wherein the rate of fusing is inversely proportional to a request success rate, the request success rate being a ratio of the successfully processed request amount data to the total request amount data.
3. The method for adaptively fusing an API gateway as in claim 1, wherein said fusing rate is updated by:
wherein rate is the fusing rate, max () is a maximum function, requests are total request data, accept is successful processing request data, and K is a fusing coefficient.
4. The method for fusing an adaptive API gateway as recited in claim 3, wherein said fusing coefficient is a predetermined constant.
5. The method of claim 1, wherein the alert signal is sent when the fusing rate is greater than a predetermined value.
6. The method according to claim 1, wherein the initial values of the total request amount data and the successfully processed request amount data are set according to a service scenario before the access request is acquired.
7. The method according to claim 1, wherein the fusing rate is updated based on the total request amount data and the successfully processed request amount data when a preset updating rule is met.
8. The method for adaptively fusing an API gateway as in claim 7, wherein said updating rule comprises:
the interval time is greater than a preset value and/or
The increase in total requested amount data since the last update is greater than a preset value and/or
Before determining whether to release the request.
9. An electronic device, comprising: one or more processors and memory, the memory having stored therein one or more programs, the one or more programs comprising instructions for performing the adaptive API gateway fusing method of any of claims 1-8.
10. A computer readable storage medium comprising one or more programs for execution by one or more processors of an electronic device, the one or more programs comprising instructions for performing the adaptive API gateway fusing method of any of claims 1-8.
CN202310856776.2A 2023-07-12 2023-07-12 Self-adaptive API gateway fusing method, device and medium Pending CN116708527A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310856776.2A CN116708527A (en) 2023-07-12 2023-07-12 Self-adaptive API gateway fusing method, device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310856776.2A CN116708527A (en) 2023-07-12 2023-07-12 Self-adaptive API gateway fusing method, device and medium

Publications (1)

Publication Number Publication Date
CN116708527A true CN116708527A (en) 2023-09-05

Family

ID=87827738

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310856776.2A Pending CN116708527A (en) 2023-07-12 2023-07-12 Self-adaptive API gateway fusing method, device and medium

Country Status (1)

Country Link
CN (1) CN116708527A (en)

Similar Documents

Publication Publication Date Title
EP3748925B1 (en) Domain name bandwidth adjustment method and device
US10958592B2 (en) Domain name bandwidth adjustment method and apparatus
CN113595922B (en) Flow limiting method, device, server and storage medium
US20180013822A1 (en) Service request processing method, related apparatus, and system
CN112929291A (en) Distributed current limiting method based on redis, computer equipment and storage medium
CN110417595B (en) Business service disaster tolerance method, device, system, management server and electronic equipment
CN111046310A (en) Page processing method, device, server and computer readable storage medium
CN110830565A (en) Resource downloading method, device, system, electronic equipment and storage medium
CN109964493B (en) Network connection detection method, device, terminal and computer storage medium
CN109981779B (en) Service providing method, server and computer storage medium
CN113923163A (en) Long connection message channel based current limiting method and system
CN116708527A (en) Self-adaptive API gateway fusing method, device and medium
CN107846294B (en) Main/standby service switching method and device
CN111600738B (en) Method for optimizing timeout processing and storage medium
US12010197B2 (en) System, method and computer-readable medium for data accessing
CN111224811B (en) SNMP request monitoring system, method, device and computer readable storage medium
CN105915591B (en) Access control method and device
JP2017174038A (en) Information processing system, information processing method, and program
CN111556142B (en) Service calling method, device and system
CN114070738A (en) Equipment configuration auditing method and device
CN112698927A (en) Bidirectional communication method, device, electronic equipment and machine-readable storage medium
US20080086535A1 (en) Instant messaging server suitable for notifying the accessibility of information to a client
CN114466032B (en) CDN system merging and source returning method, device and storage medium
CN114338479B (en) Communication method, device and system
CN111885198B (en) Message processing method, system and device and electronic setting

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