CN115348209B - Flow control method and device of API (application program interface), electronic equipment and storage medium - Google Patents

Flow control method and device of API (application program interface), electronic equipment and storage medium Download PDF

Info

Publication number
CN115348209B
CN115348209B CN202211269395.6A CN202211269395A CN115348209B CN 115348209 B CN115348209 B CN 115348209B CN 202211269395 A CN202211269395 A CN 202211269395A CN 115348209 B CN115348209 B CN 115348209B
Authority
CN
China
Prior art keywords
access
request
flow
cluster
filtering
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.)
Active
Application number
CN202211269395.6A
Other languages
Chinese (zh)
Other versions
CN115348209A (en
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.)
Jiangxi Kingroad Technology Development Co ltd
Original Assignee
Jiangxi Kingroad Technology Development 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 Jiangxi Kingroad Technology Development Co ltd filed Critical Jiangxi Kingroad Technology Development Co ltd
Priority to CN202211269395.6A priority Critical patent/CN115348209B/en
Publication of CN115348209A publication Critical patent/CN115348209A/en
Application granted granted Critical
Publication of CN115348209B publication Critical patent/CN115348209B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to data processing, and discloses a flow control method of an API (application program interface), which comprises the following steps: acquiring a flow access request of an API (application program interface), identifying the request type of the flow access request, and clustering the access requests in the flow access request according to the request type to obtain a clustered access request; filtering the clustering access request by using a pre-constructed flow access filter to obtain a filtering access request, and reading a flow running track of the filtering access request; establishing a relation dependency table of the filtering access requests according to the flow operation track, identifying the dependency relationship among the access requests in the filtering access requests according to the relation dependency table, and establishing a flow access cluster of the filtering access requests according to the dependency relationship; and configuring a flow access protocol of the flow access cluster to execute flow control on the API interface through the flow access protocol to obtain a flow control result. The invention can make the interface distribution of the API more convenient and controllable.

Description

Flow control method and device of API (application program interface), electronic equipment and storage medium
Technical Field
The present invention relates to the field of data processing, and in particular, to a method and an apparatus for controlling a flow of an API interface, an electronic device, and a storage medium.
Background
At present, the digital transformation is deeply applied to various industries, and an API-application program interface is not only a core carrier for bearing value and connecting business of an enterprise, but also is developed into a product. A new model of value exchange around the life cycle of API products, consisting of API users and developers, is becoming more mature, especially in conjunction with micro-services, devOps, etc., technologies, which will make the API strategy a profit for enterprises to accelerate innovation.
At present, API interface control is mainly based on a request parameter control method, however, the flow of the API interface controlled by the method is too large, so that the allocation of an API interface is not convenient and fast, and the controllability is low.
Disclosure of Invention
In order to solve the technical problem or at least partially solve the technical problem, the present application provides a flow control method and apparatus for an API interface, an electronic device, and a storage medium, which can make interface allocation of an API more convenient and controllable.
In a first aspect, the present invention provides a flow control method for an API interface, including:
acquiring a flow access request of an API (application program interface), identifying the request type of the flow access request, and clustering access requests in the flow access request according to the request type to obtain a clustered access request;
filtering the clustering access request by using a pre-constructed flow access filter to obtain a filtering access request, and reading a flow running track of the filtering access request;
establishing a relation dependency table of the filtering access request according to the flow running track, identifying a dependency relation between access requests in the filtering access request according to the relation dependency table, and establishing a flow access cluster of the filtering access request according to the dependency relation;
and configuring a flow access protocol of the flow access cluster to execute flow control of the API interface through the flow access protocol to obtain a flow control result.
In one possible implementation manner of the first aspect, the identifying a request category of the traffic access request includes:
inquiring the request information of the flow access request to obtain request inquiry information, and retrieving the information field of the request inquiry information to obtain a request inquiry field;
and identifying a field code of the request inquiry field so as to identify the request category of the flow access request according to the field code.
In a possible implementation manner of the first aspect, the clustering access requests in the traffic access requests includes:
clustering access requests in the flow access requests by using the following formula
Figure 807682DEST_PATH_IMAGE001
Wherein the content of the first and second substances,
Figure 544694DEST_PATH_IMAGE002
a cluster access request is represented that is,
Figure 5762DEST_PATH_IMAGE003
an ith request class representing an xth access request,
Figure 373289DEST_PATH_IMAGE004
a jth request class representing a jth access request, n representing a number of access requests;
in a possible implementation manner of the first aspect, the filtering the clustered access requests by using a pre-constructed traffic access filter includes:
acquiring an identifier id of the clustering access request to obtain a clustering identifier id, and inquiring a characteristic value of the clustering access request according to the clustering identifier id to obtain a clustering characteristic value;
and decomposing the clustering characteristic value to obtain a unique string character value, and filtering the clustering access request by using the unique string character value and combining the pre-constructed flow access filter to obtain a filtering access request.
In a possible implementation manner of the first aspect, the building a relational dependency table of the filtering access request according to the traffic trajectory includes:
identifying the execution condition of the request in the filtering access request to obtain the request execution condition, and judging the request execution action of the filtering access request according to the request execution condition;
inquiring the execution sequence of the filtering access request according to the request execution action to obtain a request execution sequence, and generating a relation dependency component of the relation dependency table by combining the request execution condition, the request execution action and the request execution sequence;
and constructing the relation dependency table of the filtering access request according to the relation dependency component of the relation dependency table.
In a possible implementation manner of the first aspect, the constructing a traffic access cluster of the filtering access request includes:
creating the flow access cluster node to obtain a cluster node, and configuring the cluster configuration file according to the cluster node;
and generating the cluster static ip according to the cluster configuration file, and constructing the flow access cluster by combining the cluster nodes, the cluster configuration file and the cluster static ip.
In a possible implementation manner of the first aspect, the configuring a traffic access protocol of the traffic access cluster includes:
acquiring the operating environment of the flow access cluster, and identifying the operating mode of the flow access cluster according to the operating environment of the flow access cluster to obtain a cluster operating mode;
and configuring a flow access protocol of the flow access cluster according to the cluster operation mode.
In a second aspect, the present invention provides a flow control apparatus of an API interface, the apparatus comprising:
the request clustering module is used for acquiring the flow access request of the API, identifying the request category of the flow access request, and clustering the access request in the flow access request according to the request category to obtain a clustered access request;
the track reading module is used for filtering the clustering access request by utilizing a pre-constructed flow access filter to obtain a filtering access request and reading a flow running track of the filtering access request;
the cluster building module is used for building a relation dependency table of the filtering access request according to the flow running track, identifying a dependency relation among the access requests in the filtering access request according to the relation dependency table, and building a flow access cluster of the filtering access request according to the dependency relation;
and the protocol configuration module is used for configuring a flow access protocol of the flow access cluster so as to execute flow control on the API interface through the flow access protocol to obtain a flow control result.
In a third aspect, the present invention provides an electronic device comprising:
at least one processor; and a memory communicatively coupled to the at least one processor;
wherein the memory stores a computer program executable by at least one processor to enable the at least one processor to perform the method for flow control of an API interface as defined in any one of the above first aspects.
In a fourth aspect, the present invention provides a computer-readable storage medium storing a computer program, which when executed by a processor implements the method for controlling flow of an API interface according to any one of the first aspects.
Compared with the prior art, the technical principle and the beneficial effects of the scheme are as follows:
according to the scheme, the subsequent identification operation can be facilitated by acquiring the flow access request of the API, the request type of the flow access request can be identified, the flow access request can be finely divided so as to facilitate the subsequent clustering processing, and the access request in the flow access request can be divided into a plurality of different clusters according to a certain rule so as to facilitate the subsequent classification filtering processing; secondly, filtering the clustering access request by utilizing a pre-constructed flow access filter to obtain a filtering access request, wherein the repeated request or illegal request can be filtered to reduce the pressure of a server, and the flow running track of the filtering access request can be read to know the running process of the filtering access request so as to facilitate the establishment of a subsequent relation dependency table; further, in the embodiment of the present invention, the relationship dependency table of the filtering access request is constructed according to the traffic trajectory, so that the relationship dependency table of different traffic activities can be known, the relationship dependency table can be established according to the relationship or the influence, the dependency relationship between the access requests in the filtering access request can be identified, the relationship or the influence relationship between different requests in the filtering access request can be known, a pad is generated for a subsequent cluster, and the traffic access protocol of the traffic access cluster is configured, so that the API interface can flexibly control a large amount of traffic accesses, thereby reducing the pressure of a traffic gateway. Therefore, the flow control method for the API interface provided by the embodiment of the invention can realize the effects of more convenient interface allocation and higher controllability of the API.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a schematic flowchart of a flow control method of an API interface according to an embodiment of the present invention;
fig. 2 is a block diagram of a flow control device of an API interface according to an embodiment of the present invention;
fig. 3 is a schematic diagram of an internal structure of an electronic device implementing a flow control method for an API interface according to an embodiment of the present invention.
Detailed Description
It should be understood that the detailed description and specific examples, while indicating the invention, are intended for purposes of illustration only and are not intended to limit the scope of the invention.
Embodiments of the present invention provide a flow control method for an API interface, where an execution subject of the flow control method for the API interface includes, but is not limited to, at least one of electronic devices that can be configured to execute the method provided in the embodiments of the present invention, such as a server and a terminal. In other words, the flow control method of the API interface may be executed by software or hardware installed in the terminal device or the server device, and the software may be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like. The server may be an independent server, or may be a cloud server that provides basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a Network service, cloud communication, a middleware service, a domain name service, a security service, a Content Delivery Network (CDN), a big data and artificial intelligence platform, and the like.
Fig. 1 is a schematic flow chart of a flow control method of an API interface according to an embodiment of the present invention. The flow control method of the API interface described in fig. 1 includes the following steps S1 to S4:
s1, obtaining a flow access request of an API (application program interface), identifying the request type of the flow access request, and clustering access requests in the flow access request according to the request type to obtain a clustered access request.
The embodiment of the invention can obtain specific request information such as commodity order query, express order number query, payment record and the like through the flow access request for obtaining the API interface so as to facilitate subsequent identification operation, the flow access request for obtaining the API interface is obtained through the information query interface corresponding to the flow access request for obtaining the API interface,
further, in the embodiment of the present invention, the traffic access request may be finely divided by identifying the request category of the traffic access request, so as to facilitate subsequent clustering.
As an embodiment of the present invention, the identifying the request category of the traffic access request includes: inquiring the request information of the flow access request to obtain request inquiry information, retrieving an information field of the request inquiry information to obtain a request inquiry field, and identifying a field code of the request inquiry field so as to identify the request category of the flow access request according to the field code.
Wherein, the information field is used to describe a certain characteristic of information or data, such as age, gender, size, etc., the field code is used to generate a binary code of the field, optionally, the request information for inquiring the traffic access request is inquired through a request inquiry interface of the traffic access request, the information field for retrieving the request inquiry information is obtained through a field retrieval script, the request type for identifying the traffic access request according to the field code is identified through a code identification function generated by Java language,
according to the embodiment of the invention, the access requests in the flow access requests are clustered, so that the access requests can be divided into a plurality of different clusters according to a certain rule, and subsequent classification and filtering processing is facilitated.
Further, in an optional embodiment of the present invention, the access requests in the traffic access requests are clustered by using the following formula:
Figure 51133DEST_PATH_IMAGE005
wherein the content of the first and second substances,
Figure 263940DEST_PATH_IMAGE006
a cluster access request is represented that is,
Figure 845094DEST_PATH_IMAGE007
an ith request class representing an xth access request,
Figure 117943DEST_PATH_IMAGE008
j request class, n, representing the y access requestRepresenting the number of access requests;
and S2, filtering the clustering access request by using a pre-constructed flow access filter to obtain a filtering access request, and reading a flow running track of the filtering access request.
In the embodiment of the invention, the clustering access request is filtered by utilizing the pre-constructed flow access filter to obtain the filtering access request, so that repeated requests or illegal requests can be filtered to reduce the pressure of a server, wherein the flow access filter is a program capable of screening and filtering data request information,
as an embodiment of the present invention, the filtering the clustered access requests by using a pre-constructed traffic access filter includes: and acquiring an identifier id of the cluster access request to obtain a cluster identifier id, inquiring a characteristic value of the cluster access request according to the cluster identifier id to obtain a cluster characteristic value, decomposing the cluster characteristic value to obtain a unique string identifier value, and filtering the cluster access request by using the unique string identifier value and combining with the pre-constructed flow access filter to obtain a filtering access request.
The identification id is an identification symbol added during code generation, the eigenvalue is linear substitution of vector data, the unique string identifier value is a symbol composed of numbers and letters and used for describing information numbers such as files and hardware identifiers, optionally, the identification id for acquiring the cluster access request is acquired by reading the identification id source code, the eigenvalue for querying the cluster access request according to the cluster identification id is extracted through an eigenvalue extraction function of html language, the cluster eigenvalue is decomposed to obtain the unique string identifier value, the unique string identifier value is decomposed through an eigenvalue decomposition matrix in python language, and the pre-constructed flow access filter can be obtained through JAVA language compiling.
Further, in the embodiment of the present invention, the operation process of the filtering access request may be known by reading the traffic operation trace of the filtering access request, so as to facilitate the establishment of a subsequent relationship dependency table, and as an embodiment of the present invention, the traffic operation trace of the filtering access request is read by querying the request configuration interface of the filtering access request.
And S3, constructing a relation dependency table of the filtering access request according to the flow running track, identifying a dependency relation among the access requests in the filtering access request according to the relation dependency table, and constructing a flow access cluster of the filtering access request according to the dependency relation.
In the embodiment of the present invention, the relationship dependency table for filtering the access request is constructed according to the traffic trajectory, so that the relationship or the influence of different traffic activities can be known, and the relationship dependency table is conveniently established according to the relationship or the influence, where the relationship dependency table is a table generated according to a relationship that a change of one activity in different data activities will influence another activity.
As an embodiment of the present invention, the building a relational dependency table of the filtering access request according to the traffic trajectory includes: identifying the execution condition of the request in the filtering access request, obtaining a request execution condition, judging the request execution action of the filtering access request according to the request execution condition, inquiring the execution sequence of the filtering access request according to the request execution action, obtaining a request execution sequence, generating a relation dependency component of the relation dependency table by combining the request execution condition, the request execution action and the request execution sequence, and constructing the relation dependency table of the filtering access request according to the relation dependency component of the relation dependency table.
The request execution condition is an execution condition set for a request task, the request is executed when the request execution condition is met, the request cannot be executed when the request execution condition is not met, the request execution action refers to actions such as synchronization and asynchronization executed by the request task, the request execution order refers to the order in which the request task is executed, optionally, the execution condition for identifying the request in the filtering access request is identified by reading a preset execution rule of the filtering access request, the request execution action for judging the filtering access request according to the request execution condition is judged by a preset request action judgment program, the execution order for inquiring the filtering access request according to the request execution action is inquired by reading the filtering access request action execution order instruction, a relation dependency component for generating the relation dependency table is generated by a component programmed in Java language, and the relation dependency table for constructing the filtering access request according to the relation dependency component of the relation dependency table is created by a table creation program in C + + language.
Further, the embodiment of the present invention may learn the interrelation or the interrelation between different requests in the filtering access request by identifying the dependency relationship between the access requests in the filtering access request, and make a cushion for the subsequent cluster generation, as an embodiment of the present invention, the identification of the dependency relationship between the access requests in the filtering access request is identified by querying the relationship dependency table,
in the embodiment of the present invention, the filtering access request can be classified by constructing the traffic access cluster of the filtering access request, which is convenient for subsequent interface configuration, wherein the traffic access cluster is to aggregate a plurality of traffic accesses according to a rule or similar conditions.
As an embodiment of the present invention, the constructing the traffic access cluster of the filtered access request includes: and creating the flow access cluster node to obtain a cluster node, configuring the cluster configuration file according to the cluster node, generating the cluster static ip according to the cluster configuration file, and constructing the flow access cluster by combining the cluster node, the cluster configuration file and the cluster static ip.
The cluster node is a service, can store data, and has a search function, the configuration file refers to parameters and initial settings of cluster configuration, the static ip refers to an ip address allocated to a network device for a long time, optionally, the creating of the traffic access cluster node is created through a node creation function of a programming language html, the cluster configuration file is configured through a cluster file configuration function in a k8s open source program according to the cluster node configuration, and the traffic access cluster is constructed through clusterip of service by combining the cluster node, the cluster configuration file, and the cluster static ip.
And S4, configuring a flow access protocol of the flow access cluster, and executing flow control on the API interface through the flow access protocol to obtain a flow control result.
The embodiment of the invention can flexibly control a large amount of flow access by the API interface by configuring the flow access protocol of the flow access cluster so as to reduce the pressure of a flow gateway, wherein the flow access protocol refers to establishing and controlling information transmission on a wide area network link between a rras server and client access, namely, each client with different types can establish connection through the rras,
as an embodiment of the present invention, the traffic access protocol for configuring the traffic access cluster includes: acquiring the running environment of the flow access cluster, identifying the running mode of the flow access cluster according to the running environment of the flow access cluster to obtain the cluster running mode, and configuring the flow access protocol of the flow access cluster according to the cluster running mode.
Optionally, the operation environment for acquiring the traffic access cluster is acquired through an operation environment configuration file of the system, the operation mode for identifying the traffic access cluster according to the operation environment of the traffic access cluster is identified through hardware which supports traffic operation and is pre-configured by the system, and the traffic access protocol for configuring the traffic access cluster according to the cluster operation mode is configured through a tcpip network protocol.
It can be seen that, according to the scheme, the subsequent identification operation can be facilitated by acquiring the flow access request of the API interface, the flow access request can be finely divided by identifying the request type of the flow access request, so as to facilitate the subsequent clustering processing, and the access request can be divided into a plurality of different clusters according to a certain rule by clustering the access request in the flow access request, so as to facilitate the subsequent classification filtering processing; secondly, filtering the clustering access request by utilizing a pre-constructed flow access filter to obtain a filtering access request, wherein the repeated request or illegal request can be filtered to reduce the pressure of a server, and the flow running track of the filtering access request can be read to know the running process of the filtering access request so as to facilitate the establishment of a subsequent relation dependency table; further, in the embodiment of the present invention, the relationship dependency table of the filtering access request is constructed according to the traffic trajectory, so that the relationship dependency table of different traffic activities can be known, the relationship dependency table can be established according to the relationship or the influence, the dependency relationship between the access requests in the filtering access request can be identified, the relationship or the influence relationship between different requests in the filtering access request can be known, a pad is generated for a subsequent cluster, and the traffic access protocol of the traffic access cluster is configured, so that the API interface can flexibly control a large amount of traffic accesses, thereby reducing the pressure of a traffic gateway. Therefore, the flow control method for the API interface provided by the embodiment of the invention can realize the effects of more convenient interface allocation and higher controllability of the API.
Fig. 2 is a functional block diagram of a flow control device of the API interface according to the present invention.
The flow control device 200 of the API interface according to the present invention may be installed in an electronic device. According to the implemented functions, the flow control device of the API interface may include a request clustering module 201, a trajectory reading module 202, a cluster building module 203, and a protocol configuration module 204. The module of the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and can perform a fixed function, and are stored in a memory of the electronic device.
In the embodiment of the present invention, the functions of the modules/units are as follows:
the request clustering module is used for acquiring the flow access requests of the API, identifying the request types of the flow access requests, and clustering the access requests in the flow access requests according to the request types to obtain clustered access requests;
the track reading module is used for filtering the clustering access request by using a pre-constructed flow access filter to obtain a filtering access request and reading a flow running track of the filtering access request;
the cluster building module is used for building a relation dependency table of the filtering access request according to the flow running track, identifying a dependency relation among the access requests in the filtering access request according to the relation dependency table, and building a flow access cluster of the filtering access request according to the dependency relation;
and the protocol configuration module is used for configuring a flow access protocol of the flow access cluster so as to execute flow control on the API interface through the flow access protocol to obtain a flow control result.
In detail, when the modules in the flow control device 200 of the API interface in the embodiment of the present invention are used, the same technical means as the above-mentioned flow control method of the API interface in fig. 1 are adopted, and the same technical effects can be produced, and details are not described here.
Fig. 3 is a schematic structural diagram of an electronic device implementing the flow control method of the API interface according to the present invention.
The electronic device may comprise a processor 30, a memory 31, a communication bus 32 and a communication interface 33, and may further comprise a computer program, such as a flow control program of an API interface, stored in the memory 31 and operable on the processor 30.
In some embodiments, the processor 30 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same function or different functions, and includes one or more Central Processing Units (CPUs), a microprocessor, a digital Processing chip, a graphics processor, a combination of various control chips, and the like. The processor 30 is a Control Unit (Control Unit) of the electronic device, connects various components of the electronic device by using various interfaces and lines, and executes various functions and processes data of the electronic device by running or executing programs or modules (e.g., a flow Control program executing an API interface, etc.) stored in the memory 31 and calling data stored in the memory 31.
The memory 31 includes at least one type of readable storage medium including flash memory, removable hard disks, multimedia cards, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disks, optical disks, etc. The memory 31 may in some embodiments be an internal storage unit of the electronic device, for example a removable hard disk of the electronic device. The memory 31 may also be an external storage device of the electronic device in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device. Further, the memory 31 may also include both an internal storage unit and an external storage device of the electronic device. The memory 31 may be used to store not only application software installed in the electronic device and various types of data, such as codes of a flow control program of an API interface, but also data that has been output or is to be output temporarily.
The communication bus 32 may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is arranged to enable connection communication between the memory 31 and at least one processor 30 or the like.
The communication interface 33 is used for communication between the electronic device and other devices, and includes a network interface and a user interface. Optionally, the network interface may include a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), which are typically used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a Display (Display), an input unit such as a Keyboard (Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable, among other things, for displaying information processed in the electronic device and for displaying a visualized user interface.
Fig. 3 shows only an electronic device having components, and those skilled in the art will appreciate that the structure shown in fig. 3 does not constitute a limitation of the electronic device, and may include fewer or more components than those shown, or some components may be combined, or a different arrangement of components.
For example, although not shown in the drawings, the electronic device may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 30 through a power management device, so that functions such as charge management, discharge management, and power consumption management are implemented through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
It should be understood that the embodiments are illustrative only and that the scope of the invention is not limited to this structure.
The flow control program of the API stored in the memory 31 of the electronic device is a combination of a plurality of computer programs, and when running in the processor 30, the following methods can be implemented:
acquiring a flow access request of an API (application program interface), identifying the request type of the flow access request, and clustering access requests in the flow access request according to the request type to obtain a clustered access request;
filtering the clustering access request by using a pre-constructed flow access filter to obtain a filtering access request, and reading a flow running track of the filtering access request;
establishing a relation dependency table of the filtering access request according to the flow running track, identifying a dependency relation between access requests in the filtering access request according to the relation dependency table, and establishing a flow access cluster of the filtering access request according to the dependency relation;
and configuring a flow access protocol of the flow access cluster to execute flow control of the API interface through the flow access protocol to obtain a flow control result.
Specifically, the processor 30 may refer to the description of the relevant steps in the embodiment corresponding to fig. 1 for a specific implementation method of the computer program, which is not described herein again.
Further, the electronic device integrated module/unit, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in a non-volatile computer-readable storage medium. The computer readable storage medium may be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, read-Only Memory (ROM).
The invention also provides a computer-readable storage medium, which stores a computer program that, when executed by a processor of an electronic device, may implement the method of:
acquiring a flow access request of an API (application program interface), identifying the request type of the flow access request, and clustering access requests in the flow access request according to the request type to obtain a clustered access request;
filtering the clustering access request by using a pre-constructed flow access filter to obtain a filtering access request, and reading a flow running track of the filtering access request;
establishing a relation dependency table of the filtering access request according to the flow running track, identifying a dependency relation between access requests in the filtering access request according to the relation dependency table, and establishing a flow access cluster of the filtering access request according to the dependency relation;
and configuring a flow access protocol of the flow access cluster to execute flow control of the API interface through the flow access protocol to obtain a flow control result.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present invention, which enable those skilled in the art to understand or practice the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (9)

1. A flow control method of an API (application program interface), which is characterized by comprising the following steps:
acquiring a flow access request of an API (application program interface), identifying the request type of the flow access request, and clustering access requests in the flow access request according to the request type to obtain a clustered access request;
filtering the clustering access request by using a pre-constructed flow access filter to obtain a filtering access request, and reading a flow running track of the filtering access request;
establishing a relation dependency table of the filtering access request according to the flow running track, identifying a dependency relation between access requests in the filtering access request according to the relation dependency table, and establishing a flow access cluster of the filtering access request according to the dependency relation;
configuring a flow access protocol of the flow access cluster to execute flow control of the API interface through the flow access protocol to obtain a flow control result;
the filtering access requests can be classified by constructing a flow access cluster of the filtering access requests, so that subsequent interface configuration is facilitated, wherein the flow access cluster is formed by collecting a plurality of flow accesses according to rules or similar conditions;
constructing a flow access cluster of the filtering access request, comprising:
creating a flow access cluster node to obtain a cluster node, and configuring a cluster configuration file according to the cluster node;
and generating a cluster static ip according to the cluster configuration file, and constructing the flow access cluster by combining the cluster nodes, the cluster configuration file and the cluster static ip.
2. The method of claim 1, wherein identifying a request class of the traffic access request comprises:
inquiring the request information of the flow access request to obtain request inquiry information, and retrieving the information field of the request inquiry information to obtain a request inquiry field;
and identifying a field code of the request inquiry field so as to identify the request category of the flow access request according to the field code.
3. The method of claim 1, wherein clustering access requests of the traffic access requests comprises:
clustering access requests in the flow access requests by using the following formula:
Figure 133138DEST_PATH_IMAGE001
wherein the content of the first and second substances,
Figure 387402DEST_PATH_IMAGE002
a request for access to a cluster is represented,
Figure 795249DEST_PATH_IMAGE003
an ith request class representing an xth access request,
Figure 447073DEST_PATH_IMAGE004
the jth request class representing the jth access request, and n representing the number of access requests.
4. The method of claim 1, wherein filtering the clustered access requests using a pre-constructed traffic access filter comprises:
acquiring an identifier id of the clustering access request to obtain a clustering identifier id, and inquiring a characteristic value of the clustering access request according to the clustering identifier id to obtain a clustering characteristic value;
and decomposing the clustering characteristic value to obtain a unique string character value, and filtering the clustering access request by using the unique string character value and combining the pre-constructed flow access filter to obtain a filtering access request.
5. The method of claim 1, wherein building a relational dependency table for the filtering access request according to the traffic trajectory comprises:
identifying the execution condition of the request in the filtering access request to obtain the request execution condition, and judging the request execution action of the filtering access request according to the request execution condition;
inquiring the execution sequence of the filtering access request according to the request execution action to obtain a request execution sequence, and generating a relation dependency component of the relation dependency table by combining the request execution condition, the request execution action and the request execution sequence;
and constructing the relation dependency table of the filtering access request according to the relation dependency component of the relation dependency table.
6. The method of claim 1, wherein configuring the traffic access protocol of the traffic access cluster comprises:
acquiring the operating environment of the flow access cluster, and identifying the operating mode of the flow access cluster according to the operating environment of the flow access cluster to obtain a cluster operating mode;
and configuring a flow access protocol of the flow access cluster according to the cluster operation mode.
7. An API-interfaced flow control apparatus, comprising:
the request clustering module is used for acquiring the flow access request of the API, identifying the request category of the flow access request, and clustering the access request in the flow access request according to the request category to obtain a clustered access request;
the track reading module is used for filtering the clustering access request by utilizing a pre-constructed flow access filter to obtain a filtering access request and reading a flow running track of the filtering access request;
the cluster building module is used for building a relation dependency table of the filtering access request according to the flow running track, identifying a dependency relation among the access requests in the filtering access request according to the relation dependency table, and building a flow access cluster of the filtering access request according to the dependency relation;
the protocol configuration module is used for configuring a flow access protocol of the flow access cluster so as to execute flow control on an API (application program interface) through the flow access protocol to obtain a flow control result;
the filtering access requests can be classified by constructing a flow access cluster of the filtering access requests, so that subsequent interface configuration is facilitated, wherein the flow access cluster is formed by collecting a plurality of flow accesses according to rules or similar conditions;
constructing a flow access cluster of the filtering access request, comprising:
creating a flow access cluster node to obtain a cluster node, and configuring a cluster configuration file according to the cluster node;
and generating a cluster static ip according to the cluster configuration file, and constructing the flow access cluster by combining the cluster nodes, the cluster configuration file and the cluster static ip.
8. An electronic device, characterized in that the electronic device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the method for flow control of an API interface as claimed in any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the flow control method of the API interface according to any one of claims 1 to 6.
CN202211269395.6A 2022-10-18 2022-10-18 Flow control method and device of API (application program interface), electronic equipment and storage medium Active CN115348209B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211269395.6A CN115348209B (en) 2022-10-18 2022-10-18 Flow control method and device of API (application program interface), electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211269395.6A CN115348209B (en) 2022-10-18 2022-10-18 Flow control method and device of API (application program interface), electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115348209A CN115348209A (en) 2022-11-15
CN115348209B true CN115348209B (en) 2023-03-24

Family

ID=83957441

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211269395.6A Active CN115348209B (en) 2022-10-18 2022-10-18 Flow control method and device of API (application program interface), electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115348209B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106487708A (en) * 2015-08-25 2017-03-08 阿里巴巴集团控股有限公司 Network access request control method and device

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9667704B1 (en) * 2014-04-26 2017-05-30 Google Inc. System and method for classifying API requests in API processing systems using a tree configuration
US10268449B1 (en) * 2015-06-25 2019-04-23 EMC IP Holding Company LLC Natural order in API calls
WO2019228192A1 (en) * 2018-05-30 2019-12-05 Guangdong Oppo Mobile Telecommunications Corp., Ltd. Method and device for traffic detection and computer-readable storage medium
CN111159214B (en) * 2018-11-07 2024-01-26 中移(苏州)软件技术有限公司 API access method and device, electronic equipment and storage medium
US11347518B2 (en) * 2019-07-24 2022-05-31 Vmware, Inc. System and method for adaptively sampling application programming interface execution traces based on clustering
CN111741016B (en) * 2020-07-23 2020-12-08 南京梦饷网络科技有限公司 Method, computing device, and computer storage medium for managing application interfaces
CN112637289A (en) * 2020-12-11 2021-04-09 深圳前海微众银行股份有限公司 Micro-service request processing method, equipment and storage medium
CN112882763A (en) * 2020-12-17 2021-06-01 济南浪潮数据技术有限公司 Access control method, device, equipment and readable storage medium

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106487708A (en) * 2015-08-25 2017-03-08 阿里巴巴集团控股有限公司 Network access request control method and device

Also Published As

Publication number Publication date
CN115348209A (en) 2022-11-15

Similar Documents

Publication Publication Date Title
CN107958016A (en) Function pages method for customizing and application server
CN101546311B (en) Data processing method and data processing device for recycle bin
CN108520045B (en) Data service response method and device
CN112580079A (en) Authority configuration method and device, electronic equipment and readable storage medium
CN112162748A (en) Application program home page configuration method and device, electronic equipment and readable storage medium
CN114979120A (en) Data uploading method, device, equipment and storage medium
CN114840531A (en) Data model reconstruction method, device, equipment and medium based on blood relationship
CN114491646A (en) Data desensitization method and device, electronic equipment and storage medium
CN114640707A (en) Message asynchronous processing method and device, electronic equipment and storage medium
CN115348209B (en) Flow control method and device of API (application program interface), electronic equipment and storage medium
CN111858617A (en) User searching method and device, computer readable storage medium and electronic equipment
CN113935663A (en) Equipment combination analysis method, device, equipment and medium for panel product
CN114612065A (en) Associated equipment combination method, device, equipment and medium for process papermaking
CN114185522A (en) Page theme customizing method and device, electronic equipment and storage medium
CN113687827A (en) Data list generation method, device and equipment based on widget and storage medium
CN114461531A (en) Platform adaptability test method, device, equipment and storage medium of test case
CN113849520A (en) Intelligent identification method and device of abnormal SQL (structured query language), electronic equipment and storage medium
CN113918305A (en) Node scheduling method and device, electronic equipment and readable storage medium
CN111859044A (en) Data query processing method, system and related equipment
CN114676124B (en) Data field difference solving method, device, equipment and medium based on configuration
CN109885710A (en) User's portrait depicting method and server based on Differential Evolution Algorithm
CN114357534B (en) Classroom training platform construction method, device, equipment and medium based on block chain
CN112214556A (en) Label generation method and device, electronic equipment and computer readable storage medium
CN115017051A (en) File compatibility detection method, device, equipment and medium based on IE browser
CN114238278A (en) Data partitioning method and device, electronic equipment and storage medium

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
GR01 Patent grant
GR01 Patent grant