Access request control method, device and electronic device

By analyzing the historical access requests of the API gateway, determining the maximum concurrent access volume of the lower API gateway, and accessing control of the access requests received by the API gateway, solving the problem of long-term occupation of the API gateway session resources and improving the utilization of session resources Rate.

CN115484318BActive Publication Date: 2025-02-21HANGZHOU DT DREAM TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211070268.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-02
Publication Date
2025-02-21
Estimated Expiration
2042-09-02

AI Technical Summary

Technical Problem

In multi-cascade scenarios, the API gateway needs to maintain access sessions to the lower API gateway, resulting in the API gateway session resources being occupied for a long time when the lower API gateway has an exception, which affects the overall session resources of the API gateway.

Method used

By obtaining multiple historical access requests of the API gateway, the maximum concurrent access amount for the lower API gateway is determined based on the access time, response time, and accessed API interface, and access control processing is carried out on the access requests received by the API gateway, so as to Avoid waste of session resources caused by unhealthy lower-level API gateways.

Benefits of technology

It effectively avoids the waste of API gateway session resources caused by slow response of unhealthy API interface corresponding to the unhealthy API gateway, and improves the utilization rate of session resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115484318B_ABST
    Figure CN115484318B_ABST
Patent Text Reader

Abstract

The present application proposes an access request control method, device and electronic device, which relate to the field of big data technology, and in particular to data access in the field of data transmission, wherein the method comprises: obtaining multiple historical API interface access requests of an API gateway within a first historical time period; the historical API interface access requests comprise: an access time point, a response time length and an accessed API interface; the accessed API interface comprises: an API interface connected to a subordinate API gateway associated with the API gateway; according to the access time points, response time lengths and accessed API interfaces in multiple historical access requests, determining the maximum concurrent access volume for the subordinate API gateway, and performing access control processing on the API interface access requests received by the API gateway for accessing the subordinate API gateway. Compared with the commonly used method of limiting the access volume to the subordinate API gateway, this method can avoid the waste of API gateway session resources caused by the slow response of the API interface corresponding to the unhealthy subordinate API gateway, and improve the utilization rate of session resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of big data technology, and in particular to data access in the field of data transmission. The present application proposes an access request control method, device and electronic device. Background Art

[0002] In a multi-cascade scenario, if subscriber 1 corresponding to API Gateway 1 (API Gateway) wants to access open service 2 configured on level 2 API Gateway 2 (lower-level API Gateway), it needs to send an access request to level 1 API Gateway 1 (API Gateway), which will be forwarded by level 1 API Gateway 1 to level 2 API Gateway 2 (lower-level API Gateway), and finally to open service 2. The service response is returned along this path.

[0003] In the related technology, during the access process, the API gateway needs to maintain an access session about the open service 2. If the access is abnormal, the access volume of the lower-level API gateway is usually controlled. However, when the lower-level API gateway has an abnormality, such as network instability, or high performance pressure on the gateway or API service, the access to the lower-level API gateway through the API gateway is not stable, resulting in the long-term occupation of the session resources on the API gateway, affecting the overall session resource utilization efficiency of the API gateway. Summary of the invention

[0004] The purpose of this application is to solve one of the above technical problems at least to a certain extent.

[0005] To this end, the present application proposes an access request control method, device and electronic device, which obtains multiple historical access requests from the API gateway, determines the maximum concurrent access volume for the subordinate API gateway according to the access time points, response durations and accessed API interfaces in the multiple historical access requests, and performs access control processing on the API interface access requests received by the API gateway for accessing the subordinate API gateway according to the maximum concurrent access volume. Compared with the commonly used method of limiting the access volume to the subordinate API gateway, it can avoid the waste of API gateway session resources caused by the slow response of the API interface corresponding to the unhealthy subordinate API gateway, and improve the utilization rate of session resources.

[0006] The first aspect of the present application proposes an access request control method, which is applied to an API gateway in a cascade data service, including: obtaining multiple historical API interface access requests of the API gateway within a first historical time period; the historical API interface access requests include: an access time point, a response time, and an accessed API interface; the accessed API interface includes: an API interface connected to a subordinate API gateway associated with the API gateway; determining a maximum concurrent access volume for the subordinate API gateway based on the access time points, response time, and accessed API interfaces in the multiple historical access requests; wherein the maximum concurrent access volume is the maximum number of concurrent accesses to the subordinate API gateway through the API gateway; based on the maximum concurrent access volume, performing access control processing on the API interface access requests received by the API gateway for accessing the subordinate API gateway.

[0007] Optionally, determining the maximum concurrent access to the subordinate API gateway based on the access time points, response time and accessed API interfaces in multiple historical access requests includes: determining the update time point of each accessed API interface and the concurrent access at the update time point based on the access time points, response time and accessed API interfaces in multiple historical access requests; the update time point is a time point when an access abnormality occurs, and / or a time point when the current maximum concurrent access to the subordinate API gateway is exceeded but the access quality does not decrease; for each subordinate API gateway, updating the maximum concurrent access to the subordinate API gateway based on the update time point of each API interface connected to the subordinate API gateway and the concurrent access at the update time point, as well as the current maximum concurrent access.

[0008] Optionally, determining the update time point of each accessed API interface and the concurrent access volume at the update time point based on the access time points, response times and accessed API interfaces in multiple historical access requests includes: for each API interface accessed, obtaining the first historical access request for accessing the API interface; when at least one of the following situations occurs, determining the update time point of the API interface based on the access time point in the first access request, and obtaining the concurrent access volume of the API interface at the update time point: the access result of the first historical access request is access failure; the ratio of the response time to the reference response time in the first historical access request is greater than a preset ratio threshold; the current maximum concurrent access volume is exceeded, but there is no degradation in access quality.

[0009] Optionally, for each of the subordinate API gateways, according to the update time point of each API interface connected to the subordinate API gateway and the concurrent access volume at the update time point, and the current maximum concurrent access volume, updating the maximum concurrent access volume for the subordinate API gateway includes: for each of the subordinate API gateways, according to the update time point of each API interface connected to the subordinate API gateway and the concurrent access volume at the update time point, determining the update time point for the subordinate API gateway and the concurrent access volume for the subordinate API gateway at the update time point; when the current time point is a non-update time point of the subordinate API gateway and the concurrent access volume for the subordinate API gateway at the current time point is greater than or equal to the current maximum concurrent access volume, determining the concurrent access volume update duration of the subordinate API gateway according to two adjacent update time points for the subordinate API gateway; updating the maximum concurrent access volume for the subordinate API gateway according to the concurrent access volume update duration and the current maximum concurrent access volume.

[0010] Optionally, updating the maximum concurrent access to the subordinate API gateway according to the concurrent access update duration and the current maximum concurrent access includes: determining an amplification ratio according to the concurrent access update duration; wherein the concurrent access update duration is negatively correlated with the amplification ratio; and adjusting the current maximum concurrent access according to the amplification ratio to update the maximum concurrent access to the subordinate API gateway.

[0011] Optionally, the method also includes: when the current time point is the update time point of the subordinate API gateway, and the concurrent access volume to the subordinate API gateway at the current time point is less than the current maximum concurrent access volume, the concurrent access volume to the subordinate API gateway at the current time point is used as the maximum concurrent access volume to the subordinate API gateway at the current time point.

[0012] Optionally, before determining the update duration of the concurrent access volume of the subordinate API gateway based on two adjacent update time points for the subordinate API gateway, the method also includes: determining whether the subordinate API gateway meets the frequent change condition based on the update time point for the subordinate API gateway and the concurrent access volume for the subordinate API gateway at the update time point; when the subordinate API gateway meets the frequent change condition, updating the maximum concurrent access volume for the subordinate API gateway based on the maximum concurrent access volume of the subordinate API gateway in the second historical time period.

[0013] Optionally, according to the maximum concurrent access volume, access control processing is performed on the API interface access requests received by the API gateway for accessing the API interface of the subordinate API gateway, including: obtaining multiple API interface access requests received at the current time point; determining the concurrent access volume for the subordinate API gateway at the current time point based on the multiple API interface access requests; for each subordinate API gateway, when the concurrent access volume for the subordinate API gateway at the current time point is greater than the maximum concurrent access volume, stopping access processing for some API interface access requests that exceed the maximum concurrent access volume and returning an access result of access failure.

[0014] Optionally, the method further includes: for each of the lower-level API gateways, when the maximum concurrent access volume to the lower-level API gateway is less than an access volume threshold, taking offline the service connected to the lower-level API gateway.

[0015] The access request control method of the embodiment of the present application obtains multiple historical API interface access requests from the API gateway within a first historical time period; the historical API interface access requests include: an access time point, a response time, and an accessed API interface; the accessed API interface includes: an API interface connected to a subordinate API gateway associated with the API gateway; according to the access time point, the response time, and the accessed API interface in the multiple historical access requests, the maximum concurrent access volume for the subordinate API gateway is determined; wherein the maximum concurrent access volume is the maximum number of concurrent accesses to the subordinate API gateway through the API gateway; according to the maximum concurrent access volume, access control processing is performed on the API interface access requests received by the API gateway for accessing the subordinate API gateway. Compared with the commonly used method of limiting the access volume to the subordinate API gateway, this method can avoid the waste of API gateway session resources caused by the slow response of the API interface corresponding to the unhealthy subordinate API gateway, and improve the utilization rate of session resources.

[0016] The second aspect embodiment of the present application proposes an access request control device, including: a first acquisition module, used to obtain multiple historical API interface access requests of the API gateway within a first historical time period; the historical API interface access requests include: access time point, response time and accessed API interface; the accessed API interface includes: the API interface connected to the subordinate API gateway associated with the API gateway; a first determination module, used to determine the maximum concurrent access to the subordinate API gateway based on the access time point, response time and accessed API interface in the multiple historical access requests; wherein the maximum concurrent access is the maximum number of concurrent accesses to the subordinate API gateway through the API gateway; a first processing module, used to perform access control processing on the API interface access request received by the API gateway for accessing the subordinate API gateway according to the maximum concurrent access.

[0017] Optionally, the first determination module includes: a determination unit and an update unit; the determination unit is used to determine the update time point of each accessed API interface and the concurrent access volume at the update time point based on the access time point, response time and accessed API interface in multiple historical access requests; the update time point is a time point when an access abnormality occurs, and / or a time point when the current maximum concurrent access volume of the subordinate API gateway to which it belongs is exceeded but the access quality does not decrease; the update unit is used to update the maximum concurrent access volume for each subordinate API gateway according to the update time point of each API interface connected to the subordinate API gateway and the concurrent access volume at the update time point, as well as the current maximum concurrent access volume.

[0018] Optionally, the determination unit is specifically used to obtain, for each API interface accessed, a first historical access request for accessing the API interface; determine an update time point of the API interface based on the access time point in the first access request, and obtain concurrent accesses to the API interface at the update time point when at least one of the following situations occurs: the access result of the first historical access request is an access failure; the ratio of the response time to the reference response time in the first historical access request is greater than a preset ratio threshold; the current maximum concurrent accesses are exceeded, but there is no degradation in access quality.

[0019] Optionally, the update unit is specifically used to determine, for each of the subordinate API gateways, the update time point for the subordinate API gateway and the concurrent access volume for the subordinate API gateway at the update time point according to the update time points of each API interface connected to the subordinate API gateway and the concurrent access volume at the update time point; when the current time point is a non-update time point for the subordinate API gateway and the concurrent access volume for the subordinate API gateway at the current time point is greater than or equal to the current maximum concurrent access volume, determine the concurrent access volume update duration of the subordinate API gateway according to two adjacent update time points for the subordinate API gateway; and update the maximum concurrent access volume for the subordinate API gateway according to the concurrent access volume update duration and the current maximum concurrent access volume.

[0020] Optionally, the update unit is specifically used to determine the amplification ratio based on the concurrent access update duration; wherein the concurrent access update duration is negatively correlated with the amplification ratio; and adjust the current maximum concurrent access according to the amplification ratio to update the maximum concurrent access for the lower-level API gateway.

[0021] Optionally, the device also includes: a second processing module, which is used to use the concurrent access volume for the subordinate API gateway at the current time point as the maximum concurrent access volume for the subordinate API gateway at the current time point when the current time point is the update time point of the subordinate API gateway and the concurrent access volume for the subordinate API gateway at the current time point is less than the current maximum concurrent access volume.

[0022] Optionally, the device further includes: a second determination module and an update module; the second determination module is used to determine whether the subordinate API gateway meets the frequent change condition according to the update time point for the subordinate API gateway and the concurrent access volume for the subordinate API gateway at the update time point;

[0023] The update module is used to update the maximum concurrent access volume for the subordinate API gateway according to the maximum concurrent access volume of the subordinate API gateway in the second historical time period when the subordinate API gateway meets the frequent change condition.

[0024] Optionally, the first processing module is specifically used to obtain multiple API interface access requests received at the current time point; determine the concurrent access volume for the subordinate API gateway at the current time point based on the multiple API interface access requests; for each subordinate API gateway, when the concurrent access volume for the subordinate API gateway at the current time point is greater than the maximum concurrent access volume, stop access processing for some API interface access requests that exceed the maximum concurrent access volume and return an access result of access failure.

[0025] Optionally, the device further includes: an offline module, which is used to offline the service connected to each of the subordinate API gateways when the maximum concurrent access volume to the subordinate API gateway is less than the access volume threshold.

[0026] The third aspect of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the access request control method as described in the first aspect when executing the program.

[0027] The fourth aspect of the present application provides a non-temporary computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the access request control method described in the first aspect is implemented.

[0028] The fifth aspect of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the access request control method described in the first aspect.

[0029] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0031] Figure 1 This is a schematic diagram of accessing the API gateway in the cascade data service;

[0032] Figure 2 A flowchart of an access request control method provided in an embodiment of the present application;

[0033] Figure 3 A flowchart of another access request control method provided in an embodiment of the present application;

[0034] Figure 4It is a structural diagram of an access request control device according to an embodiment of the present application;

[0035] Figure 5 It is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0036] Embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.

[0037] With the continuous advancement and deepening of my country's informatization construction, more and more enterprises and organizations need to organize and share their core business assets with partners in the form of APIs, or integrate third-party applications to explore business models, improve service levels, and expand cooperation space.

[0038] When data service products are used to implement this function, they provide complete API publishing, subscription, and lifecycle management. Users only need to perform simple operations to quickly, cheaply, and with low risk share open data or services. Data services can help users achieve cross-system and cross-protocol service capability interoperability between their own multiple systems, or with partners and third-party systems. Each system shares and opens up to each other in the form of publishing and subscribing services, and uniformly manages and organizes services. Based on API interaction, it realizes the integration, reshaping, and innovation of business capabilities between various departments within the enterprise, as well as with partners or third-party developers.

[0039] The API gateway needs to configure the resource address and authentication information corresponding to the open service (service). Subscribers can see the configured open service (service) on the data service product and subscribe. The API gateway will respond to the subscription request. After the subscriber passes the authentication, it will proxy the open service (service) and forward the API interface access request, so that the subscriber can obtain the required open service information or resources through the API gateway.

[0040] In the cascade scenario, Figure 1 This is a schematic diagram of accessing the API gateway in the cascade data service, such as Figure 1As shown, open service 1 is configured on level 1 API gateway 1 (API gateway), open service 2 is configured on level 2 API gateway 2, open service 3 is configured on level 2 API gateway 3, and open service 4 is configured on level 3 API gateway 4. Level 1 API gateway 1 corresponds to level 1 control node 1, level 2 API gateway 2 corresponds to level 2 control node 2, level 2 API gateway 3 corresponds to level 2 control node 3, and level 3 API gateway 4 corresponds to level 3 control node 4. Control nodes can be used to control the start and end of parallel and branch processes.

[0041] If subscriber 1 corresponding to API Gateway 1 (API Gateway) wants to access open service 2 (service) configured on level 2 API Gateway 2 (lower-level API Gateway), it needs to send an access request to level 1 API Gateway 1 (API Gateway), which will be forwarded by level 1 API Gateway 1 to level 2 API Gateway 2 (lower-level API Gateway), and finally to open service 2 (service). The service response will be returned along this path. If subscriber 1 wants to access open service 3 (service) configured on level 2 API Gateway 3 (lower-level API Gateway), level 1 API Gateway 1 needs to forward the access request to level 2 API Gateway 3, and finally to open service 3 (service). The service response will be returned along this path.

[0042] In the related technology, during the access to open service 2, the API gateway needs to maintain the access session about open service 2. If the access is abnormal, the access volume of the subordinate API gateway is usually controlled. However, when the subordinate API gateway has an abnormality, such as network instability, or the performance pressure of the gateway or API service is high, the access to the subordinate API gateway through the API gateway is not stable, resulting in the long-term occupation of the session resources on the API gateway, affecting the overall session resource utilization efficiency of the API gateway.

[0043] In response to the above problems, embodiments of the present application provide an access request control method, device, and electronic device.

[0044] Combine the following Figure 2 , the access request control method provided by this application is described in detail.

[0045] Figure 2 A flowchart of an access request control method provided in an embodiment of the present application.

[0046] The execution subject of the embodiment of the present application is the access request control device provided by the present application. The access request control device in the present application may be, for example, a gateway, or software installed in the gateway, etc., to perform the access request control function.

[0047] Among them, in the embodiment of the present application, the access request control device is taken as an API gateway in the cascade data service as an example for explanation.

[0048] like Figure 2 As shown, the access request control method includes the following steps:

[0049] Step 201, obtain multiple historical API interface access requests of the API gateway within the first historical time period; the historical API interface access requests include: access time point, response time and accessed API interface; the accessed API interface includes: the API interface connected to the subordinate API gateway associated with the API gateway.

[0050] In the embodiment of the present application, taking API gateway 1 as the API gateway at this level as an example, the historical API interface access request refers to the access request initiated by the subscriber corresponding to API gateway 1. The historical access request is to access service 2 corresponding to API gateway 2 (subordinate API gateway). The API interface connected to the subordinate API gateway associated with the API gateway included in the historical access request is the API interface of service 2.

[0051] Step 202, based on the access time points, response durations, and accessed API interfaces in multiple historical access requests, determine the maximum concurrent access volume for the subordinate API gateway; wherein the maximum concurrent access volume is the maximum number of concurrent accesses to the subordinate API gateway through the API gateway.

[0052] The maximum concurrent access volume is the maximum number of concurrent accesses to the API interface corresponding to the lower-level API gateway through the API gateway.

[0053] Step 203: perform access control processing on the API interface access request received by the API gateway for accessing the lower-level API gateway according to the maximum concurrent access amount.

[0054] In some embodiments, the process of the API gateway executing step 203 can be, for example, obtaining multiple API interface access requests received at the current time point; determining the concurrent access volume for the subordinate API gateway at the current time point based on the multiple API interface access requests; for each subordinate API gateway, when the concurrent access volume for the subordinate API gateway at the current time point is greater than the maximum concurrent access volume, for some API interface access requests that exceed the maximum concurrent access volume, stopping access processing and returning an access result of failed access.

[0055] Among them, for some API interface access requests that exceed the concurrent access limit, stop access processing and return access results of failed access, which can reduce the access pressure of the backend API service or the lower-level API gateway and release the corresponding session resources as soon as possible.

[0056] In some embodiments, for each lower-level API gateway, when the concurrent access volume to the lower-level API gateway at the current time point does not exceed the maximum concurrent access volume of the lower-level gateway and is greater than the maximum concurrent access volume of the lower-level single interface, for some API interface access requests that exceed the maximum concurrent access volume, access processing is stopped and an access result of failed access is returned.

[0057] In some embodiments, for an API gateway, when the concurrent access volume of the API gateway at the current time point is greater than the maximum concurrent access volume, access processing is stopped for some API interface access requests that exceed the maximum concurrent access volume and an access result of access failure is returned.

[0058] In some embodiments, the concurrent access volume of the API interface connected to the lower-level API gateway is greater than the maximum concurrent access volume for the API interface connected to the lower-level gateway. For some API interface access requests that exceed the maximum concurrent access volume, access processing is stopped and an access failure result is returned.

[0059] In some embodiments, the API gateway may also perform the following process: for each subordinate API gateway, when the maximum concurrent access volume for the subordinate API gateway is less than the access volume threshold, the service connected to the subordinate API gateway is offline, wherein the access volume threshold may be a first access volume threshold.

[0060] Among them, when the maximum concurrent access volume of the lower-level API gateway is less than the access volume threshold, the service connected to the lower-level API gateway may fail. Taking the service connected to the lower-level API gateway offline can timely troubleshoot the problem, avoid continuous access to the service, and reduce resource usage.

[0061] In some embodiments, for each lower-level API gateway, when the current maximum concurrent access volume of the lower-level API gateway is significantly reduced compared to the concurrent access volume at the current time point, it is considered that the service has a reduced access capability, and the service connected to the lower-level API gateway is taken offline.

[0062] In some embodiments, for an API gateway, when the maximum concurrent access volume of the API gateway is less than the access volume threshold corresponding to the API gateway, the service directly connected to the API gateway is offlined, wherein the access volume threshold may be a second access volume threshold.

[0063] Among them, the first visit volume threshold and the second visit volume threshold can be set according to actual needs, and this application does not limit this.

[0064] In some embodiments, for an API gateway, when the current maximum concurrent access volume of the API gateway is significantly reduced compared to the concurrent access volume at the current time point, it is considered that the service has a reduced access capability, and the service connected to the API gateway is taken offline.

[0065] Among them, after the API gateway and the services connected to the lower-level API gateway go offline, they can be put back online after troubleshooting.

[0066] The access request control method provided in the embodiment of the present application obtains multiple historical API interface access requests from the API gateway within the first historical time period; the historical API interface access requests include: access time point, response time and accessed API interface; the accessed API interface includes: the API interface connected to the subordinate API gateway associated with the API gateway; according to the access time point, response time and accessed API interface in the multiple historical access requests, the maximum concurrent access volume for the subordinate API gateway is determined; wherein the maximum concurrent access volume is the maximum number of concurrent accesses to the subordinate API gateway through the API gateway; according to the maximum concurrent access volume, the API gateway receives the access requests for accessing the subordinate API network, which is more commonly used than the method of limiting the access volume to the subordinate API gateway, which can avoid the waste of API gateway session resources caused by the slow response of the API interface corresponding to the unhealthy subordinate API gateway, and improve the utilization rate of session resources. Access control processing is performed on the API interface access requests related to the API gateway,

[0067] In order to accurately determine the maximum concurrent access volume of the lower-level API gateway, access request control is implemented, such as Figure 3 As shown, the access request control method provided by this application is further explained.

[0068] Figure 3 A flowchart of another access request control method provided in an embodiment of the present application. Figure 3 As shown, the above method may include the following steps:

[0069] Step 301, obtain multiple historical API interface access requests of the API gateway within the first historical time period; the historical API interface access requests include: access time point, response duration and accessed API interface; the accessed API interface includes: the API interface connected to the subordinate API gateway associated with the API gateway.

[0070] Step 302, based on the access time points, response durations, and accessed API interfaces in multiple historical access requests, determine the update time points of each accessed API interface and the concurrent access volume at the update time points; the update time points are the time points when access anomalies occur, and / or the time points when the current maximum concurrent access volume of the subordinate API gateway is exceeded but the access quality does not decrease.

[0071] In some embodiments, the process of the API gateway executing step 302 can, for example, be to obtain, for each API interface accessed, a first historical access request for accessing the API interface; determine the update time point of the API interface based on the access time point in the first access request, and obtain the concurrent access volume of the API interface at the update time point when at least one of the following situations occurs: the access result of the first historical access request is an access failure; the ratio of the response time in the first historical access request to the reference response time is greater than a preset ratio threshold; the current maximum concurrent access volume is exceeded, but there is no decrease in access quality.

[0072] The reference response time may be the response time of other historical access requests to the API interface before the first historical access request. The preset ratio threshold may be set according to actual needs, and this application does not impose any restrictions on this.

[0073] Among them, when at least one of the above situations occurs, the update time point of the API interface is determined according to the access time point in the first access request, that is, the access time point in the first access request can be used as the update time point of the API interface, so that the concurrent access volume at the update time point can be obtained, so as to update the maximum concurrent access volume of the lower-level API gateway.

[0074] In some embodiments, for the API gateway, when at least one of the following situations occurs, the update time point of each API interface accessed and the concurrent access volume at the update time point can be determined based on the access time points, response time and accessed API interfaces in multiple historical access requests: the access result of the historical access request is access failure; the ratio of the response time in the historical access request to the reference response time is greater than a preset ratio threshold; the current maximum concurrent access volume is exceeded, but there is no decline in access quality.

[0075] Among them, when at least one of the above situations occurs, the update time point of the API interface is determined according to the access time point in the access request, that is, the access time point in the access request can be used as the update time point of the API interface, so that the concurrent access volume at the update time point can be obtained, so as to update the maximum concurrent access volume of the API gateway.

