CN111866101B - Access request processing method and device, storage medium and electronic equipment - Google Patents

Access request processing method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN111866101B
CN111866101B CN202010649575.1A CN202010649575A CN111866101B CN 111866101 B CN111866101 B CN 111866101B CN 202010649575 A CN202010649575 A CN 202010649575A CN 111866101 B CN111866101 B CN 111866101B
Authority
CN
China
Prior art keywords
time
access times
access
flow control
interface
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
CN202010649575.1A
Other languages
Chinese (zh)
Other versions
CN111866101A (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.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Shenzhen Huantai Technology Co Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Shenzhen Huantai Technology 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 Guangdong Oppo Mobile Telecommunications Corp Ltd, Shenzhen Huantai Technology Co Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN202010649575.1A priority Critical patent/CN111866101B/en
Publication of CN111866101A publication Critical patent/CN111866101A/en
Application granted granted Critical
Publication of CN111866101B publication Critical patent/CN111866101B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • H04L67/025Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/62Establishing a time schedule for servicing the requests

Abstract

The disclosure provides an access request processing method, an access request processing device, a storage medium and electronic equipment, and relates to the technical field of computers. The access request processing method comprises the following steps: responding to an access request aiming at an interface, and acquiring the current accumulated access times, the current time, the last interface access times and the last time of clearing the access times; the last time the interface was accessed and the last time the access was cleared are static variables; determining a time interval between the current time and the time for clearing the access times last time, comparing the time interval with a time threshold value to obtain a first comparison result, adding 1 to the access times of the last interface based on the first comparison result, and assigning the value to the current accumulated access times to obtain a flow control parameter value; and comparing the flow control parameter value with a flow control threshold value to obtain a second comparison result, and processing the access request according to the second comparison result. The present disclosure implements a lightweight interface flow control scheme.

Description

Access request processing method and device, storage medium and electronic equipment
Technical Field
The present disclosure relates to the field of computer technology, and in particular, to an access request processing method, an access request processing apparatus, a storage medium, and an electronic device.
Background
Applications of flow control are everywhere visible in human society, such as people flow control, traffic flow control, water flow control of dams, and the like. The flow control can ensure safety and improve efficiency. In the internet industry, flow control is also very important, for example, flow control on a server can ensure that the server is safer, and can also ensure that overload situations can not occur on the server.
Currently, for interface traffic, there are some flow control policies, however, these interface flow control policies all have a problem of complex implementation.
Disclosure of Invention
The present disclosure aims to provide an access request processing method, an access request processing device, a storage medium and an electronic device, so as to overcome the problem of complex implementation of interface flow control at least to some extent.
According to a first aspect of the present disclosure, there is provided an access request processing method, including: responding to an access request aiming at an interface, and acquiring the current accumulated access times, the current time, the last interface access times and the last time of clearing the access times; the last time the interface was accessed and the last time the access was cleared are static variables; determining a time interval between the current time and the time for clearing the access times last time, comparing the time interval with a time threshold value to obtain a first comparison result, adding 1 to the access times of the last interface based on the first comparison result, and assigning the value to the current accumulated access times to obtain a flow control parameter value; and comparing the flow control parameter value with a flow control threshold value to obtain a second comparison result, and processing the access request according to the second comparison result.
According to a second aspect of the present disclosure, there is provided an access request processing apparatus including: the request response module is used for responding to the access request aiming at the interface, and acquiring the current accumulated access times, the current time, the last time of the interface access times and the last time of clearing the access times; the last time the interface was accessed and the last time the access was cleared are static variables; the parameter value determining module is used for determining a time interval between the current time and the time for clearing the access times last time, comparing the time interval with a time threshold value to obtain a first comparison result, adding 1 to the access times of the last interface based on the first comparison result, and assigning the value to the current accumulated access times to obtain a flow control parameter value; and the request processing module is used for comparing the flow control parameter value with the flow control threshold value to obtain a second comparison result, and processing the access request according to the second comparison result.
According to a third aspect of the present disclosure, there is provided a storage medium having stored thereon a computer program which, when executed by a processor, implements the above-described access request processing method.
According to a fourth aspect of the present disclosure, there is provided an electronic device comprising a processor; a memory for storing executable instructions of the processor; wherein the processor is configured to perform the above-described access request processing method via execution of the executable instructions.
In some embodiments of the present disclosure, a time interval between a current time and a time when an access number is cleared last time is determined, the time interval is compared with a time threshold, the last interface access number is added with 1 based on a comparison result, and is assigned to a current accumulated access number to obtain a flow control parameter value, the flow control parameter value is compared with a flow control threshold, and then an access request of an interface is processed according to the comparison result. On one hand, the scheme is simple in implementation mode, small in code quantity, capable of being used in a cross-platform mode and different programming languages, and is a lightweight access request control scheme; on the other hand, due to the lightweight property of the scheme, the system can be integrated into a front end, a client and a server, is suitable for different architectures, has little loss on system performance and does not increase the burden of the system; on the other hand, the time threshold and/or the flow control threshold can be adjusted according to scene requirements, so that the flexibility of scheme configuration can be improved, and the application scene of the scheme is wider; on the other hand, in view of the fact that the last time the interface is accessed and the last time the access times are cleared are static variables, the life cycle of the variables is guaranteed to be consistent with that of the process, and the implementation effectiveness of the scheme is guaranteed.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure. It will be apparent to those of ordinary skill in the art that the drawings in the following description are merely examples of the disclosure and that other drawings may be derived from them without undue effort. In the drawings:
FIG. 1 illustrates a schematic diagram of an exemplary system architecture to which an access request processing scheme of an embodiment of the present disclosure is applied;
FIG. 2 schematically illustrates a flow chart of an access request processing method according to an exemplary embodiment of the present disclosure;
FIG. 3 schematically illustrates a flow chart of the overall process of access request processing according to an embodiment of the disclosure;
FIG. 4 schematically illustrates a block diagram of an access request processing apparatus according to an exemplary embodiment of the present disclosure;
fig. 5 schematically shows a block diagram of an electronic device according to an exemplary embodiment of the present disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments may be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the present disclosure. One skilled in the relevant art will recognize, however, that the aspects of the disclosure may be practiced without one or more of the specific details, or with other methods, components, devices, steps, etc. In other instances, well-known technical solutions have not been shown or described in detail to avoid obscuring aspects of the present disclosure.
Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus a repetitive description thereof will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software or in one or more hardware modules or integrated circuits or in different networks and/or processor devices and/or microcontroller devices.
The flow diagrams depicted in the figures are exemplary only and not necessarily all steps are included. For example, some steps may be decomposed, and some steps may be combined or partially combined, so that the order of actual execution may be changed according to actual situations. In addition, all of the following terms "first," "second," are used for distinguishing purposes only and should not be taken as a limitation of the present disclosure.
The flow control policy for the interface traffic may be implemented in a manner such as a leaky bucket algorithm, a token bucket algorithm, an algorithm based on a dis (Remote Dictionary Server, remote dictionary service) counting function, and the like.
However, these strategies all suffer from complex implementation. Moreover, for the leaky bucket algorithm, the processing efficiency is low for the situation that burst traffic exists; for the token bucket algorithm, the flow control is performed on the whole system level, but the flow control cannot be performed on a single service or process; for an algorithm based on the Redis counting function, the implementation mode depends on the establishment of a Redis cluster, and the implementation is complex.
In view of this, the present disclosure provides a new access request processing scheme, which can achieve the purpose of controlling the interface flow, and has simple logic and easy implementation.
Fig. 1 shows a schematic diagram of an exemplary system architecture to which an access request processing scheme of an embodiment of the present disclosure is applied.
As shown in fig. 1, system architecture 1000 may include one or more of terminal devices 1001, 1002, 1003, a network 1004, and a server 1005. The network 1004 serves as a medium for providing a communication link between the terminal apparatuses 1001, 1002, 1003 and the server 1005. The network 1004 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
It should be understood that the number of terminal devices, networks and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation. For example, the server 1005 may be a server cluster formed by a plurality of servers.
A user can interact with a server 1005 via a network 1004 using terminal apparatuses 1001, 1002, 1003 to receive or transmit messages or the like. The terminal devices 1001, 1002, 1003 may be various electronic devices having a display screen including, but not limited to, smartphones, tablet computers, portable computers, desktop computers, and the like.
The server 1005 may be a server providing various services, and may be specifically a web server. For example, the server 1005 may acquire the current accumulated access times, the current time, the last interface access times, and the time when the access times were cleared last time in response to an access request for an interface transmitted by the terminal apparatuses 1001, 1002, 1003 via the network 1004, where the last interface access times and the time when the access times were cleared last time may be defined as static variables in advance; next, the server 1005 may determine a time interval between the current time and a time when the number of accesses was cleared last time, compare the time interval with a time threshold to obtain a first comparison result, add 1 to the number of accesses of the last time interface based on the first comparison result, and assign the first comparison result to the current accumulated number of accesses to obtain a flow control parameter value; the server 1005 may then compare the flow control parameter value to a flow control threshold to obtain a second comparison result, and process the access request according to the second comparison result.
In addition, if the second comparison result is that the flow control parameter value is greater than the flow control threshold value, no further processing is performed on the access request to achieve flow control of the interface.
Note that the access request processing method of the exemplary embodiment of the present disclosure is generally executed by the server 1005, and accordingly, an access request processing apparatus described below is generally configured in the server 1005.
An access request processing method according to an exemplary embodiment of the present disclosure will be described below.
Fig. 2 schematically shows a flowchart of an access request processing method of an exemplary embodiment of the present disclosure. Referring to fig. 2, the access request processing method may include the steps of:
s22, responding to an access request aiming at an interface, and acquiring the current accumulated access times, the current time, the last interface access times and the last time of clearing the access times; the last time the interface was accessed and the last time the access was cleared are static variables.
In an exemplary embodiment of the present disclosure, the interface targeted may be any interface that provides web services (e.g., query, call, download, modify information, etc.), and the present disclosure is not limited in the type of interface.
When the interface caller has a web service processing requirement, the terminal device can send an access request to the server. The interface caller may be a terminal device or other server, which is not limited in this disclosure.
In an exemplary embodiment of the present disclosure, the server may obtain the current accumulated number of accesses (denoted num), the current time (denoted now), the last number of interface accesses (denoted count), and the time when the number of accesses was last cleared (denoted lastTime) in response to the access request. When a class or a structure body is predefined, the last interface access times and the last time of clearing the access times are defined as static variables. In addition, the current accumulated number of accesses may be defined as a local variable.
It is understood that the current accumulated access times indicates the number of received access requests accumulated until the current time from the time when the access times were cleared last time, except for the access requests received this time.
The last time the interface was accessed indicates, the number of access requests received was accumulated the last time the access request was received compared to the current time.
With respect to the scheme of the embodiment of the present disclosure, it can be seen that, before acquiring an access request or after an access request is processed, the current accumulated access times and the variable corresponding to the last interface access times have the same value.
S24, determining a time interval between the current time and the time for clearing the access times last time, comparing the time interval with a time threshold value to obtain a first comparison result, adding 1 to the last interface access times based on the first comparison result, and assigning the current accumulated access times to obtain a flow control parameter value.
First, after acquiring the current time and the time when the number of accesses was cleared last time, the server may calculate the time interval between the two.
The server may then compare the calculated time interval with a time threshold, where the time threshold may be determined by the scenario of the interface processing, may be pre-agreed by the interface caller, or may be set at the server, and the specific value of the time threshold is not limited in this disclosure. In addition, it should be noted that the time threshold may also change as the interface processing scene changes.
And comparing the calculated time interval with a time threshold value to obtain a first comparison result.
And when the first comparison result is that the time interval is larger than the time threshold value, adding 1 to the last interface access times, and assigning the last interface access times to the current accumulated access times. I.e., num= ++count. For example, the last time the interface was accessed is 99998, and after 1 is added, the last time the interface is changed to 99999, and the assigned current accumulated access time is 99999.
In addition, the time at which the number of accesses was cleared last time is updated to the current time, i.e., lasttime=now. For example, when the last time the access number was cleared is 2020-07-01-19:35 and the current time is 2020-07-02-15:30, the updated last time the access number was cleared is 2020-07-02-15:30.
After the result of adding 1 to the last interface access number is assigned to the current accumulated access number, the last interface azimuth number may be set to 0, i.e., count=0. That is, the operation of clearing the number of accesses is performed.
And when the first comparison result is that the time interval is larger than the time threshold value, only the operation of adding 1 to the last interface access times and assigning the last interface access times to the current accumulated access times is executed.
After the assigned current accumulated access times are obtained, the flow control parameter value can be determined by using the assigned current accumulated access times.
According to some embodiments of the present disclosure, the assigned current cumulative number of accesses may be directly determined as the flow control parameter value. That is, the number of accesses is directly used as a basis for determining whether or not to perform flow control.
According to other embodiments of the present disclosure, first, a current accumulated number of accesses after assignment is determined as an intermediate number of accesses; next, the intermediate number of accesses may be divided by the calculated time interval, and the result of the division may be used as a flow control parameter value. In this case, QPS (query-Per-Second) can be used as a basis for determining whether or not to perform flow control.
S26, comparing the flow control parameter value with a flow control threshold value to obtain a second comparison result, and processing the access request according to the second comparison result.
In embodiments that directly utilize the number of accesses as a basis for determining whether to perform flow control, the flow control parameter value may be compared to a flow control threshold, where the flow control threshold is a threshold that represents the number of accumulated accesses, and the disclosure is not limited to a particular value.
In one embodiment, the flow control threshold may be obtained by dividing the number of accesses to the interface by the number of processes within the time threshold. For example, if a cluster requires the control interface to only allow 500 times in 1 minute, 10 processes are deployed, then the flow control threshold is 50.
In an embodiment that utilizes QPS as a basis for determining whether to perform flow control, the flow control threshold represents a threshold of access times per second, and the present disclosure is not limited to a specific value, and for example, the flow control threshold may be set to 100.
It should be understood that the time threshold and/or the flow control threshold may be adjusted according to the scene requirement, so that the flexibility of the scheme configuration may be improved, and the application scene of the scheme is wider.
And comparing the flow control parameter value with the flow control threshold value to obtain a second comparison result.
And under the condition that the flow control parameter value is larger than the flow control threshold value as a second comparison result, the server can send prompt information of failure of processing the access request to the interface calling party. The prompt message may include a cause of the processing failure, that is, the execution of the flow control. In addition, the prompt information may also be null information or information containing other contents, which may be specifically determined according to the configuration of the interface caller, which is not limited in the present disclosure.
In addition, the interface caller may also be prompted that the access request requires queuing. That is, first, the server may calculate the time of queuing and write the time into the hint information; the server then sends the hint information to the interface caller. The prompt information may include information that needs to be queued and time of queuing.
And when the second comparison result is that the flow control parameter value is less than or equal to the flow control threshold value, the server can process the access request and execute the corresponding web service. In addition, the processed result can be fed back to the interface caller.
Furthermore, in other embodiments of the present disclosure, if the program is multi-threaded, a variable may be added in defining the class or structure, i.e., configuring the lock for the thread to read and write correctly.
The entire procedure of the access request processing of the embodiment of the present disclosure will be described below with reference to fig. 3.
In step S302, the server receives an access request; in step S304, the server obtains the current accumulated access times, the current time, the last interface access times, and the last time the access times were cleared.
In step S306, the server determines a time interval between the current time and the time when the number of accesses was cleared last time; in step S308, the server compares the time interval with a time threshold; in step S310, the server determines whether the time interval is greater than a time threshold, and if so, performs step S312, and if not, performs step S314.
In step S312, on the one hand, the server updates the time of clearing the last access times to the current time, and on the other hand, the server adds 1 to the last interface access times and assigns the last interface access times to the current accumulated access times to obtain a flow control parameter value; in yet another aspect, the server sets the last interface access number to 0 after the assignment operation.
In step S314, the server adds 1 to the last interface access number and assigns a value to the current accumulated access number to obtain a flow control parameter value.
In step S316, the server determines whether the flow control parameter value is greater than the flow control threshold, and if so, performs step S318, and if not, performs step S320.
In step S318, the server may send a prompt message to the interface caller that the access request processing failed.
In step S320, the server processes the access request, and feeds back the processing result to the interface caller.
From the above exemplary description, it should be appreciated that the present disclosure exploits the characteristics of static variables, without requiring an additional implementation of a separate flow controller for integrating flow control schemes within a service, thereby reducing developer development, and enabling cross-platform, cross-language, lightweight, efficient features that allow users to override performance issues. In addition, it can be seen that the granularity of the control interface traffic of the scheme is finer, and the control interface traffic can be controlled in a single process not only at the system level.
It should be noted that although the steps of the methods in the present disclosure are depicted in the accompanying drawings in a particular order, this does not require or imply that the steps must be performed in that particular order, or that all illustrated steps be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step to perform, and/or one step decomposed into multiple steps to perform, etc.
Further, the present exemplary embodiment also provides an access request processing apparatus.
Fig. 4 schematically shows a block diagram of an access request processing apparatus of an exemplary embodiment of the present disclosure. Referring to fig. 4, the access request processing apparatus 4 according to an exemplary embodiment of the present disclosure may include a request response module 41, a parameter value determination module 43, and a request processing module 45.
Specifically, the request response module 41 may be configured to obtain the current accumulated access times, the current time, the last access times of the interface, and the last time the access times were cleared in response to the access request for the interface; the last time the interface was accessed and the last time the access was cleared are static variables; the parameter value determining module 43 may be configured to determine a time interval between the current time and a time when the number of accesses is cleared last time, compare the time interval with a time threshold to obtain a first comparison result, add 1 to the number of accesses of the last interface based on the first comparison result, and assign the first comparison result to the current accumulated number of accesses to obtain a flow control parameter value; the request processing module 45 may be configured to compare the flow control parameter value with the flow control threshold value, obtain a second comparison result, and process the access request according to the second comparison result.
According to an example embodiment of the present disclosure, the parameter value determination module 43 may be configured to perform: and under the condition that the time interval is larger than the time threshold value as a first comparison result, updating the time of clearing the access times last time to be the current time.
According to an exemplary embodiment of the present disclosure, the parameter value determination module 43 may be further configured to perform: and under the condition that the time interval is larger than the time threshold value as a first comparison result, setting the last interface access number to 0 after assigning the current accumulated access number.
According to an example embodiment of the present disclosure, the request processing module 45 may be configured to perform: if the second comparison result is that the flow control parameter value is larger than the flow control threshold value, sending prompt information of failure in processing the access request to the interface calling party; wherein the access request is sent by the interface caller.
According to an exemplary embodiment of the present disclosure, the request processing module 45 may be further configured to perform: and processing the access request and feeding back the processed result to the interface calling party under the condition that the flow control parameter value is smaller than or equal to the flow control threshold value as the second comparison result.
According to an exemplary embodiment of the present disclosure, the assigned current accumulated number of accesses is determined as a flow control parameter value.
According to an example embodiment of the present disclosure, the process of the parameter value determination module 43 determining the flow control parameter value may also be configured to perform: determining the assigned current accumulated access times as intermediate access times; dividing the intermediate access times by the time interval, and taking the result obtained by the division as a flow control parameter value.
Since each functional module of the access request processing device in the embodiment of the present invention is the same as that in the embodiment of the present invention, the description thereof is omitted herein.
In an exemplary embodiment of the present disclosure, a computer-readable storage medium having stored thereon a program product capable of implementing the method described above in the present specification is also provided. In some possible embodiments, the various aspects of the invention may also be implemented in the form of a program product comprising program code for causing a terminal device to carry out the steps according to the various exemplary embodiments of the invention as described in the "exemplary methods" section of this specification, when said program product is run on the terminal device.
The program product for implementing the above-described method according to an embodiment of the present invention may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may be run on a terminal device such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical disk, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The computer readable signal medium may include a data signal propagated in baseband or as part of a carrier wave with readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.
Those skilled in the art will appreciate that the various aspects of the invention may be implemented as a system, method, or program product. Accordingly, aspects of the invention may be embodied in the following forms, namely: an entirely hardware embodiment, an entirely software embodiment (including firmware, micro-code, etc.) or an embodiment combining hardware and software aspects may be referred to herein as a "circuit," module "or" system.
An electronic device 500 according to this embodiment of the present invention, corresponding to the server described above, is described below with reference to fig. 5. The electronic device 500 shown in fig. 5 is merely an example, and should not be construed as limiting the functionality and scope of use of embodiments of the present invention.
As shown in fig. 5, the electronic device 500 is embodied in the form of a general purpose computing device. The components of electronic device 500 may include, but are not limited to: the at least one processing unit 510, the at least one memory unit 520, a bus 530 connecting the different system components (including the memory unit 520 and the processing unit 510), and a display unit 540.
Wherein the storage unit stores program code that is executable by the processing unit 510 such that the processing unit 510 performs steps according to various exemplary embodiments of the present invention described in the above section of the "exemplary method" of the present specification. For example, the processing unit 510 may perform steps S12 to S26 as shown in fig. 2.
The storage unit 520 may include readable media in the form of volatile storage units, such as Random Access Memory (RAM) 5201 and/or cache memory unit 5202, and may further include Read Only Memory (ROM) 5203.
The storage unit 520 may also include a program/utility 5204 having a set (at least one) of program modules 5205, such program modules 5205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment.
Bus 530 may be one or more of several types of bus structures including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 500 may also communicate with one or more external devices 600 (e.g., keyboard, pointing device, bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 500, and/or any device (e.g., router, modem, etc.) that enables the electronic device 500 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 550. Also, electronic device 500 may communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet, through network adapter 560. As shown, network adapter 560 communicates with other modules of electronic device 500 over bus 530. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with electronic device 500, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, including several instructions to cause a computing device (may be a personal computer, a server, a terminal device, or a network device, etc.) to perform the method according to the embodiments of the present disclosure.
Furthermore, the above-described drawings are only schematic illustrations of processes included in the method according to the exemplary embodiment of the present invention, and are not intended to be limiting. It will be readily appreciated that the processes shown in the above figures do not indicate or limit the temporal order of these processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, for example, among a plurality of modules.
It should be noted that although in the above detailed description several modules or units of a device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit in accordance with embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into a plurality of modules or units to be embodied.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any adaptations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (6)

1. An access request processing method, comprising:
responding to an access request aiming at an interface, and acquiring the current accumulated access times, the current time, the last interface access times and the last time of clearing the access times; the last time the interface access times and the last time the access times were cleared are static variables, the current accumulated access times are the number of the received access requests except the access requests received this time from the last time the access times were cleared to the current time, the last time the interface access times are the number of the access requests accumulated and received when the access requests were received last time, and the last time the access times were cleared is the time of assigning a result of adding 1 to the last time the interface access times to the current accumulated access times;
determining a time interval between the current time and the time for clearing the last time of the access times, comparing the time interval with a time threshold, adding 1 to the last time of the interface access times and assigning the current accumulated access times when the time interval is larger than the time threshold, updating the time for clearing the last time of the access times to the current time, setting the last time of the interface access times to 0, and determining a flow control parameter value by using the assigned current accumulated access times;
comparing the flow control parameter value with a flow control threshold value, and sending prompt information of failure in processing an access request to an interface calling party under the condition that the flow control parameter value is larger than the flow control threshold value, wherein the access request is sent by the interface calling party; and under the condition that the flow control parameter value is smaller than or equal to the flow control threshold value, processing the access request, and feeding back the processed result to the interface calling party.
2. The access request processing method according to claim 1, wherein the assigned current cumulative number of accesses is determined as a flow control parameter value.
3. The access request processing method according to claim 1, wherein obtaining the flow control parameter value includes:
determining the assigned current accumulated access times as intermediate access times;
dividing the intermediate access times by the time interval, and taking the result obtained by the division as the flow control parameter value.
4. An access request processing apparatus, comprising:
the request response module is used for responding to the access request aiming at the interface, and acquiring the current accumulated access times, the current time, the last time of the interface access times and the last time of clearing the access times; the last time the interface access times and the last time the access times were cleared are static variables, the current accumulated access times are the number of the received access requests except the access requests received this time from the last time the access times were cleared to the current time, the last time the interface access times are the number of the access requests accumulated and received when the access requests were received last time, and the last time the access times were cleared is the time of assigning a result of adding 1 to the last time the interface access times to the current accumulated access times;
the parameter value determining module is used for determining a time interval between the current time and the time for clearing the access times last time, comparing the time interval with a time threshold value, adding 1 to the last time interface access times and assigning the current accumulated access times under the condition that the time interval is larger than the time threshold value, updating the time for clearing the access times last time to the current time, setting the last time interface access times to 0, and determining a flow control parameter value by using the assigned current accumulated access times;
the request processing module is used for comparing the flow control parameter value with a flow control threshold value, and sending prompt information of failure in processing an access request to an interface calling party under the condition that the flow control parameter value is larger than the flow control threshold value, wherein the access request is sent by the interface calling party; and under the condition that the flow control parameter value is smaller than or equal to the flow control threshold value, processing the access request, and feeding back the processed result to the interface calling party.
5. A storage medium having stored thereon a computer program, which when executed by a processor implements the access request processing method of any of claims 1 to 3.
6. An electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the access request processing method of any one of claims 1 to 3 via execution of the executable instructions.
CN202010649575.1A 2020-07-08 2020-07-08 Access request processing method and device, storage medium and electronic equipment Active CN111866101B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010649575.1A CN111866101B (en) 2020-07-08 2020-07-08 Access request processing method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010649575.1A CN111866101B (en) 2020-07-08 2020-07-08 Access request processing method and device, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN111866101A CN111866101A (en) 2020-10-30
CN111866101B true CN111866101B (en) 2023-05-26

Family

ID=73152404

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010649575.1A Active CN111866101B (en) 2020-07-08 2020-07-08 Access request processing method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN111866101B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114640700B (en) * 2020-11-30 2023-04-07 腾讯科技(深圳)有限公司 Calling frequency control method and device
CN113965519B (en) * 2021-09-06 2024-01-26 阿里巴巴(中国)有限公司 Flow control and cluster resource guarantee method, equipment and storage medium
CN114155093B (en) * 2022-02-08 2022-04-19 一方函互联网有限公司 Block chain-based electronic insurance full-flow management and risk management and control system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105100070A (en) * 2015-06-29 2015-11-25 北京奇虎科技有限公司 Method and device for preventing malicious attacks to interface service
CN108880923A (en) * 2017-05-16 2018-11-23 北京京东尚科信息技术有限公司 The method and apparatus that policer operation applied to application server is requested
CN110716794A (en) * 2019-10-14 2020-01-21 网银在线(北京)科技有限公司 Information processing method, device, system and readable storage medium
CN110932988A (en) * 2019-10-31 2020-03-27 北京三快在线科技有限公司 Flow control method and device, electronic equipment and readable storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9571368B2 (en) * 2013-02-04 2017-02-14 International Business Machines Corporation Analysis of variance in network page access
CN107733805B (en) * 2016-08-12 2021-04-16 腾讯科技(深圳)有限公司 Service load scheduling method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105100070A (en) * 2015-06-29 2015-11-25 北京奇虎科技有限公司 Method and device for preventing malicious attacks to interface service
CN108880923A (en) * 2017-05-16 2018-11-23 北京京东尚科信息技术有限公司 The method and apparatus that policer operation applied to application server is requested
CN110716794A (en) * 2019-10-14 2020-01-21 网银在线(北京)科技有限公司 Information processing method, device, system and readable storage medium
CN110932988A (en) * 2019-10-31 2020-03-27 北京三快在线科技有限公司 Flow control method and device, electronic equipment and readable storage medium

Also Published As

Publication number Publication date
CN111866101A (en) 2020-10-30

Similar Documents

Publication Publication Date Title
CN111866101B (en) Access request processing method and device, storage medium and electronic equipment
CN110545246A (en) Token bucket-based current limiting method and device
CN110839084A (en) Session management method, device, equipment and medium
CN113645150B (en) Transmission rate control method, apparatus, electronic device, and readable storage medium
EP4060496A2 (en) Method, apparatus, device and storage medium for running inference service platform
CN111666167A (en) Input event reading processing optimization method, nonvolatile memory and terminal equipment
WO2021012795A1 (en) Network node scheduling method and apparatus, electronic device and storage medium
CN106951294B (en) Method and equipment for providing service for cross-system application
CN115333851A (en) Automatic driving data transmission method and device and electronic equipment
US11431711B2 (en) Method, device and computer program product for service access
CN114374657A (en) Data processing method and device
US20220277300A1 (en) Method and apparatus for executing smart contract
CN115250276A (en) Distributed system and data processing method and device
CN113157375A (en) Content display method, device, equipment, system and storage medium
CN112463616A (en) Chaos testing method and device for Kubernetes container platform
CN116405321B (en) Network data acquisition method, electronic equipment and storage medium
CN111901253B (en) Flow control method, flow control device, flow control medium and electronic equipment for storage system
CN110262756B (en) Method and device for caching data
US11431349B2 (en) Method, electronic device and computer program product for processing data
CN115396436A (en) Service access method, device, electronic equipment and medium
CN116931918A (en) Interface generation method, device, storage medium and electronic equipment
CN115174665A (en) Login state determination method, device, equipment and storage medium
CN116155962A (en) Control method and device of aromatherapy equipment and electronic equipment
CN114422808A (en) Cloud mobile phone interaction method and device, electronic equipment and storage medium
CN113961207A (en) Application control method, device, electronic equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant