CN105893150B - Interface calling frequency control method and device and interface calling request processing method and device - Google Patents

Interface calling frequency control method and device and interface calling request processing method and device Download PDF

Info

Publication number
CN105893150B
CN105893150B CN201610197050.2A CN201610197050A CN105893150B CN 105893150 B CN105893150 B CN 105893150B CN 201610197050 A CN201610197050 A CN 201610197050A CN 105893150 B CN105893150 B CN 105893150B
Authority
CN
China
Prior art keywords
interface
calling
frequency
identifier
request
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
CN201610197050.2A
Other languages
Chinese (zh)
Other versions
CN105893150A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201610197050.2A priority Critical patent/CN105893150B/en
Publication of CN105893150A publication Critical patent/CN105893150A/en
Application granted granted Critical
Publication of CN105893150B publication Critical patent/CN105893150B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The invention relates to a method and a device for controlling interface calling frequency and processing an interface calling request, wherein the method for controlling the interface calling frequency comprises the following steps: collecting calling frequency corresponding to the interface identification reported by each interface server; summarizing the collected calling frequency according to a frequency control period to obtain the called frequency corresponding to the interface identifier; acquiring application calling frequency corresponding to the interface identifier; and if the calling frequency reaches the application calling frequency, sending interface calling limit notification for limiting the interface calling request corresponding to the interface identifier to each interface server in batches within the limit time. The interface calling frequency control and interface calling request processing method and device provided by the invention realize the accurate control of the interface calling frequency.

Description