[0076] Step 303, for each lower-level API gateway, update the maximum concurrent access quantity for the lower-level API gateway according to the update time point of each API interface connected to the lower-level API gateway and the concurrent access quantity at the update time point, as well as the current maximum concurrent access quantity.

[0077] In some embodiments, the process of the API gateway executing step 303 can be, for example, determining, for each subordinate API gateway, the update time point for the subordinate API gateway and the concurrent access volume for the subordinate API gateway at the update time point based on the update time point of each API interface connected to the subordinate API gateway and the concurrent access volume at the update time point; when the current time point is a non-update time point for the subordinate API gateway and the concurrent access volume for the subordinate API gateway at the current time point is greater than or equal to the current maximum concurrent access volume, determining the concurrent access volume update duration of the subordinate API gateway based on two adjacent update time points for the subordinate API gateway; and updating the maximum concurrent access volume for the subordinate API gateway based on the concurrent access volume update duration and the current maximum concurrent access volume.

[0078] The maximum concurrent access volume is dynamically updated and adjusted, and the current maximum concurrent access volume refers to the maximum concurrent access volume of the API interface at the time when the update occurs.

[0079] Among them, the longer the concurrent access update time is, the more stable the concurrent access is, and the shorter the concurrent access update time is, the more unstable the concurrent access is.

[0080] Among them, the API gateway can adjust the maximum concurrent access volume based on the current maximum concurrent access volume when the concurrent access volume update time is short, that is, when the concurrent access volume is unstable.

[0081] Among them, the maximum concurrent access volume for the lower-level API gateway is updated and adjusted according to the concurrent access volume update duration and the current maximum concurrent access volume, so that session resources can be configured for subsequent access requests in time to avoid affecting the access quality.

[0082] In some embodiments, the process of the API gateway updating the maximum concurrent access volume for the subordinate API gateway can be, for example, determining the amplification ratio based on the concurrent access update duration; wherein the concurrent access update duration is negatively correlated with the amplification ratio; and adjusting the current maximum concurrent access volume based on the amplification ratio to update the maximum concurrent access volume for the subordinate API gateway.

[0083] The longer the concurrent access volume update time is, the smaller the amplification ratio is. The amplification ratio can be 110%, 101%, or 100%.

[0084] In some embodiments, for example, if the concurrent access volume is updated within 1 hour, the amplification ratio can be 110%, that is, no access control is performed for the maximum concurrent access volume that does not exceed 10% of the access volume threshold. If the concurrent access volume is updated within 10 hours, the amplification ratio can be 101%, that is, no access control is performed for the maximum concurrent access volume that does not exceed 1% of the access volume threshold. If the concurrent access volume is updated for more than 24 hours, the amplification ratio can be 100%, that is, the concurrent access volume is not amplified, and access control is performed directly based on the maximum concurrent access volume.

[0085] Among them, different concurrent access update durations correspond to different amplification ratios. The current maximum concurrent access is adjusted according to different amplification ratios to update the maximum concurrent access for the lower-level API gateway, so that session resources can be reasonably configured to ensure access quality.

[0086] In some embodiments, the maximum concurrent access to the API gateway is determined based on the update time points of each API interface connected to the API gateway and the concurrent access volume at the update time points (the access volume of the API gateway to the directly connected API service). That is, the concurrent access update duration of the API gateway can be determined based on two adjacent update time points of the API gateway, and the amplification ratio can be determined based on the concurrent access update duration. The maximum concurrent access to the API gateway can be determined based on the amplification ratio and the concurrent access volume at the update time points.

[0087] In some embodiments, the maximum concurrent access quantity for the API interface connected to the lower-level API gateway can be determined based on the update time point of the API interface connected to the lower-level API gateway and the concurrent access quantity at the update time point.

[0088] In some embodiments, the API gateway may also perform the following process: when the current time point is the update time point of the subordinate API gateway, and the concurrent access volume for the subordinate API gateway at the current time point is less than the current maximum concurrent access volume, the concurrent access volume for the subordinate API gateway at the current time point is used as the maximum concurrent access volume for the subordinate API gateway at the current time point.

[0089] Among them, when the current time point is the update time point and the concurrent access volume to the lower-level API gateway is less than the current maximum concurrent access volume, the concurrent access volume is used as the maximum concurrent access volume for the lower-level API gateway at the current time point, so that the connection requests for subsequent applications can be defensively interrupted to avoid increased access pressure.

[0090] In some embodiments, before determining the update duration of the concurrent access volume of the subordinate API gateway based on two adjacent update time points for the subordinate API gateway, the API gateway may also perform the following process: determine whether the subordinate API gateway meets the frequent change condition based on the update time point for the subordinate API gateway and the concurrent access volume for the subordinate API gateway at the update time point; when the subordinate API gateway meets the frequent change condition, update the maximum concurrent access volume for the subordinate API gateway based on the maximum concurrent access volume of the subordinate API gateway in the second historical time period.

[0091] Among them, the frequent change conditions may be, for example, that the number of changes in concurrent access volume within a certain time period is too large, or the difference between two adjacent update time points is small, or the difference between the concurrent access volume for the subordinate API gateway at the update time point and the maximum concurrent access volume of the subordinate API gateway in the second historical time period is too large.

[0092] Among them, when the subordinate API gateway meets the frequent change conditions, the maximum concurrent access volume for the subordinate API gateway is updated according to the maximum concurrent access volume of the subordinate API gateway in the second historical time period to ensure the stability of the maximum concurrent access volume.

[0093] Step 304: perform access control processing on the API interface access request received by the API gateway for accessing the lower-level API gateway according to the maximum concurrent access amount.

[0094] It should be noted that the details of step 301 and step 304 can be found in Figure 1 Step 101 and step 103 in the illustrated embodiment will not be described in detail here.

[0095] The access request control method of the embodiment of the present application obtains multiple historical API interface access requests from the API gateway within a first historical time period; the historical API interface access requests include: an access time point, a response time, and an accessed API interface; the accessed API interface includes: an API interface connected to a subordinate API gateway associated with the API gateway; according to the access time points, response time, and accessed API interfaces in the multiple historical access requests, the update time points of each accessed API interface and the concurrent access volume at the update time points are determined; the update time point is a time point when an access anomaly occurs, and / or exceeds the current maximum concurrent access volume of the subordinate API gateway to which it belongs The time point when the number of visits increased but the access quality did not decrease; for each lower-level API gateway, the maximum concurrent visits for the lower-level API gateway are updated according to the update time points of each API interface connected to the lower-level API gateway, the concurrent visits at the update time points, and the current maximum concurrent visits; according to the maximum concurrent visits, access control is performed on the API interface access requests received by the API gateway for accessing the lower-level API gateway. Compared with the commonly used method of limiting the number of visits to the lower-level API gateway, this can avoid the waste of API gateway session resources caused by the slow response of the API interface corresponding to the unhealthy lower-level API gateway, and improve the utilization rate of session resources.

[0096] For example, when API gateways at all levels receive API interface access requests and forward them to the corresponding lower-level API gateways or backend open services, they count the accessed API interfaces, access time points, and response times. If the API gateway's response time to API interface access increases and reaches a certain time (the ratio of the response time to the reference response time is greater than the preset ratio threshold), or there is a deterioration in access quality such as access failure, or if the time point exceeds the current maximum concurrent access volume of the lower-level API gateway but there is no deterioration in access quality, the update time point of each API interface and the concurrent access volume of the API interface at the update time point are recorded.

[0097] A lower-level API gateway can be accessed by multiple upper-level API gateways. When the access quality of the lower-level API gateway decreases, the upper-level API gateway can query the lower-level API gateway to obtain the concurrent access volume of the lower-level API gateway (lower level), and compare and analyze it with the concurrent access volume (this level) recorded by the API gateway to the lower-level API gateway through the upper-level API gateway. When there is a large difference between the maximum concurrent access volume (this level) recorded by the API gateway and the obtained concurrent access volume (lower level) of the lower-level API gateway, it can be judged that the lower-level API gateway has multiple upper-level API gateways and provides services for multiple upper-level API gateways at the same time. Therefore, the maximum concurrent access volume (this level) recorded by the upper-level API gateway is relatively unstable, and there is a situation where the maximum concurrent access volume (this level) of the upper-level API gateway changes frequently. The upper-level API gateway selects a reasonable maximum concurrent access volume based on the change frequency of the maximum concurrent access volume, that is, the maximum concurrent access volume (lower level) of the lower-level API gateway can be used as the maximum concurrent access volume of the upper-level API gateway (for the maximum concurrent volume of the lower-level API gateway).

[0098] The API Gateway records each maximum concurrent access volume and the update time of each maximum concurrent access volume. If the update time of each concurrent access volume is longer, it means that the record of concurrent access volume is more stable. Conversely, if the update time is shorter, it is more unstable.

[0099] The API gateway monitors the update time point, concurrent access volume at the update time point, and the current maximum concurrent access volume of the subordinate API gateway. For concurrent access volume with a short update time, a concurrent access threshold is set. For example, for update time within 1 hour, a maximum concurrent access volume of no more than 10% of the concurrent access threshold is allowed without access control. For update time within 10 hours, a maximum concurrent access volume of no more than 1% of the concurrent access threshold is allowed without access control. For update time over 24 hours, the access threshold is 0%, that is, access control is performed based on the maximum concurrent access volume.

[0100] The API Gateway monitors the concurrent access volume of each API interface or associated subordinate API Gateways:

[0101] a) When the current time point is the update time point and the current maximum concurrent access volume is not reached, the maximum concurrent access volume is updated with the concurrent access volume at the current time point;

[0102] b) When the current time point is a non-update time point and the number of concurrent accesses is greater than or equal to the current maximum number of concurrent accesses, the amplification ratio is determined according to the concurrent access update duration, and the maximum number of concurrent accesses is updated based on the amplification ratio;

[0103] c) When the maximum number of concurrent accesses is reached and the access quality decreases, there is no need to update the maximum number of concurrent accesses.

[0104] The API gateway monitors the concurrent access volume of each API interface or the associated lower-level API gateway. At the current point in time, when the concurrent access volume of the lower-level API gateway is greater than the maximum concurrent access volume, it limits the access requests to some API interfaces that exceed the maximum concurrent access volume and returns access results of failed access. For each API interface of the API gateway, when the concurrent access volume of the API interface is greater than the maximum concurrent access volume, it stops access processing and returns access results of failed access for some API interface access requests that exceed the concurrent access volume, thereby reducing the access pressure of the backend API service or the lower-level API gateway, and releasing the corresponding session resources as soon as possible until the concurrent access volume of the corresponding API service or API gateway is reduced to a reasonable value.

[0105] When the API gateway detects that the access quality of multiple API services from the same lower-level API gateway has degraded or the maximum concurrent access capacity has been reached, it can restrict access to other API services that belong to the same lower-level API gateway, return access failure responses in advance, and control new access requests.

[0106] When the maximum concurrent access volume of the lower-level API gateway is less than the access volume threshold, the service connected to the lower-level API gateway is taken offline. For each API interface of the API gateway, when the maximum concurrent access volume of the API interface is less than the access volume threshold (which can be set according to actual needs), the service corresponding to the API interface is taken offline until the fault is eliminated, and then the API service capability is provided online.

[0107] Corresponding to the access request control methods provided in the above-mentioned embodiments, an embodiment of the present application further provides an access request control device. Since the access request control device provided in the embodiment of the present application corresponds to the access request control methods provided in the above-mentioned embodiments, the implementation of the access request control method is also applicable to the access request control device provided in this embodiment, and will not be described in detail in this embodiment.

[0108] Figure 4 Schematic diagram of the structure of an access request control device according to an embodiment of the present application.

[0109] like Figure 4 As shown, the access request control device 400 may include: a first acquisition module 410 , a first determination module 420 and a first processing module 430 .

[0110] Among them, the first acquisition module 410 is used to obtain multiple historical API interface access requests of the API gateway within the first historical time period; the historical API interface access requests include: access time point, response time and accessed API interface; the accessed API interface includes: the API interface connected to the subordinate API gateway associated with the API gateway;

[0111] A first determination module 420 is used to determine the maximum concurrent access to the subordinate API gateway according to the access time points, response durations, and accessed API interfaces in the multiple historical access requests; wherein the maximum concurrent access is the maximum number of concurrent accesses to the subordinate API gateway through the API gateway;

[0112] The first processing module 430 is used to perform access control processing on the API interface access request received by the API gateway for accessing the lower-level API gateway according to the maximum concurrent access amount.