Interface calling frequency control method and device and interface calling request processing method and device
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for controlling interface calling frequency and processing an interface calling request.
Background
The request end initiates an interface calling request to the interface server, and the interface server responds to the interface calling request. However, the resources of the interface server are limited, and therefore, it is necessary to limit the frequency of call requests for interface calls.
The current interface call frequency control scheme is mainly characterized in that after an interface server receives an interface call request initiated by a request end, the call frequency is cached through a fixed time window taking the current time as the time upper limit, if the call frequency counted in the fixed time window reaches a certain threshold, the subsequently received interface call request is limited until the call frequency counted in the fixed time window is lower than the threshold.
However, in the current interface call frequency control scheme, when a plurality of interface servers exist, each interface server has the same frequency limit condition, and the interface call frequency can be accurately controlled only when the interface call request uniformly falls on each interface server, but the assumption is hard to guarantee in practice.
For example, referring to fig. 1, there are M interface servers, each interface server limits the call frequency to 1 ten thousand per minute, and the call frequency actually required to be limited is M ten thousand per minute, but if the interface call requests do not uniformly fall on each interface server, the interface call requests are limited when the call frequency of M ten thousand per minute has not been reached yet, and it cannot be accurately determined at which call frequency the interface call requests are limited.
Disclosure of Invention
Therefore, it is necessary to provide a method and an apparatus for controlling interface call frequency and processing an interface call request, aiming at the problem that the current interface call frequency control scheme cannot accurately control the interface call frequency in a scenario of multiple interface servers.
A method of interface call frequency control, the method comprising:
collecting calling frequency corresponding to the interface identification reported by each interface server;
summarizing the collected calling frequency according to a frequency control period to obtain the called frequency corresponding to the interface identifier;
acquiring application calling frequency corresponding to the interface identifier;
and if the calling frequency reaches the application calling frequency, sending interface calling limit notification for limiting the interface calling request corresponding to the interface identifier to each interface server in batches within the limit time.
An interface call frequency control apparatus, the apparatus comprising:
the calling frequency collection module is used for collecting calling frequencies corresponding to the interface identifiers and reported by the interface servers;
the calling frequency summarizing module is used for summarizing the collected calling frequencies according to a frequency control period to obtain the called frequencies corresponding to the interface identification;
the interface calling control module is used for acquiring the application calling frequency corresponding to the interface identifier; and if the calling frequency reaches the application calling frequency, sending interface calling limit notification for limiting the interface calling request corresponding to the interface identifier to each interface server in batches within the limit time.
An interface call request processing method, the method comprising:
reporting calling frequencies corresponding to the interface identifiers to a frequency control server, so that the frequency control server collects the calling frequencies reported by the interface servers to obtain the called frequencies;
receiving an interface calling limit notification sent by the frequency control server when the called frequency reaches the application calling frequency corresponding to the interface identifier;
acquiring the interface identifier and the limiting time according to the interface calling limiting notice;
receiving an interface calling request carrying the interface identifier;
and if the time for receiving the interface calling request is within the limit time corresponding to the interface identifier, limiting the interface calling request.
An interface call request processing apparatus, the apparatus comprising:
a calling frequency reporting module, configured to report a calling frequency corresponding to the interface identifier to a frequency control server, so that the frequency control server performs aggregation according to the calling frequency reported by each interface server to obtain a called frequency;
an interface call limit notification processing module, configured to receive an interface call limit notification sent by the frequency control server when the called frequency reaches an application call frequency corresponding to the interface identifier; acquiring the interface identifier and the limiting time according to the interface calling limiting notice;
the interface calling request processing module is used for receiving an interface calling request carrying the interface identifier; and if the time for receiving the interface calling request is within the limit time corresponding to the interface identifier, limiting the interface calling request.
According to the interface call frequency control and interface call request processing method and device, in a scene of a plurality of interface servers, the call frequencies reported by the interface servers are collected to obtain the called frequency, and the called frequency can accurately reflect the actual total call frequency of the interface servers. And comparing the called frequency with the application calling frequency applied in advance, and sending a notice to each interface server in batches if the called frequency reaches the application calling frequency, so that each interface server limits the interface calling request within the limit time. Therefore, interface calling requests do not need to be guaranteed to uniformly fall on each interface server, and if the called frequency does not reach the application calling frequency, each interface server receives the corresponding interface calling requests and can normally process the interface calling requests; if the frequency of calling is up to the frequency of applying calling, no matter which interface server receives the corresponding interface calling request, the limitation is carried out, and the accurate control of the frequency of calling the interface is realized.
Drawings
FIG. 1 is a system architecture diagram of a current interface call frequency control scheme;
FIG. 2 is a diagram of an application environment for the interface call frequency control system in one embodiment;
FIG. 3 is a diagram of an application environment of the interface call frequency control system in another embodiment;
FIG. 4 is a diagram of an application environment of the interface call frequency control system in accordance with yet another embodiment;
FIG. 5 is a diagram illustrating an internal configuration of a server according to an embodiment;
FIG. 6 is a flowchart illustrating a method for controlling interface call frequency according to an embodiment;
FIG. 7 is a flowchart illustrating a method for controlling interface call frequency according to another embodiment;
FIG. 8 is a flowchart illustrating a method for controlling interface call frequency according to still another embodiment;
FIG. 9 is a flowchart illustrating a method for controlling interface call frequency in accordance with another embodiment;
FIG. 10 is a flowchart illustrating a method for handling an interface call request according to an embodiment;
FIG. 11 is a flowchart illustrating a method for processing an interface call request according to another embodiment;
FIG. 12 is a flowchart illustrating a method for processing an interface call request according to still another embodiment;
FIG. 13 is a timing diagram illustrating steps for limiting an interface call request if the time of receiving the interface call request is within the limit time corresponding to the interface identifier, according to an embodiment;
FIG. 14 is a timing diagram illustrating a step of limiting an interface call request if the time of receiving the interface call request is within the limit time corresponding to the interface identifier in another embodiment;
FIG. 15 is a block diagram showing the structure of an interface call frequency control device according to an embodiment;
FIG. 16 is a block diagram showing the construction of an interface call frequency control apparatus according to another embodiment;
FIG. 17 is a block diagram showing an example of an interface call request processing apparatus.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
As shown in fig. 2, in one embodiment, an interface call frequency control system is provided, which includes a request terminal 210, a plurality of interface servers 220, and a frequency control server 230. The request end 210 is a device that initiates an interface call request, and may be a user terminal or a service server. The interface servers 220 are devices that provide interface services, and respond to an interface call request initiated by the request terminal 210, where the plurality of interface servers 220 refers to two or more interface servers 220. The frequency control server 230 is used to perform centralized control of the plurality of interface servers 220.
As shown in fig. 3, in one embodiment, the interface call frequency control system further includes a database server 240 and a frequency call application platform 250. The frequent call application platform 250 is configured to receive a call application initiated by the request terminal 210, and if a call right is granted to the call application, write the content of the call application into the database server 240. The database server 240 is used to provide the contents of the call application to each of the interface server 220 and the frequency control server 230. The content of the call application may include a corresponding relationship between the interface identifier and the application call frequency, or may include a corresponding relationship between the request end identifier, the interface identifier and the application call frequency, or may include a corresponding relationship between the request end cluster identifier, the interface identifier and the application call frequency.
As shown in fig. 4, in an embodiment, the interface call frequency control system further includes a request end cluster management platform 260, configured to determine a request end cluster to which each request end 210 belongs, and record a dependency relationship between a request end identifier and the request end cluster identifier to which the request end belongs, where the dependency relationship may be recorded in the database server 240, and read and cached by each interface server 210 in the shared memory.
As shown in fig. 5, in one embodiment, a server is provided that may be used as an interface server 220, a frequency control server 230, a database server 240, a frequency call application platform 250, or a request-side cluster management platform 260. The server includes a processor, a non-volatile storage medium, an internal memory, and a network interface connected by a system bus. Wherein the processor has a calculation function and a function of controlling the operation of the server, and the processor may be configured to execute an interface call frequency control method or an interface call request processing method. The non-volatile storage medium includes at least one of a magnetic storage medium, an optical storage medium, and a flash memory type storage medium. The nonvolatile storage medium stores an operating system, and also stores an interface call frequency control device or an interface call request processing device. The interface call frequency control device is used for realizing an interface call frequency control method, and the interface call request processing device is used for realizing an interface call request processing method.
In one embodiment, the interface servers 220 are respectively configured to report the call frequency corresponding to the interface identifier to the frequency control server 230.
The frequency control server 230 is configured to collect call frequencies corresponding to the interface identifiers reported by the interface servers; summarizing the collected calling frequency according to a frequency control period to obtain the called frequency corresponding to the interface identifier; acquiring application calling frequency corresponding to the interface identifier; and if the called frequency reaches the application calling frequency, sending interface calling limitation notification for limiting the interface calling request corresponding to the interface identifier in a limited time to each interface server in batch.
The plurality of interface servers 220 are respectively configured to receive the interface call restriction notification sent by the frequency control server 230; acquiring an interface identifier and limiting time according to the interface calling limiting notice; receiving an interface calling request carrying an interface identifier; and if the time for receiving the interface calling request is within the limit time corresponding to the interface identifier, limiting the interface calling request.
In one embodiment, the frequency control server 230 is configured to collect the collected call frequencies according to a frequency control cycle, and obtain the call frequencies corresponding to the request end identifier and the interface identifier; the system is also used for acquiring a request end cluster identifier corresponding to the request end identifier and acquiring application calling frequency corresponding to the request end cluster identifier and the interface identifier; and if the called frequency reaches the application calling frequency, sending interface calling limitation notification for limiting the interface calling request corresponding to the request end identifier and the interface identifier to each interface server in batches within the limitation time.
In an embodiment, the frequency control server 230 is specifically configured to update the cached modulated frequency corresponding to the interface identifier in the shared memory according to the call frequency collected in the current frequency control period; and clearing the called frequency corresponding to the shared memory and the interface identifier when the current frequency control period is finished.
In one embodiment, the frequency control server 230 is further configured to read an application calling frequency corresponding to the interface identifier from the database, where the application calling frequency is written into the database by the frequency calling application platform according to the received calling application; and correspondingly caching the application calling frequency and the interface identification into a shared memory. And the application calling frequency corresponding to the interface identifier is read from the shared memory.
In one embodiment, the frequency control server 230 is further configured to collect call frequencies corresponding to the request end cluster identifier and the interface identifier, which are reported by each interface server; acquiring application calling frequency corresponding to a request end cluster identifier and an interface identifier; and sending interface calling limitation notification for limiting the interface calling request corresponding to the request end cluster identifier and the interface identifier in batch to each interface server.
In an embodiment, the interface servers 220 are respectively configured to, if the time for receiving the interface call request exceeds the limit time, perform interface call according to the interface call request, and update the call frequency corresponding to the interface identifier; and reporting the interface identification and the updated calling frequency to a frequency control server.
In an embodiment, the interface servers 220 are respectively configured to count the call frequency corresponding to the interface identifier according to a reporting period, and report the call frequency to the frequency control server, where the reporting period is less than the frequency control period.
In one embodiment, the interface servers 220 are respectively configured to report the calling frequency corresponding to the request end identifier and the interface identifier to the frequency control server; acquiring a request end identifier, an interface identifier and a limit time according to the interface calling limit notice; receiving an interface calling request carrying a request terminal identifier and an interface identifier; and if the time for receiving the interface calling request is within the limit time corresponding to the request end identifier and the interface identifier, limiting the interface calling request.
In one embodiment, the plurality of interface servers 220 are respectively configured to obtain a request end cluster identifier carried by an interface call request; judging whether the acquired request end cluster identification has a corresponding application calling frequency; and if the corresponding application calling frequency exists and the time for receiving the interface calling request is within the limit time corresponding to the request end cluster identifier and the interface identifier, limiting the interface calling request.
In one embodiment, the interface servers 220 are respectively configured to obtain a request end identifier carried by an interface call request; inquiring the request end cluster identification to which the request end identification belongs; judging whether the inquired request end cluster identification has a corresponding application calling frequency; and if the corresponding application calling frequency exists and the time for receiving the interface calling request is within the limit time corresponding to the request end cluster identifier and the interface identifier, limiting the interface calling request.
In the interface call frequency control system, in a scene of a plurality of interface servers, the call frequencies reported by the interface servers are collected to obtain the called frequency, and the called frequency can accurately reflect the actual total call frequency of the plurality of interface servers. And comparing the called frequency with the application calling frequency applied in advance, and sending a notice to each interface server in batches if the called frequency reaches the application calling frequency, so that each interface server limits the interface calling request within the limit time. Therefore, interface calling requests do not need to be guaranteed to uniformly fall on each interface server, and if the called frequency does not reach the application calling frequency, each interface server receives the corresponding interface calling requests and can normally process the interface calling requests; if the frequency of calling is up to the frequency of applying calling, no matter which interface server receives the corresponding interface calling request, the limitation is carried out, and the accurate control of the frequency of calling the interface is realized.
As shown in fig. 6, in one embodiment, an interface call frequency control method is provided, and this embodiment is exemplified by applying the method to the frequency control server 230 in fig. 2 to 4. The method specifically comprises the following steps:
step 602, collecting the calling frequency corresponding to the interface identifier reported by each interface server.
Specifically, each interface server may report the calling frequency corresponding to the interface identifier in real time or according to a reporting period, and the frequency control server collects the calling frequency corresponding to the request end identifier and the interface identifier, which is reported by each interface server in real time or according to a reporting period. The reporting period is less than the frequency control period, for example, the reporting period may be 5 seconds, and the frequency control period may be, for example, 1 minute. The reporting period can be adjusted, the accuracy of frequency control can be further improved by adjusting the reporting period to be small, and the resource consumption of the frequency control server can be reduced by adjusting the reporting period to be large.
The call frequency is a measure that reflects the call frequency, and may be expressed by the number of calls or the call frequency per unit time. The interface identifier is used for uniquely identifying the corresponding interface, and the corresponding interface can be called according to the interface identifier. The calling frequency corresponding to the interface identifier is the frequency of calling the interface corresponding to the interface identifier. The collected call frequency may be a new call frequency added by the corresponding interface server in a reporting period, or may be a call frequency accumulated in a frequency control period.
Step 604, summarizing the collected calling frequency according to the frequency control period, and obtaining the called frequency corresponding to the interface identifier.
Specifically, the frequency control server may accumulate the call frequencies corresponding to the interface identifiers collected in one frequency control period to obtain the call frequencies corresponding to the interface identifiers.
In one embodiment, step 604 includes: updating the cached called frequency corresponding to the interface identifier in the shared memory according to the calling frequency collected in the current frequency control period; and clearing the called frequency corresponding to the shared memory and the interface identifier when the current frequency control period is finished.
Specifically, the frequency control server may specifically read the application call frequency corresponding to the interface identifier from the database server, and correspondingly cache the application call frequency, the called frequency, and the interface identifier in the shared memory.
The frequency control period is a period for calling frequency control to the interface server, and is, for example, 30 seconds or 1 minute. And reading the called frequency and the application calling frequency corresponding to the interface identifier from the shared memory by the frequency control server every time the frequency control server receives the calling frequency corresponding to the interface identifier reported by the interface server. And if the current frequency control cycle is not finished, accumulating the received calling frequency into the read called frequency, and writing the updated called frequency and the interface identifier into the shared memory correspondingly. And if the current frequency control cycle is finished, after the called frequency is cleared, accumulating the received called frequency into the read called frequency, and writing the updated called frequency into the shared memory in correspondence with the interface identifier.
Step 606, obtaining the application calling frequency corresponding to the interface identifier.
In one embodiment, the interface call frequency control method further includes: reading application calling frequency corresponding to the interface identification from a database, wherein the application calling frequency is written into the database by a frequency calling application platform according to the received calling application; and correspondingly caching the application calling frequency and the interface identification into a shared memory. The frequency control server may specifically read the application call frequency corresponding to the interface identifier from the shared memory.
Specifically, the request end may initiate a call application to the frequency call application platform in advance, the frequency call application platform verifies the call application, and if the verification passes, the content of the call application is written in the database server. The content of the calling application comprises the corresponding relation between the interface identification and the calling frequency of the application. And the frequency control server reads the corresponding relation between the interface identification and the application calling frequency from the database server and caches the corresponding relation in the shared memory.
In step 608, if the frequency of the call has reached the frequency of the application call, an interface call restriction notification for restricting the interface call request corresponding to the interface identifier within the restriction time is sent to each interface server in batch.
Specifically, the frequency control server compares the called frequency with the application calling frequency, and transmits an interface calling limit notification to all interface servers when the called frequency is equal to or higher than the application calling frequency, that is, the called frequency reaches the application calling frequency. The interface call limit notification includes an interface identifier and a limit time, and is used for notifying the corresponding interface server to limit the interface call request corresponding to the interface identifier within the limit time. If the interface server limits a certain interface calling request, the interface calling request can be rejected, and feedback information with limited request is returned to a request end which initiates the interface calling request. The limit time may specifically be a time point at which the limit ends, for example, the limit time may be a time point at which the current frequency control cycle ends; the limit time may also be a time period of the limit maintenance.
According to the interface call frequency control method, under the scene of a plurality of interface servers, the call frequencies reported by the interface servers are collected to obtain the called frequency, and the called frequency can accurately reflect the actual total call frequency of the interface servers. And comparing the called frequency with the application calling frequency applied in advance, and sending a notice to each interface server in batches if the called frequency reaches the application calling frequency, so that each interface server limits the interface calling request within the limit time. Therefore, interface calling requests do not need to be guaranteed to uniformly fall on each interface server, and if the called frequency does not reach the application calling frequency, each interface server receives the corresponding interface calling requests and can normally process the interface calling requests; if the frequency of calling is up to the frequency of applying calling, no matter which interface server receives the corresponding interface calling request, the limitation is carried out, and the accurate control of the frequency of calling the interface is realized.
As shown in fig. 7, in one embodiment, there is provided an interface call frequency control method, including:
step 702, collecting the calling frequency corresponding to the request end identifier and the interface identifier reported by each interface server.
Step 704, summarizing the collected calling frequency according to the frequency control period, and obtaining the called frequency corresponding to the request end identifier and the interface identifier.
Step 706, obtaining the application calling frequency corresponding to the request end identifier and the interface identifier.
Step 708, if the frequency of the call has reached the frequency of the application call, sending in batch an interface call limit notification to each interface server to limit the interface call requests corresponding to the request end identifier and the interface identifier within the limit time.
In this embodiment, not only can the interface identifier be distinguished from controlling the calling frequency of specific interface calling, but also the request end can be distinguished from controlling the interface calling of different request ends, so that the control on the interface calling is more accurate.
As shown in fig. 8, in an embodiment, an interface call frequency control method specifically includes:
step 802, receiving the call frequency corresponding to the request end identifier and the interface identifier reported by the interface server 802. The request identifier may be an IP (Internet Protocol) address or a MAC (Media Access Control) address of the request.
Step 804, reading the called frequency and the application calling frequency corresponding to the request end identifier and the interface identifier from the shared memory.
At step 806, the read called frequency is cleared if the next frequency control cycle has been reached.
And 808, adding the reported calling frequency to the adjusted frequency, and updating the frequency to the shared memory.
Step 810, if the frequency of calling has reached the frequency of applying for calling, sending interface calling limitation notification to each interface server in batch, where the interface calling limitation notification includes a request end identifier, an interface identifier, and a limitation time.
In this embodiment, the shared memory of the frequency control server can efficiently and accurately perform centralized control on the call frequencies of different request terminals and different interfaces.
As shown in fig. 9, in an embodiment, an interface call frequency control method specifically includes:
step 902, collecting the calling frequency corresponding to the request end identifier and the interface identifier reported by each interface server.
Specifically, the request side is divided into different request side clusters, and the different request side clusters are uniquely distinguished through request side cluster identifiers. The frequency control server can collect the calling frequency corresponding to the request end identification and the interface identification reported by each interface server, or collect the calling frequency corresponding to the request end cluster identification and the interface identification reported by each interface server.
And 904, summarizing the collected calling frequencies according to the frequency control period to obtain the called frequencies corresponding to the request end identifier and the interface identifier.
Specifically, the frequency control server may determine a request end cluster identifier corresponding to the request end identifier, so as to collect the collected call frequencies corresponding to the request end cluster identifier and the interface identifier according to the frequency control cycle, and obtain the called frequencies corresponding to the request end cluster identifier and the interface identifier.
Step 906, obtaining a request end cluster identifier corresponding to the request end identifier, and obtaining an application calling frequency corresponding to the request end cluster identifier and the interface identifier.
Specifically, the shared memory caches a dependency relationship between a request end identifier and a request end cluster identifier, and identifies an affiliation relationship between a corresponding request end and a corresponding request end cluster. The frequency control server can read the request end cluster mark corresponding to the request end mark from the shared memory, thereby obtaining the application calling frequency corresponding to the request end cluster mark and the interface mark.
Step 908, if the frequency of calling has reached the frequency of applying for calling, sending in batch an interface call restriction notification to each interface server to restrict the interface call request corresponding to the request end identifier and the interface identifier within the restriction time.
In this embodiment, the request terminals are divided into different request terminal clusters, and the request terminals in the same request terminal cluster share the same application calling frequency, so that the interface calling frequency of the request terminals can be controlled according to the request terminal clusters. In practical application, a new request end can be added into an existing request end cluster to directly use the application calling frequency corresponding to the existing request end cluster identification, and the corresponding frequency control strategy can be replaced by replacing the request end cluster where the request end is located.
In one embodiment, there may be more than one frequency control server, in which case, when the frequency control server calls in work, the calling frequency of the same interface identifier is routed to the same frequency control server.
As shown in fig. 10, in an embodiment, an interface call request processing method is provided, and this embodiment is exemplified by applying the method to the interface server 220 in fig. 2 to 4. The method specifically comprises the following steps:
step 1002, reporting the calling frequency corresponding to the interface identifier to a frequency control server, so that the frequency control server collects the calling frequency reported by each interface server to obtain the called frequency.
In one embodiment, step 1002 includes: and counting the calling frequency corresponding to the interface identifier according to a reporting period, and reporting the calling frequency to a frequency control server, wherein the reporting period is less than the frequency control period. The reporting period is less than the frequency control period, for example, the reporting period may be 5 seconds, and the frequency control period may be, for example, 1 minute. The reporting period can be adjusted, the accuracy of frequency control can be further improved by adjusting the reporting period to be small, and the resource consumption of the frequency control server can be reduced by adjusting the reporting period to be large.
Step 1004 is a reception frequency control server receiving an interface call limit notification transmitted when the call frequency has reached the application call frequency corresponding to the interface identifier.
Specifically, after the interface server reports the call frequency to the frequency control server, the frequency control server implements the interface call frequency control method of each of the above embodiments to process the reported call frequency, and receives an interface call limit notification sent by the frequency call server after processing.
Step 1006, obtaining the interface identifier and the time limit according to the interface call limit notification.
Specifically, after receiving the interface call restriction notification, the interface server extracts the interface identifier and the restriction time from the interface call restriction notification, and correspondingly caches the extracted interface identifier and the restriction time in the shared memory.
Step 1008, receiving the interface call request carrying the interface identifier.
Step 1010, if the time of receiving the interface calling request is within the limit time corresponding to the interface identifier, limiting the interface calling request.
Specifically, the interface server receives an interface calling request carrying an interface identifier sent by a request end, and extracts the interface identifier from the interface calling request, so as to read the limited time corresponding to the interface identifier from the shared memory. And if the time for receiving the interface calling request is within the read limit time, for example, the current time point is less than the time point represented by the limit time, limiting the interface calling request, and returning the feedback information with limited request to the request end.
According to the interface call request processing method, under the scene of a plurality of interface servers, the call frequencies reported by the interface servers are collected to obtain the called frequency, and the called frequency can accurately reflect the actual total call frequency of the interface servers. And comparing the called frequency with the application calling frequency applied in advance, and sending a notice to each interface server in batches if the called frequency reaches the application calling frequency, so that each interface server limits the interface calling request within the limit time. Therefore, interface calling requests do not need to be guaranteed to uniformly fall on each interface server, and if the called frequency does not reach the application calling frequency, each interface server receives the corresponding interface calling requests and can normally process the interface calling requests; if the frequency of calling is up to the frequency of applying calling, no matter which interface server receives the corresponding interface calling request, the limitation is carried out, and the accurate control of the frequency of calling the interface is realized.
In one embodiment, the interface call request processing method further includes: if the time for receiving the interface calling request exceeds the limit time, carrying out interface calling according to the interface calling request, and updating the calling frequency corresponding to the interface identifier; and reporting the interface identification and the updated calling frequency to a frequency control server.
Specifically, if the interface server determines that the limit time corresponding to the interface identifier carried by the interface calling request is not inquired, or the time for receiving the interface calling request exceeds the limit time corresponding to the interface identifier carried by the interface calling request, the interface server normally responds to the interface calling request, performs an interface calling operation according to the interface calling request, and feeds back data generated by performing the interface calling to the request terminal.
And the interface server updates the calling frequency corresponding to the corresponding interface identifier aiming at the normally responded interface calling request, and correspondingly caches the updated calling frequency and the interface identifier into the shared memory. The interface server can specifically read all calling frequencies and corresponding interface identifiers and other identification information generated in the reporting period from the shared memory regularly according to the reporting period, and the identification information is combined into a data packet to be sent to the frequency control server, so that the resource consumption of the interface server and the frequency control server can be saved.
In the embodiment, when the limit time is invalid, the interface call request initiated by the request terminal can be continuously and normally responded, the limit does not need to be cancelled under the control of the frequency control server, and the resource consumption caused by the interaction between the interface server and the frequency control server can be reduced.
As shown in fig. 11, in one embodiment, an interface call request processing method includes:
step 1102, reporting the calling frequency corresponding to the request end identifier and the interface identifier to a frequency control server, so that the frequency control server collects the calling frequency reported by each interface server to obtain the called frequency.
Step 1104 is to receive an interface call limit notification sent by the frequency control server when the called frequency reaches the application call frequency corresponding to the request end identifier and the interface identifier.
Step 1106, obtaining the identifier of the request end, the identifier of the interface and the limit time according to the interface call limit notification.
Step 1108, receiving the interface call request carrying the request end identifier and the interface identifier.
In step 1110, if the time of receiving the interface call request is within the limit time corresponding to the request end identifier and the interface identifier, the interface call request is limited.
In this embodiment, not only can the interface identifier be distinguished from controlling the calling frequency of specific interface calling, but also the request end can be distinguished from controlling the interface calling of different request ends, so that the control on the interface calling is more accurate.
As shown in fig. 12, in one embodiment, an interface call request processing method includes:
step 1202, receiving an interface call request carrying a request end identifier and an interface identifier.
Step 1204, reading the calling frequency and the limiting time corresponding to the request end identifier and the interface identifier from the shared memory.
In step 1206, if the time of receiving the interface call request is within the limit time corresponding to the request end identifier and the interface identifier, the interface call request is limited.
In step 1208, if the time for receiving the interface call request exceeds the limit time, the interface call is performed according to the interface call request, and the call frequency corresponding to the request end identifier and the interface identifier is updated.
Step 1210, periodically reading all the calling frequencies generated in the reporting period, the corresponding interface identifiers and the corresponding request end identifiers from the shared memory according to the reporting period.
Step 1211, combining all the read calling frequencies, corresponding interface identifiers and request end labels into a data packet and sending the data packet to the frequency control server. After receiving the data packet, the frequency control server analyzes the calling frequency, the corresponding interface identifier and the corresponding request end identifier from the data packet and caches the calling frequency, the corresponding interface identifier and the corresponding request end identifier in a shared memory of the frequency control server.
Step 1212, receiving an interface call limit notification sent by the frequency control server when the called frequency reaches the application call frequency corresponding to the request end identifier and the interface identifier, where the interface call limit notification includes the request end identifier, the interface identifier, and the limit time.
Step 1214, the limitation time corresponding to the request terminal identifier and the interface identifier is updated according to the interface call limitation notification.
In this embodiment, the shared memory of the interface server can uniformly report the calling frequencies of different request terminals and different interfaces, so as to improve the efficiency of controlling the calling frequencies of the interfaces.
As shown in fig. 13, in an embodiment, the step 1010 specifically includes the following steps:
step 1302, acquiring a request end cluster identifier carried by the interface call request.
Specifically, the interface call request received in this embodiment carries an interface identifier and a request end cluster identifier, where the carried request end cluster identifier is used to specify a request end cluster to which a request end initiating the interface call request belongs.
In one embodiment, step 1302 includes: extracting a request end identifier and a request end cluster identifier carried by an interface calling request, and judging whether the extracted request end identifier and the request end cluster identifier have a dependency relationship; if yes, go on to step 1304; if not, the interface call request is directly limited.
Step 1304, determining whether the acquired request side cluster identifier has a corresponding application calling frequency.
Specifically, the interface server may determine whether the obtained request end cluster identifier has a corresponding application calling frequency according to a corresponding relationship between the request end cluster identifier, the interface identifier, and the application calling frequency in the database server or the shared memory. If yes, go on to step 1306; and if not, normally responding to the interface calling request.
In step 1306, if there is a corresponding frequency of applying for call and the time of receiving the interface call request is within the limit time corresponding to the request end cluster identifier and the interface identifier, the interface call request is limited.
Specifically, if there is a corresponding application call frequency, the frequency control processing may be performed on the interface call request by using the application call frequency corresponding to the request end cluster identifier. Specifically, the request end identifier belonging to the request end cluster identifier may be searched for in the request end identifier corresponding to the time limit and the carried interface identifier in the shared memory. And if the time for receiving the interface calling request is within the limit time corresponding to the searched request end identification and the carried interface identification, and the limit time is considered to be corresponding to the request end cluster identification, limiting the interface calling request.
In one embodiment, step 1006 includes: and acquiring an interface identifier, a request end cluster identifier and the limit time according to the interface calling limit notice. Step 1306 includes: and if the corresponding application calling frequency exists and the time for receiving the interface calling request is within the limit time corresponding to the request end cluster identifier and the interface identifier read from the shared memory, limiting the interface calling request.
In this embodiment, the request terminals are divided into different request terminal clusters, and the request terminals in the same request terminal cluster share the same application calling frequency, so that the interface calling frequency of the request terminals can be controlled according to the request terminal clusters. In practical application, a new request end can be added into an existing request end cluster to directly use the application calling frequency corresponding to the existing request end cluster identification, and the corresponding frequency control strategy can be replaced by replacing the request end cluster where the request end is located.
As shown in fig. 14, in an embodiment, the step 1010 specifically includes the following steps:
step 1402, obtaining a request end identifier carried by the interface call request.
Specifically, the interface call request received in this embodiment carries an interface identifier, and does not specify a request end cluster to which a request end initiating the interface call request belongs.
In step 1404, the query requester identifies the requester cluster identifier to which the requester belongs.
Specifically, the interface server may query the request end cluster identifier to which the request end identifier carried by the interface call request belongs according to the dependency relationship between the request end identifier and the request end cluster identifier in the shared memory or the database server.
And step 1406, judging whether the queried request end cluster identification has a corresponding application calling frequency.
Specifically, the interface server may determine whether the obtained request end cluster identifier has a corresponding application calling frequency according to a corresponding relationship between the request end cluster identifier, the interface identifier, and the application calling frequency in the database server or the shared memory. If yes, go on to step 1306; and if not, normally responding to the interface calling request.
Step 1408, if there is a corresponding application calling frequency and the time of receiving the interface calling request is within the limit time corresponding to the request end cluster identifier and the interface identifier, the interface calling request is limited.
Specifically, if there is a corresponding application call frequency, the frequency control processing may be performed on the interface call request by using the application call frequency corresponding to the request end cluster identifier. Specifically, the request end identifier belonging to the request end cluster identifier may be searched for in the request end identifier corresponding to the time limit and the carried interface identifier in the shared memory. And if the time for receiving the interface calling request is within the limit time corresponding to the searched request end identification and the carried interface identification, and the limit time is considered to be corresponding to the request end cluster identification, limiting the interface calling request.
In one embodiment, step 1006 includes: and acquiring an interface identifier, a request end cluster identifier and the limit time according to the interface calling limit notice. Step 1408 comprises: and if the corresponding application calling frequency exists and the time for receiving the interface calling request is within the limit time corresponding to the request end cluster identifier and the interface identifier read from the shared memory, limiting the interface calling request.
In this embodiment, the request terminals are divided into different request terminal clusters, and the request terminals in the same request terminal cluster share the same application calling frequency, so that the interface calling frequency of the request terminals can be controlled according to the request terminal clusters. In practical application, a new request end can be added into an existing request end cluster to directly use the application calling frequency corresponding to the existing request end cluster identification, and the corresponding frequency control strategy can be replaced by replacing the request end cluster where the request end is located.
As shown in fig. 15, in one embodiment, there is provided an interface call frequency control apparatus 1500 including: a call frequency collection module 1501, a call frequency summarization module 1502, and an interface call control module 1503.
The call frequency collection module 1501 is configured to collect call frequencies corresponding to the interface identifiers reported by the interface servers.
A call frequency summarizing module 1502 is configured to summarize the collected call frequencies according to the frequency control cycle, and obtain a called frequency corresponding to the interface identifier.
The interface call control module 1503 is configured to obtain an application call frequency corresponding to the interface identifier. And if the called frequency reaches the application calling frequency, sending interface calling limitation notification for limiting the interface calling request corresponding to the interface identifier in a limited time to each interface server in batch.
In a scenario of a plurality of interface servers, the interface call frequency control apparatus 1500 sums the call frequencies reported by the interface servers to obtain an adjusted frequency that accurately reflects the actual total call frequency of the plurality of interface servers. And comparing the called frequency with the application calling frequency applied in advance, and sending a notice to each interface server in batches if the called frequency reaches the application calling frequency, so that each interface server limits the interface calling request within the limit time. Therefore, interface calling requests do not need to be guaranteed to uniformly fall on each interface server, and if the called frequency does not reach the application calling frequency, each interface server receives the corresponding interface calling requests and can normally process the interface calling requests; if the frequency of calling is up to the frequency of applying calling, no matter which interface server receives the corresponding interface calling request, the limitation is carried out, and the accurate control of the frequency of calling the interface is realized.
In an embodiment, the call frequency collecting module 1501 is specifically configured to collect call frequencies corresponding to the request end identifier and the interface identifier, which are reported by each interface server according to a reporting period, where the reporting period is smaller than the frequency control period.
The interface call control module 1503 is specifically configured to obtain an application call frequency corresponding to the request end identifier and the interface identifier; and if the called frequency reaches the application calling frequency, sending interface calling limitation notification for limiting the interface calling request corresponding to the request end identifier and the interface identifier to each interface server in batches within the limitation time.
In this embodiment, not only can the interface identifier be distinguished from controlling the calling frequency of specific interface calling, but also the request end can be distinguished from controlling the interface calling of different request ends, so that the control on the interface calling is more accurate.
In an embodiment, the call frequency summarizing module 1502 is specifically configured to update the cached call frequency corresponding to the interface identifier in the shared memory according to the call frequency collected in the current frequency control period; and clearing the called frequency corresponding to the shared memory and the interface identifier when the current frequency control period is finished.
In an embodiment, the call frequency summarizing module 1502 is specifically configured to summarize the collected call frequencies according to a frequency control cycle, and obtain the called frequencies corresponding to the requestor identifier and the interface identifier.
The interface call control module 1503 is specifically configured to obtain a request end cluster identifier corresponding to the request end identifier, and obtain an application call frequency corresponding to the request end cluster identifier and the interface identifier; and if the called frequency reaches the application calling frequency, sending interface calling limitation notification for limiting the interface calling request corresponding to the request end identifier and the interface identifier to each interface server in batches within the limitation time.
In this embodiment, the request terminals are divided into different request terminal clusters, and the request terminals in the same request terminal cluster share the same application calling frequency, so that the interface calling frequency of the request terminals can be controlled according to the request terminal clusters. In practical application, a new request end can be added into an existing request end cluster to directly use the application calling frequency corresponding to the existing request end cluster identification, and the corresponding frequency control strategy can be replaced by replacing the request end cluster where the request end is located.
As shown in fig. 16, in one embodiment, the interface call frequency control device 1500 further includes: the data management module 1504 is used for reading the application calling frequency corresponding to the interface identifier from the database, and the application calling frequency is written into the database by the frequency calling application platform according to the received calling application; and correspondingly caching the application calling frequency and the interface identification into a shared memory.
The interface call control module 1503 is specifically configured to read, from the shared memory, an application call frequency corresponding to the interface identifier.
In this embodiment, the frequency call application platform system accepts and grants a call permission to the call application of each request terminal, writes the content of the call application into the database after the call permission is granted, and can quickly determine which interfaces need to perform frequency control by querying the database. And the application calling frequency and the interface identification are correspondingly cached in the shared memory, so that the application calling frequency can be efficiently obtained when the application calling frequency is needed.
As shown in fig. 17, in one embodiment, there is provided an interface call request processing apparatus 1700 including: a call frequency reporting module 1701, an interface call limit notification processing module 1702 and an interface call request processing module 1703.
A call frequency reporting module 1701, configured to report the call frequency corresponding to the interface identifier to the frequency control server, so that the frequency control server collects the call frequencies reported by the interface servers to obtain the called frequency.
An interface call limit notification processing module 1702, configured to receive an interface call limit notification sent by the frequency control server when the called frequency reaches the application call frequency corresponding to the interface identifier. And acquiring the interface identifier and the limiting time according to the interface calling limiting notice.
An interface call request processing module 1703, configured to receive an interface call request carrying an interface identifier. And if the time for receiving the interface calling request is within the limit time corresponding to the interface identifier, limiting the interface calling request.
In a scenario of a plurality of interface servers, the interface call request processing apparatus 1700 collects call frequencies reported by the interface servers to obtain a called frequency that accurately reflects a practically total call frequency of the plurality of interface servers. And comparing the called frequency with the application calling frequency applied in advance, and sending a notice to each interface server in batches if the called frequency reaches the application calling frequency, so that each interface server limits the interface calling request within the limit time. Therefore, interface calling requests do not need to be guaranteed to uniformly fall on each interface server, and if the called frequency does not reach the application calling frequency, each interface server receives the corresponding interface calling requests and can normally process the interface calling requests; if the frequency of calling is up to the frequency of applying calling, no matter which interface server receives the corresponding interface calling request, the limitation is carried out, and the accurate control of the frequency of calling the interface is realized.
In an embodiment, the interface call request processing module 1703 is further configured to, if the time for receiving the interface call request exceeds the limit time, perform an interface call according to the interface call request, and update the call frequency corresponding to the interface identifier.
The call frequency reporting module 1701 is further configured to report the interface identifier and the updated call frequency to the frequency control server.
In the embodiment, when the limit time is invalid, the interface call request initiated by the request terminal can be continuously and normally responded, the limit does not need to be cancelled under the control of the frequency control server, and the resource consumption caused by the interaction between the interface server and the frequency control server can be reduced.
In an embodiment, the call frequency reporting module 1701 is specifically configured to count the call frequency corresponding to the interface identifier according to a reporting period, and report the call frequency to the frequency control server, where the reporting period is smaller than the frequency control period.
In one embodiment, the call frequency reporting module 1701 is specifically configured to report the call frequency corresponding to the request end identifier and the interface identifier to the frequency control server.
The interface call restriction notification processing module 1702 is specifically configured to obtain the identifier of the request end, the identifier of the interface, and the restriction time according to the interface call restriction notification.
The interface call request processing module 1703 is specifically configured to receive an interface call request carrying a request end identifier and an interface identifier. And if the time for receiving the interface calling request is within the limit time corresponding to the request end identifier and the interface identifier, limiting the interface calling request.
In this embodiment, not only can the interface identifier be distinguished from controlling the calling frequency of specific interface calling, but also the request end can be distinguished from controlling the interface calling of different request ends, so that the control on the interface calling is more accurate.
In an embodiment, the interface call request processing module 1703 is specifically configured to obtain a request end cluster identifier carried by the interface call request; judging whether the acquired request end cluster identification has a corresponding application calling frequency; and if the corresponding application calling frequency exists and the time for receiving the interface calling request is within the limit time corresponding to the request end cluster identifier and the interface identifier, limiting the interface calling request.
In an embodiment, the interface call request processing module 1703 is specifically configured to obtain a request end identifier carried by the interface call request; inquiring the request end cluster identification to which the request end identification belongs; judging whether the inquired request end cluster identification has a corresponding application calling frequency; and if the corresponding application calling frequency exists and the time for receiving the interface calling request is within the limit time corresponding to the request end cluster identifier and the interface identifier, limiting the interface calling request.
In this embodiment, the request terminals are divided into different request terminal clusters, and the request terminals in the same request terminal cluster share the same application calling frequency, so that the interface calling frequency of the request terminals can be controlled according to the request terminal clusters. In practical application, a new request end can be added into an existing request end cluster to directly use the application calling frequency corresponding to the existing request end cluster identification, and the corresponding frequency control strategy can be replaced by replacing the request end cluster where the request end is located.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the computer program is executed. The storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a Random Access Memory (RAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above examples only show some embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (15)

1. An interface call frequency control method, applied to a multi-interface server scenario, comprising:
receiving a calling application initiated by a request end through a frequency calling application platform, and writing the content of the calling application into a database server when the frequency calling application platform grants a calling right to the calling application; the content of the calling application comprises a corresponding relation of a request end cluster identifier, an interface identifier and a calling frequency of the application;
collecting calling frequency corresponding to the interface identification reported by each interface server;
summarizing the collected calling frequencies respectively reported by each interface server according to a frequency control period to obtain the called frequencies corresponding to the interface identifiers; the method comprises the following steps: updating the cached called frequency corresponding to the request end identifier and the interface identifier in the shared memory according to the calling frequency collected in the current frequency control period; clearing the used frequency corresponding to the shared memory and the interface identifier when the current frequency control cycle is finished;
acquiring application calling frequency corresponding to the interface identifier; the method comprises the following steps: according to the subordination relation between the request end identification and the request end cluster identification which is read and cached in the shared memory from the database server by each interface server, the request end cluster identification corresponding to the request end identification is obtained, and the application calling frequency corresponding to the request end cluster identification and the interface identification is obtained;
if the called frequency reaches the application calling frequency, sending interface calling limitation notification for limiting the interface calling request corresponding to the interface identifier to each interface server in batch in a limited time, wherein the interface calling limitation notification comprises: and sending interface calling limitation notification to each interface server in batch, wherein the interface calling limitation notification limits the interface calling requests corresponding to the request end identifiers and the interface identifiers within the limitation time.
2. The method of claim 1, wherein the collecting the call frequency corresponding to the interface identifier reported by each interface server comprises:
collecting calling frequencies corresponding to the request end identification and the interface identification reported by each interface server according to a reporting period, wherein the reporting period is less than the frequency control period;
the acquiring of the application calling frequency corresponding to the interface identifier includes:
acquiring application calling frequency corresponding to the request end identification and the interface identification;
the sending, to each interface server in batch, an interface call restriction notification that restricts an interface call request corresponding to the interface identifier within a restriction time includes:
and sending interface calling limitation notification for limiting the interface calling requests corresponding to the request end identification and the interface identification in a limited time to each interface server in batch.
3. The method of claim 1, wherein the call frequency is a new call frequency increased in a reporting period or a cumulative call frequency in a frequency control period.
4. The method of claim 1, further comprising:
reading application calling frequency corresponding to the interface identification from a database, wherein the application calling frequency is written into the database by a frequency calling application platform according to a received calling application;
correspondingly caching the application calling frequency and the interface identification into a shared memory;
the acquiring of the application calling frequency corresponding to the interface identifier includes:
and reading the application calling frequency corresponding to the interface identifier from the shared memory.
5. The method of claim 1, wherein the requester identity comprises a requester network IP address or a media access control address.
6. An interface call request processing method, applied to a multi-interface server scenario, includes:
receiving a calling application initiated by a request end through a frequency calling application platform, and writing the content of the calling application into a database server when the frequency calling application platform grants a calling right to the calling application; the content of the calling application comprises a corresponding relation of a request end cluster identifier, an interface identifier and a calling frequency of the application;
reporting calling frequencies corresponding to the interface identifiers to a frequency control server by each interface server, so that the frequency control server collects the calling frequencies reported by each interface server respectively to obtain the called frequencies; the frequency control server collects the calling frequencies respectively reported by the interface servers to obtain the called frequencies, and comprises the following steps: updating the cached called frequency corresponding to the request end identifier and the interface identifier in the shared memory according to the calling frequency collected in the current frequency control period; clearing the used frequency corresponding to the shared memory and the interface identifier when the current frequency control cycle is finished;
the frequency control server also obtains a request end cluster identifier corresponding to the request end identifier according to the subordination relation between the request end identifier and the request end cluster identifier which the interface server reads from the database server and caches in the shared memory, and obtains the application calling frequency corresponding to the request end cluster identifier and the interface identifier; if the called frequency reaches the application calling frequency, interface calling limit notification for limiting the interface calling request corresponding to the request end identifier and the interface identifier in limited time is sent to each interface server in batches;
receiving an interface calling limit notification sent by the frequency control server when the called frequency reaches the application calling frequency corresponding to the interface identifier;
acquiring the interface identifier and the limiting time according to the interface calling limiting notice;
receiving an interface calling request carrying the interface identifier;
and if the time for receiving the interface calling request is within the limit time corresponding to the interface identifier, limiting the interface calling request.
7. The method of claim 6, further comprising:
if the time for receiving the interface calling request exceeds the limit time, carrying out interface calling according to the interface calling request, and updating the calling frequency corresponding to the interface identifier;
and reporting the interface identification and the updated calling frequency to the frequency control server.
8. The method of claim 6, wherein reporting the call frequency corresponding to the interface identifier to the frequency control server comprises:
and counting the calling frequency corresponding to the interface identifier according to a reporting period, and reporting the calling frequency to the frequency control server, wherein the reporting period is less than the frequency control period.
9. The method of claim 6, wherein reporting the call frequency corresponding to the interface identifier to the frequency control server comprises:
reporting calling frequency corresponding to the request end identification and the interface identification to a frequency control server;
the obtaining the interface identifier and the limiting time according to the interface calling limiting notification includes:
obtaining the request end identification, the interface identification and the limiting time according to the interface calling limiting notice;
the interface calling request also carries the request terminal identification; if the time for receiving the interface calling request is within the limit time corresponding to the interface identifier, limiting the interface calling request, including:
and if the time for receiving the interface calling request is within the limit time corresponding to the request end identifier and the interface identifier, limiting the interface calling request.
10. The method of claim 6, wherein the limiting the interface invocation request if the time of receiving the interface invocation request is within the limit time corresponding to the interface identifier comprises:
acquiring a request end cluster identifier carried by the interface calling request;
judging whether the acquired request end cluster identification has a corresponding application calling frequency;
and if the corresponding application calling frequency exists and the time for receiving the interface calling request is within the limit time corresponding to the request end cluster identifier and the interface identifier, limiting the interface calling request.
11. The method of claim 6, wherein the limiting the interface invocation request if the time of receiving the interface invocation request is within the limit time corresponding to the interface identifier comprises:
acquiring a request end identifier carried by the interface calling request;
inquiring the request end cluster identification to which the request end identification belongs;
judging whether the inquired request end cluster identification has a corresponding application calling frequency;
and if the corresponding application calling frequency exists and the time for receiving the interface calling request is within the limit time corresponding to the request end cluster identifier and the interface identifier, limiting the interface calling request.
12. An interface call frequency control apparatus, applied to a multi-interface server scenario, comprising:
the calling frequency collection module is used for collecting calling frequencies corresponding to the interface identifiers and reported by the interface servers;
a calling frequency summarizing module for summarizing the collected calling frequencies respectively reported by each interface server according to a frequency control period to obtain a called frequency corresponding to the interface identifier; updating the cached called frequency corresponding to the request end identifier and the interface identifier in the shared memory according to the calling frequency collected in the current frequency control period; clearing the used frequency corresponding to the shared memory and the interface identifier when the current frequency control cycle is finished;
the interface calling control module is used for acquiring the application calling frequency corresponding to the interface identifier; according to the subordination relation between the request end identification and the request end cluster identification which is read and cached in the shared memory from the database server by each interface server, the request end cluster identification corresponding to the request end identification is obtained, and the application calling frequency corresponding to the request end cluster identification and the interface identification is obtained; if the calling frequency reaches the application calling frequency, interface calling limit notification for limiting the interface calling request corresponding to the interface identifier in a limited time is sent to each interface server in batches; sending interface calling limit notifications to each interface server in batch, wherein the interface calling limit notifications limit the interface calling requests corresponding to the request end identifiers and the interface identifiers within the limit time;
the device is also used for receiving a calling application initiated by a request end through a frequency calling application platform, and writing the content of the calling application into a database server when the frequency calling application platform grants a calling right to the calling application; the content of the calling application comprises a corresponding relation of a request end cluster identifier, an interface identifier and the calling frequency of the application.
13. An interface call request processing apparatus, applied to a multi-interface server scenario, includes:
a calling frequency reporting module, which is used by each interface server to report the calling frequency corresponding to the interface identifier to a frequency control server, so that the frequency control server collects the calling frequency reported by each interface server to obtain the called frequency; the frequency control server collects the calling frequencies respectively reported by the interface servers to obtain the called frequencies, and comprises the following steps: updating the cached called frequency corresponding to the request end identifier and the interface identifier in the shared memory according to the calling frequency collected in the current frequency control period; clearing the used frequency corresponding to the shared memory and the interface identifier when the current frequency control cycle is finished; the frequency control server also obtains a request end cluster identifier corresponding to the request end identifier according to the subordination relation between the request end identifier and the request end cluster identifier which the interface server belongs to and is read from the database server and cached in the shared memory, and obtains the application calling frequency corresponding to the request end cluster identifier and the interface identifier; if the called frequency reaches the application calling frequency, interface calling limit notification for limiting the interface calling request corresponding to the request end identifier and the interface identifier in limited time is sent to each interface server in batches;
an interface call limit notification processing module, configured to receive an interface call limit notification sent by the frequency control server when the called frequency reaches an application call frequency corresponding to the interface identifier; acquiring the interface identifier and the limiting time according to the interface calling limiting notice;
the interface calling request processing module is used for receiving an interface calling request carrying the interface identifier; if the time for receiving the interface calling request is within the limit time corresponding to the interface identifier, limiting the interface calling request;
the device is also used for receiving a calling application initiated by a request end through a frequency calling application platform, and writing the content of the calling application into a database server when the frequency calling application platform grants a calling right to the calling application; the content of the calling application comprises a corresponding relation of a request end cluster identifier, an interface identifier and the calling frequency of the application.
14. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor realizes the steps of the method of any one of claims 1 to 11 when executing the computer program.
15. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 11.
CN201610197050.2A 2016-03-31 2016-03-31 Interface calling frequency control method and device and interface calling request processing method and device Active CN105893150B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610197050.2A CN105893150B (en) 2016-03-31 2016-03-31 Interface calling frequency control method and device and interface calling request processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610197050.2A CN105893150B (en) 2016-03-31 2016-03-31 Interface calling frequency control method and device and interface calling request processing method and device

Publications (2)

Publication Number Publication Date
CN105893150A CN105893150A (en) 2016-08-24
CN105893150B true CN105893150B (en) 2021-04-20

Family

ID=57011788

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610197050.2A Active CN105893150B (en) 2016-03-31 2016-03-31 Interface calling frequency control method and device and interface calling request processing method and device

Country Status (1)

Country Link
CN (1) CN105893150B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106254537B (en) * 2016-09-22 2020-02-07 北京小米移动软件有限公司 Interface calling method and device
CN108572898B (en) * 2017-03-07 2021-11-02 北京京东尚科信息技术有限公司 Method, device, equipment and storage medium for controlling interface
CN107070807A (en) * 2017-04-18 2017-08-18 北京思特奇信息技术股份有限公司 Global traffic control method and system that a kind of distributed environment lower interface is called

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105262821A (en) * 2015-10-29 2016-01-20 努比亚技术有限公司 Interface management apparatus and method

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2234397A1 (en) * 2009-03-24 2010-09-29 Thomson Licensing Methods for delivering and receiving interactive multimedia data attached to an audio video content
CN102137091B (en) * 2010-11-15 2013-11-06 华为技术有限公司 Overload control method, device and system as well as client-side
CN102868770B (en) * 2011-07-05 2016-12-28 腾讯科技(北京)有限公司 A kind of method of distribution interface, equipment and system
CN103379090B (en) * 2012-04-12 2018-10-30 腾讯科技(北京)有限公司 A kind of control method for frequency and system, frequency server of open platform access
CN103701709B (en) * 2013-12-13 2015-07-01 北京京东尚科信息技术有限公司 Flow rate control method and system
CN104683457A (en) * 2015-02-13 2015-06-03 小米科技有限责任公司 Concurrency control method and device

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105262821A (en) * 2015-10-29 2016-01-20 努比亚技术有限公司 Interface management apparatus and method

Also Published As

Publication number Publication date
CN105893150A (en) 2016-08-24

Similar Documents

Publication Publication Date Title
CN107169094B (en) Information aggregation method and device
CA3128540C (en) Cache system hotspot data access method, apparatus, computer device and storage medium
CN105512283A (en) Data quality management and control method and device
CN106027595A (en) Access log processing method and system for CDN node
CN111159233B (en) Distributed caching method, system, computer equipment and storage medium
CN105893150B (en) Interface calling frequency control method and device and interface calling request processing method and device
CN112016030B (en) Message pushing method, device, server and computer storage medium
CN112130996A (en) Data monitoring control system, method and device, electronic equipment and storage medium
CN109542894B (en) User data centralized storage method, device, medium and computer equipment
CN111740868A (en) Alarm data processing method and device and storage medium
CN108763046B (en) Thread running monitoring method, device, computer equipment and storage medium
CN114745275A (en) Node updating method and device in cloud service environment and computer equipment
CN110543509B (en) Monitoring system, method and device for user access data and electronic equipment
CN108696446B (en) Method and device for updating flow characteristic information and central node server
CN114143263B (en) Method, equipment and medium for limiting current of user request
CN108255937B (en) SDN-based resource cleaning method and device, storage medium and computer equipment
CN113448747B (en) Data transmission method, device, computer equipment and storage medium
CN114221807B (en) Access request processing method, device, monitoring equipment and storage medium
CN115499514A (en) Data storage service access method, computing device and computer storage medium
CN110706033B (en) Method, system and medium for analyzing internet advertisement abnormal equipment
CN112148508A (en) Information processing method and related device
CN111343101B (en) Server current limiting method, device, electronic equipment and readable storage medium
CN110333968B (en) Data management method and device applied to database and computer equipment
CN108763291B (en) Data management method and device and electronic equipment
CN115333917A (en) CDN anomaly detection method and device

Legal Events

Date Code Title Description
C06 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