[0113] As a possible implementation method of an embodiment of the present application, the first determination module 420 includes: a determination unit and an update unit; the determination unit is used to determine the update time point of each accessed API interface and the concurrent access volume at the update time point based on the access time point, response time and accessed API interface in multiple historical access requests; the update time point is a time point when an access abnormality occurs, and / or a time point when the current maximum concurrent access volume of the subordinate API gateway to which it belongs is exceeded but the access quality does not decrease; the update unit is used to update the maximum concurrent access volume for each subordinate API gateway according to the update time point of each API interface connected to the subordinate API gateway and the concurrent access volume at the update time point, as well as the current maximum concurrent access volume.

[0114] As a possible implementation method of an embodiment of the present application, the determination unit is specifically used to obtain, for each API interface accessed, a first historical access request for accessing the API interface; when at least one of the following situations occurs, determine the update time point of the API interface according to the access time point in the first access request, and obtain the concurrent access volume of the API interface at the update time point: the access result of the first historical access request is access failure; the ratio of the response time to the reference response time in the first historical access request is greater than a preset ratio threshold; the current maximum concurrent access volume is exceeded, but there is no decrease in access quality.

[0115] As a possible implementation method of an embodiment of the present application, the update unit is specifically used to determine, for each of the subordinate API gateways, the update time point for the subordinate API gateway and the concurrent access volume for the subordinate API gateway at the update time point according to the update time point of each API interface connected to the subordinate API gateway and the concurrent access volume at the update time point; when the current time point is a non-update time point of the subordinate API gateway and the concurrent access volume for the subordinate API gateway at the current time point is greater than or equal to the current maximum concurrent access volume, determine the concurrent access volume update duration of the subordinate API gateway according to two adjacent update time points for the subordinate API gateway; and update the maximum concurrent access volume for the subordinate API gateway according to the concurrent access volume update duration and the current maximum concurrent access volume.

[0116] As a possible implementation method of an embodiment of the present application, the update unit is specifically used to determine the amplification ratio according to the concurrent access update duration; wherein the concurrent access update duration is negatively correlated with the amplification ratio; and the current maximum concurrent access is adjusted according to the amplification ratio to update the maximum concurrent access for the lower-level API gateway.

[0117] As a possible implementation method of an embodiment of the present application, the device also includes: a second processing module, which is used to use the concurrent access volume for the subordinate API gateway at the current time point as the maximum concurrent access volume for the subordinate API gateway at the current time point when the current time point is the update time point of the subordinate API gateway and the concurrent access volume for the subordinate API gateway at the current time point is less than the current maximum concurrent access volume.

[0118] As a possible implementation method of an embodiment of the present application, the device also includes: a second determination module and an update module; the second determination module is used to determine whether the subordinate API gateway meets the frequent change condition based on the update time point for the subordinate API gateway and the concurrent access volume to the subordinate API gateway at the update time point; the update module is used to update the maximum concurrent access volume for the subordinate API gateway according to the maximum concurrent access volume of the subordinate API gateway in a second historical time period when the subordinate API gateway meets the frequent change condition.

[0119] As a possible implementation method of an embodiment of the present application, the first processing module 430 is specifically used to obtain multiple API interface access requests received at the current time point; determine the concurrent access volume for the subordinate API gateway at the current time point based on the multiple API interface access requests; for each subordinate API gateway, when the concurrent access volume for the subordinate API gateway at the current time point is greater than the maximum concurrent access volume, for some API interface access requests that exceed the maximum concurrent access volume, stop access processing and return an access result of access failure.

[0120] As a possible implementation method of an embodiment of the present application, the device also includes: an offline module, which is used to offline the service connected to each subordinate API gateway when the maximum concurrent access volume to the subordinate API gateway is less than the access volume threshold.

[0121] The access request control device provided by the embodiment of the present application obtains multiple historical API interface access requests from the API gateway within the first historical time period; the historical API interface access requests include: access time point, response time and accessed API interface; the accessed API interface includes: API interface connected to the subordinate API gateway associated with the API gateway; according to the access time point, response time and accessed API interface in the multiple historical access requests, the maximum concurrent access volume for the subordinate API gateway is determined; wherein the maximum concurrent access volume is the maximum number of concurrent accesses to the subordinate API gateway through the API gateway; according to the maximum concurrent access volume, access control processing is performed on the API interface access request received by the API gateway for accessing the subordinate API gateway. Compared with the commonly used method of limiting the access volume to the subordinate API gateway, it can avoid the waste of API gateway session resources caused by the slow response of the API interface corresponding to the unhealthy subordinate API gateway, and improve the utilization rate of session resources.

[0122] In order to implement the above embodiment, the present application also proposes an electronic device, Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device includes:

[0123] A memory 501 , a processor 502 , and a computer program stored in the memory 501 and executable on the processor 502 .

[0124] When the processor 502 executes the program, the access request control method provided in the above embodiment is implemented.

[0125] Furthermore, the electronic device further comprises:

[0126] The communication interface 503 is used for communication between the memory 501 and the processor 502 .

[0127] The memory 501 is used to store computer programs that can be executed on the processor 502 .

[0128] The memory 501 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0129] The processor 502 is used to implement the access request control method described in the above embodiment when executing the program.

[0130] If the memory 501, the processor 502 and the communication interface 503 are implemented independently, the communication interface 503, the memory 501 and the processor 502 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0131] Optionally, in a specific implementation, if the memory 501, the processor 502 and the communication interface 503 are integrated on a chip, the memory 501, the processor 502 and the communication interface 503 can communicate with each other through an internal interface.

[0132] The processor 502 may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.

[0133] In order to implement the above embodiments, the embodiments of the present application also propose a non-temporary computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the access request control method provided in the above embodiments is implemented.

[0134] In order to implement the above embodiments, the embodiments of the present application further propose a computer program product. When the instruction processor in the computer program product is executed, the access request control method provided in the above embodiments is implemented.

[0135] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0136] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0137] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.

[0138] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples (non-exhaustive list) of computer-readable media include the following: an electrical connection with one or more wires (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.

[0139] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0140] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0141] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0142] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present application. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present application.

Claims

1. A method for controlling access requests, characterized in that: An API gateway applied to a cascading data service, the method comprising: Acquire multiple historical API interface access requests of the API gateway within a first historical time period; the historical API interface access requests include: access time point, response duration, and accessed API interface; the accessed API interface includes: an API interface connected to a subordinate API gateway associated with the API gateway; Determine the maximum concurrent access volume for the subordinate API gateway according to the access time points, response durations, and accessed API interfaces in multiple historical access requests; wherein the maximum concurrent access volume is the maximum number of concurrent accesses to the subordinate API gateway through the API gateway; According to the maximum concurrent access amount, access control processing is performed on the API interface access request received by the API gateway for accessing the lower-level API gateway; According to the access time points, response durations, and accessed API interfaces in multiple historical access requests, the maximum concurrent access volume for the subordinate API gateway is determined, including: Determine the update time point of each API interface accessed and the concurrent access volume at the update time point according to the access time points, response durations, and accessed API interfaces in the multiple historical access requests; the update time point is the time point when an access anomaly occurs, and / or the time point when the current maximum concurrent access volume of the subordinate API gateway is exceeded but the access quality does not decrease; For each of the lower-level API gateways, the maximum concurrent access volume for the lower-level API gateway is updated according to the update time point of each API interface connected to the lower-level API gateway, the concurrent access volume at the update time point, and the current maximum concurrent access volume.

2. The method according to claim 1, characterized in that The determining, according to the access time points, response durations, and accessed API interfaces in the plurality of historical access requests, the update time points of the accessed API interfaces and the concurrent access volume at the update time points includes: For each API interface accessed, obtaining a first historical access request for accessing the API interface; When at least one of the following situations occurs, the update time point of the API interface is determined according to the access time point in the first access request, and the concurrent access volume of the API interface at the update time point is obtained: The access result of the first historical access request is access failure; The ratio of the response time in the first historical access request to the reference response time is greater than a preset ratio threshold; The current maximum number of concurrent accesses is exceeded, but no degradation in access quality occurs.

3. The method according to claim 1, characterized in that For each of the lower-level API gateways, updating the maximum concurrent access volume for the lower-level API gateway according to the update time point of each API interface connected to the lower-level API gateway and the concurrent access volume at the update time point, and the current maximum concurrent access volume, includes: For each of the subordinate API gateways, determine the update time point for the subordinate API gateway and the concurrent access volume for the subordinate API gateway at the update time point according to the update time point of each API interface connected to the subordinate API gateway and the concurrent access volume at the update time point; When the current time point is a non-update time point of the subordinate API gateway, and the concurrent access volume for the subordinate API gateway at the current time point is greater than or equal to the current maximum concurrent access volume, determine the concurrent access volume update duration of the subordinate API gateway according to two adjacent update time points for the subordinate API gateway; According to the concurrent access update duration and the current maximum concurrent access, the maximum concurrent access for the subordinate API gateway is updated.

4. The method according to claim 3, characterized in that: The updating of the maximum concurrent access quantity for the subordinate API gateway according to the concurrent access quantity update duration and the current maximum concurrent access quantity includes: Determine the amplification ratio according to the concurrent access update duration; wherein the concurrent access update duration is negatively correlated with the amplification ratio; The current maximum concurrent access volume is adjusted according to the amplification ratio to update the maximum concurrent access volume for the subordinate API gateway.

5. The method according to claim 3, characterized in that: The method further comprises: When the current time point is the update time point of the subordinate API gateway, and the concurrent access volume for the subordinate API gateway at the current time point is less than the current maximum concurrent access volume, the concurrent access volume for the subordinate API gateway at the current time point is used as the maximum concurrent access volume for the subordinate API gateway at the current time point.

6. The method according to claim 3, characterized in that Before determining the concurrent access update duration of the subordinate API gateway according to two adjacent update time points for the subordinate API gateway, the method further includes: Determine whether the subordinate API gateway meets the frequent change condition according to the update time point for the subordinate API gateway and the concurrent access volume for the subordinate API gateway at the update time point; When the subordinate API gateway meets the frequent change condition, the maximum concurrent access quantity for the subordinate API gateway is updated according to the maximum concurrent access quantity of the subordinate API gateway in the second historical time period.

7. The method according to claim 1, characterized in that The performing access control processing on the API interface access request received by the API gateway for accessing the API interface of the lower-level API gateway according to the maximum concurrent access amount includes: Get multiple API interface access requests received at the current time point; Determine the concurrent access volume for the subordinate API gateway at the current time point according to the multiple API interface access requests; For each of the lower-level API gateways, when the concurrent access volume to the lower-level API gateway at the current time point is greater than the maximum concurrent access volume, for some API interface access requests that exceed the maximum concurrent access volume, access processing is stopped and an access result of access failure is returned.

8. The method according to claim 1, characterized in that The method further comprises: For each of the lower-level API gateways, when the maximum concurrent access volume for the lower-level API gateway is less than the access volume threshold, the service connected to the lower-level API gateway is taken offline.

9. An access request control device, characterized in that: An API gateway applied to a cascade data service, the device comprising: A first acquisition module is used to acquire multiple historical API interface access requests of the API gateway within a first historical time period; the historical API interface access requests include: access time point, response time and accessed API interface; the accessed API interface includes: the API interface connected to the subordinate API gateway associated with the API gateway; A first determination module is used to determine the maximum concurrent access volume for the subordinate API gateway according to the access time point, response time and accessed API interface in multiple historical access requests; wherein the maximum concurrent access volume is the maximum number of concurrent accesses to the subordinate API gateway through the API gateway; A first processing module, configured to perform access control processing on an API interface access request received by the API gateway for accessing the lower-level API gateway according to the maximum concurrent access amount; According to the access time points, response durations, and accessed API interfaces in multiple historical access requests, the maximum concurrent access volume for the subordinate API gateway is determined, including: Determine the update time point of each API interface accessed and the concurrent access volume at the update time point according to the access time points, response durations, and accessed API interfaces in the multiple historical access requests; the update time point is the time point when an access anomaly occurs, and / or the time point when the current maximum concurrent access volume of the subordinate API gateway is exceeded but the access quality does not decrease; For each of the lower-level API gateways, the maximum concurrent access volume for the lower-level API gateway is updated according to the update time point of each API interface connected to the lower-level API gateway, the concurrent access volume at the update time point, and the current maximum concurrent access volume.

10. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the access request control method according to any one of claims 1 to 8 when executing the program.

11. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the access request control method according to any one of claims 1 to 8 is implemented.

12. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the steps of the access request control method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Automatic table division data access method and device, electronic equipment and storage medium

    CN112632066A

  • Gateway for controlling mobile device access to enterprise resources

    US20140007214A1