WO2022095430A1 - Sliding window configuration method and apparatus, computer device and storage medium - Google Patents

Sliding window configuration method and apparatus, computer device and storage medium Download PDF

Info

Publication number
WO2022095430A1
WO2022095430A1 PCT/CN2021/097187 CN2021097187W WO2022095430A1 WO 2022095430 A1 WO2022095430 A1 WO 2022095430A1 CN 2021097187 W CN2021097187 W CN 2021097187W WO 2022095430 A1 WO2022095430 A1 WO 2022095430A1
Authority
WO
WIPO (PCT)
Prior art keywords
sliding window
factor
memory
current
limiting
Prior art date
Application number
PCT/CN2021/097187
Other languages
French (fr)
Chinese (zh)
Inventor
吴名先
郑丕伟
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2022095430A1 publication Critical patent/WO2022095430A1/en

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/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/11Complex mathematical operations for solving equations, e.g. nonlinear equations, general mathematical optimization problems

Definitions

  • the present application relates to the technical field of security protection, and in particular, to a configuration method, device, computer equipment and storage medium for a sliding window.
  • the current limiting strategy is often used to prevent the server from being paralyzed due to the explosive growth of requests, and the sliding window current limiting is a current limiting method that is often adopted.
  • the inventor realizes that in actual development and testing, the developers do not know the most reasonable parameters of the window current limit in advance, so that the actual effect of the current limit strategy on the project cannot be well evaluated. If the verification needs to wait until the subsequent production process, the rationality evaluation of the current limiting parameter configuration will be delayed. At the same time, the preliminary test can only test the effect at the functional level, and the configuration effect of the current limiting parameter is unpredictable.
  • Embodiments of the present application provide a sliding window configuration method, device, computer equipment, and storage medium, which aim to solve the problem that the existing sliding window current limiting technology cannot accurately configure the number of divisions.
  • an embodiment of the present application provides a method for configuring a sliding window, including:
  • a current-limiting glitch factor is used to quantify the probability of a current-limiting glitch occurring in the sliding window, wherein the current-limiting glitch factor represents the product of the request density and the glitch coverage of the sliding window;
  • the memory factor represents the memory occupied by the target item determined based on the number of divisions of the sliding window
  • the coordinate data representing the abscissa value of the intersection point in the intersection point information is used as the optimal number of divisions of the sliding window.
  • an embodiment of the present application provides a configuration device for a sliding window, including:
  • a current-limiting burr probability quantization unit used for quantifying the probability of a current-limiting burr occurring in the sliding window by using a current-limiting burr factor, wherein the current-limiting burr factor represents the product of the request density of the sliding window and the burr coverage;
  • a memory occupancy quantification unit used for quantifying the impact of the number of divisions of the sliding window on the memory occupation by using a memory factor, wherein the memory factor represents the memory occupied by the target item determined based on the number of divisions of the sliding window;
  • intersection confirmation unit configured to confirm the intersection information of the current-limiting glitch factor and the memory factor
  • a division number setting unit configured to use the coordinate data representing the abscissa value of the intersection point in the intersection point information as the optimal division number of the sliding window.
  • embodiments of the present application provide a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer
  • the configuration method of the sliding window described in the first aspect is implemented in a program.
  • an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when executed by a processor, the computer program causes the processor to execute the process as described in Section 1.
  • the configuration method of the sliding window is described.
  • the embodiments of the present application provide a configuration method, device, computer equipment, and storage medium for a sliding window. Based on the method provided by the embodiments of the present application, the optimal number of divisions can be obtained, thereby effectively reducing the probability of current-limiting glitches, and at the same time Reduce the occupied memory to achieve the optimal current limiting effect.
  • FIG. 1 is a schematic flowchart of a method for configuring a sliding window according to an embodiment of the present application
  • FIG. 2 is a schematic sub-flow diagram of a method for configuring a sliding window according to an embodiment of the present application
  • FIG. 3 is a schematic diagram of another sub-flow of a method for configuring a sliding window according to an embodiment of the present application
  • FIG. 4 is a schematic diagram of another sub-flow of a method for configuring a sliding window provided by an embodiment of the present application
  • FIG. 5 is a schematic diagram of a current-limiting glitch factor curve and a memory factor curve provided by an embodiment of the present application
  • FIG. 6 is a schematic block diagram of an apparatus for configuring a sliding window according to an embodiment of the present application
  • FIG. 7 is a schematic block diagram of subunits of a sliding window configuration device provided by an embodiment of the present application.
  • FIG. 8 is a schematic block diagram of another subunit of a sliding window configuration device provided by an embodiment of the present application.
  • FIG. 9 is a schematic block diagram of another subunit of a sliding window configuration device provided by an embodiment of the present application.
  • FIG. 10 is a schematic block diagram of a computer device provided by an embodiment of the present application.
  • FIG. 1 is a flowchart of a method for configuring a sliding window provided by an embodiment of the present application. As shown in the figure, the method includes steps S101 to S104:
  • the sliding window current limiting is a current limiting strategy, which can avoid some drawbacks of the fixed window current limiting.
  • the core parameter of the sliding window is the number of divisions (x) of the window. The more divisions, the higher the sliding frequency, and the fewer the divisions, the lower the sliding frequency. Under different sliding frequencies, it has different current-limiting effects, and the probability of current-limiting burrs occurring is also different.
  • a current-limiting burr factor is used to quantify the probability of current-limiting burrs occurring in the sliding window.
  • the step S101 includes steps S201-S205:
  • the value of the sliding window is preset, for example, the value of the sliding window can be 6s, and the number of divisions is an independent variable, so it can be represented by an independent variable x.
  • the sliding window represents the size of the current-limiting area. Divide the sliding window according to the number of divisions to obtain multiple small windows, that is, divide the value of the sliding window by the value of the number of divisions to obtain the value of the small window.
  • the value of the sliding window is 6s, and the number of divisions is 6, then 6 small windows with the same size and continuous can be obtained, and the size of each small window is 1s. That is, the sliding interval is 1s.
  • the size of the entire sliding window is subtracted from the size of the small window, so as to obtain the area where the previous sliding window and the current sliding window overlap, and this area is the burr occurrence probability area, and the burr occurrence probability can be obtained by the above subtraction area size.
  • the value of the sliding window is 6s, and the value of the small window is 1s, then the size of the glitch probability area is 5s.
  • the value of the entire sliding window is divided by the value of the aforementioned burr occurrence probability area, and the obtained value is the burr coverage, and the burr coverage represents the coverage of the burr in the sliding window.
  • the value of the sliding window is 6s, and the value of the burr occurrence probability area is 5s, then the burr coverage is 1.2.
  • the function of the sliding window is to limit the number of requests.
  • the maximum number of requests allowed by the sliding window represents the maximum number of requests allowed by the sliding window.
  • the maximum number of requests allowed by the sliding window is 120 times, and the value of the sliding window is 6s, then the request density is 20.
  • the value of the current-limiting burr factor is calculated according to the value of the requested density and the burr coverage, and specifically, the value of the requested density is multiplied by the value of the burr coverage. For example, if the requested density is 20 and the glitch coverage is 1.2, then the current-limit glitch factor is 24.
  • the current-limiting glitch factor Y is calculated as follows:
  • T is the value of the sliding window
  • x is the number of divisions
  • Q is the value of the maximum number of requests allowed for the sliding window.
  • the embodiment of the present application introduces a memory factor to measure the increase of the memory occupied with the increase of the number of divisions.
  • the step S102 includes steps S301-S302:
  • the values of a and b can be initialized first, that is, an initial value is set, and then according to the available memory of the target project
  • the size optimizes the values of a and b, so that the values of a and b are constantly close to the target value, so that the relationship between the number of divisions and F is closer to the real situation.
  • the current-limiting glitch factor and the memory factor represent constraints on the number of divisions, and the two express the influence of the number of divisions on the real situation from different angles.
  • the application can draw the curve represented by the current-limiting glitch factor and the curve represented by the memory factor, thereby determining the number of divisions.
  • the step S103 includes steps S401 to S403:
  • This step is to draw the current-limiting glitch factor curve.
  • the calculation formula of the current-limiting glitch factor in this embodiment is:
  • the current-limiting glitch factor will tend to a fixed value as the number of divisions increases. Therefore, taking the number of divisions as the abscissa and the current-limiting glitch factor as the ordinate, the current-limiting glitch factor curve will gradually decrease with the increase of the number of divisions and approach a fixed value. the curve.
  • the starting point of the abscissa of the above current-limiting glitch factor curve is 2, and the end point can be set not or within a certain range, such as 100 or 200, because if the number of divisions is continuously increased, the memory occupied by it will continue to increase. large, the subsequent curves will be of no practical significance.
  • This step is to draw the memory factor curve.
  • the calculation formula of the memory factor curve in this embodiment is:
  • the memory factor will increase with the increase of the number of divisions, and it will increase linearly, so the memory factor curve obtained by taking the number of divisions as the abscissa and the memory factor as the ordinate will be a curve with the number of divisions increases and linearly increases.
  • the curve in the embodiment of the present application is a curve in a broad concept, which also includes the concept of a straight line.
  • the b can be set to 0, then the memory factor and the number of divisions will form a proportional relationship, that is, starting from the origin of the coordinate axis and extending along a straight line.
  • the intersection information of the current-limiting glitch factor curve and the memory factor curve is acquired, where the intersection information includes the abscissa and the ordinate of the intersection.
  • the coordinate data representing the abscissa value of the intersection point in the intersection point information is used as the optimal number of divisions of the sliding window.
  • the glitch factor curve is also the current-limiting glitch factor curve.
  • the current-limiting glitch factor curve is a continuously decreasing curve
  • the memory factor curve is a continuously rising curve.
  • the two will intersect at a certain point, the intersecting point is the intersection, and the abscissa of this intersection is the optimal number of divisions.
  • the meaning of the intersection point is the set number of divisions, just so that the current-limiting glitch factor can be directed to a fixed value close, and at the same time, it can ensure that the memory factor is not too high and achieves the role of the optimal critical point.
  • the method after taking the coordinate data representing the abscissa value of the intersection in the intersection information as the optimal number of divisions of the sliding window, the method includes:
  • the optimal number of divisions is used as the number of divisions of the sliding window to limit the current of the received requests.
  • the optimal number of divisions is used as the number of divisions of the sliding window, and then the sliding window and the maximum allowable number of requests of the sliding window are used to limit the current of the received requests.
  • Using the method provided by the embodiments of the present application to limit the current can reduce the probability of the occurrence of the current-limiting burr, reduce the occupied memory, and achieve the optimal current-limiting effect.
  • the initial parameters of the unary primary relationship are parameterized, and the optimized parameters are obtained, including:
  • the available memory size of the target item is acquired, and the slope of the unary primary relationship is adjusted according to the available memory size.
  • the slope of the memory factor curve may be adjusted according to the actual application scenario (ie, the target project). Adjust the slope to a small value. If the available memory in the actual application scenario is small (the memory is relatively tight), you can adjust the slope to a large value, so that the optimal number of divisions can be selected according to the actual situation.
  • the acquiring the available memory size of the target item, and adjusting the slope of the unary primary relationship according to the available memory size includes:
  • the slope is queried in the memory factor database according to the range to which the available memory size belongs, and the memory factor is set according to the slope, wherein the memory factor database stores the corresponding relationship between the range of different memory sizes and the slope.
  • the corresponding relationship between the available memory size range and the slope can be preset, and the corresponding relationship is stored in the memory factor library, so that in the actual project, the available memory size can be obtained, so as to determine its belonging range, and then query the corresponding slope from the memory factor library, and then set the slope of the memory factor according to the slope.
  • the memory factor curve can be made more in line with the real situation of the actual project, and the available memory size can also be acquired in real time, and the slope of the memory factor can be dynamically adjusted, thereby dynamically adjusting the number of divisions of the sliding window.
  • the embodiment of the present application further provides a configuration device for a sliding window, and the configuration device for a sliding window is used to execute any embodiment of the foregoing method for configuring a sliding window.
  • FIG. 6 is a schematic block diagram of an apparatus for configuring a sliding window provided by an embodiment of the present application.
  • the configuration device 600 of the sliding window can be configured in the server.
  • the configuration device 600 of the sliding window may include:
  • a current-limiting glitch probability quantification unit 601 configured to quantify the probability of a current-limiting glitch occurring in the sliding window by using a current-limiting glitch factor, wherein the current-limiting glitch factor represents the product of the request density and the glitch coverage of the sliding window;
  • the memory occupation quantification unit 602 is used to quantify the impact of the partition number of the sliding window on the memory occupation by using a memory factor, wherein the memory factor represents the memory occupied by the target item determined based on the partition number of the sliding window;
  • an intersection confirmation unit 603, configured to confirm the intersection information of the current-limiting glitch factor and the memory factor
  • the division number setting unit 604 is configured to use the coordinate data representing the abscissa value of the intersection point in the intersection point information as the optimal division number of the sliding window.
  • the current-limiting glitch probability quantization unit 601 includes:
  • Representation unit 701 used to obtain the value of the sliding window, and will use the independent variable x to represent the number of divisions;
  • a small window calculation unit 702 configured to calculate the value of the sliding window divided by the value of the division number to obtain the size of the small window
  • a glitch occurrence probability area calculation unit 703, configured to subtract the value of the small window from the value of the sliding window to obtain a glitch occurrence probability area
  • a burr coverage calculation unit 704 configured to divide the value of the sliding window by the value of the burr occurrence probability region to obtain the burr coverage
  • a request density calculation unit 705, configured to divide the value of the maximum allowable number of requests of the sliding window by the value of the sliding window to obtain the request density
  • the current-limiting glitch factor calculation unit 706 is configured to multiply the value of the requested density by the value of the burr coverage to obtain the current-limiting glitch factor.
  • the memory occupancy quantization unit 602 includes:
  • the relationship setting unit 801 is used to pre-set the relationship between the memory factor and the number of divisions of the sliding window as a one-dimensional primary relationship, and set the initial parameters of the one-dimensional primary relationship;
  • a parameter optimization unit 802 configured to perform parameter optimization on the initial parameters of the one-dimensional linear relationship according to the available memory size of the target item to obtain optimized parameters.
  • intersection confirmation unit 603 includes:
  • a current-limiting burr factor curve drawing unit 901 configured to draw the current-limiting burr obtained by taking the division number as the abscissa and the current-limiting burr factor as the ordinate, which is obtained by changing the current-limiting burr factor with the number of divisions of the sliding window factor curve;
  • a memory factor curve drawing unit 902 configured to draw a memory factor curve obtained by taking the division number as the abscissa and the memory factor as the ordinate;
  • the intersection obtaining unit 903 is configured to obtain intersection information of the current-limiting glitch factor curve and the memory factor curve.
  • the sliding window configuration device 600 further includes:
  • a current limiting unit configured to use the optimal number of divisions as the number of divisions of the sliding window to limit the current of the received requests.
  • the parameter optimization unit 802 includes:
  • a slope adjustment unit configured to obtain the available memory size of the target item, and adjust the slope of the unary primary relationship according to the available memory size.
  • the slope adjustment unit includes:
  • a range obtaining unit configured to obtain the available memory size of the target item, and obtain the range to which the available memory size belongs;
  • a slope setting unit configured to query the slope in a preset memory factor library according to the range to which the available memory size belongs, and set the memory factor according to the slope, wherein different memories are stored in the memory factor library The corresponding relationship between the range to which the size belongs and the slope.
  • the optimal number of divisions can be obtained, thereby effectively reducing the probability of occurrence of current limiting burrs, reducing the occupied memory at the same time, and achieving the optimal current limiting effect.
  • the above-mentioned configuration apparatus 600 for a sliding window can be implemented in the form of a computer program, and the computer program can be executed on a computer device as shown in FIG. 10 .
  • FIG. 10 is a schematic block diagram of a computer device provided by an embodiment of the present application.
  • the computer device 10 is a server, and the server may be an independent server or a server cluster composed of multiple servers.
  • the computer device 1000 includes a processor 1002 , a memory and a network interface 1005 connected through a system bus 1001 , wherein the memory may include a non-volatile storage medium 1003 and an internal memory 1004 .
  • the nonvolatile storage medium 1003 can store an operating system 10031 and a computer program 10032 .
  • the computer program 10032 When executed, it can cause the processor 1002 to execute the configuration method of the sliding window.
  • the processor 1002 is used to provide computing and control capabilities to support the operation of the entire computer device 1000 .
  • the internal memory 1004 provides an environment for running the computer program 10032 in the non-volatile storage medium 1003.
  • the processor 1002 can execute the sliding window configuration method.
  • the network interface 1005 is used for network communication, such as providing transmission of data information.
  • the network interface 1005 is used for network communication, such as providing transmission of data information.
  • FIG. 10 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 1000 to which the solution of the present application is applied.
  • the specific computer device 1000 may include more or fewer components than shown, or combine certain components, or have a different arrangement of components.
  • the processor 1002 is configured to run the computer program 10032 stored in the memory, so as to realize the following function: using a current-limiting glitch factor to quantify the probability of a current-limiting glitch occurring in the sliding window, wherein the current-limiting glitch factor represents the The product of the request density of the sliding window and the burr coverage; using a memory factor to quantify the impact of the number of divisions of the sliding window on the memory occupation, wherein the memory factor represents the target item determined based on the number of divisions of the sliding window The occupied memory; confirming the intersection information of the current-limiting glitch factor and the memory factor; and taking the coordinate data representing the abscissa value of the intersection in the intersection information as the optimal number of divisions of the sliding window.
  • the processor 1002 quantifies the probability of the current-limiting glitch occurring in the sliding window by using the current-limiting glitch factor, wherein the current-limiting glitch factor represents the product of the request density and the glitch coverage of the sliding window.
  • the step of perform the following operations: obtain the value of the sliding window, and use the independent variable x to represent the number of divisions; calculate the value of the sliding window divided by the value of the number of divisions to obtain the size of the small window; Subtract the value of the sliding window from the value of the small window to obtain the glitch occurrence probability area; divide the value of the sliding window by the value of the glitch occurrence probability area to obtain the glitch coverage; The value of the maximum allowable number of requests is divided by the value of the sliding window to obtain the request density; the value of the request density is multiplied by the value of the burr coverage to obtain the current limiting burr factor.
  • the processor 1002 quantifies the impact of the number of partitions of the sliding window on memory occupation by using a memory factor, wherein the memory factor represents the amount of space occupied by the target item determined based on the number of partitions of the sliding window.
  • the step of memory perform the following operations: set the relationship between the memory factor and the number of divisions of the sliding window as a one-dimensional relationship in advance, and set the initial parameters of the one-dimensional relationship; according to the available memory of the target item Parameter optimization is performed on the initial parameters of the one-dimensional linear relationship to obtain the optimized parameters.
  • the processor 1002 when the processor 1002 performs the step of confirming the intersection point information of the current-limiting glitch factor and the memory factor, the processor 1002 performs the following operations: taking the division number as the abscissa, the current-limiting glitch
  • the current-limiting glitch factor curve obtained by plotting the current-limiting glitch factor with the number of divisions of the sliding window as the ordinate is the factor; plotting the current-limiting glitch factor curve with the division number as the abscissa and the memory factor as the ordinate.
  • the memory factor curve obtained by changing the number of divisions of the sliding window; and obtaining the intersection point information of the current-limiting glitch factor curve and the memory factor curve.
  • the processor 1002 after performing the step of using the coordinate data representing the abscissa value of the intersection in the intersection information as the optimal number of divisions of the sliding window, the processor 1002 performs the following operation: using the optimal The number of divisions is used as the number of divisions of the sliding window to limit the current of the received requests.
  • the processor 1002 when the processor 1002 performs the step of performing parameter optimization on the initial parameters of the unary primary relationship according to the available memory size of the target item to obtain the optimized parameters, the processor 1002 performs the following operations: obtaining the The available memory size of the target item is adjusted, and the slope of the unary primary relationship is adjusted according to the available memory size.
  • the processor 1002 when the processor 1002 performs the step of acquiring the available memory size of the target item and adjusting the slope of the unary primary relationship according to the available memory size, the processor 1002 performs the following operations: acquiring the target item The available memory size of the project, and obtain the range to which the available memory size belongs; query the slope in the preset memory factor library according to the range to which the available memory size belongs, and set the memory factor according to the slope, wherein, The memory factor library stores the correspondence between the ranges and slopes to which different memory sizes belong.
  • the embodiment of the computer device shown in FIG. 10 does not constitute a limitation on the specific structure of the computer device. Either some components are combined, or different component arrangements.
  • the computer device may only include a memory and a processor.
  • the structures and functions of the memory and the processor are the same as those of the embodiment shown in FIG. 10 , which will not be repeated here.
  • the processor 1002 may be a central processing unit (Central Processing Unit, CPU), and the processor 1002 may also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor can be a microprocessor or the processor can also be any conventional processor or the like.
  • a computer-readable storage medium may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium.
  • the computer-readable storage medium stores a computer program, wherein when the computer program is executed by the processor, the following steps are implemented: using a current-limiting glitch factor to quantify the probability of a current-limiting glitch occurring in the sliding window, wherein the current-limiting glitch factor represents all the current-limiting glitches.
  • the product of the request density of the sliding window and the burr coverage adopt the memory factor to quantify the impact of the number of divisions of the sliding window on the memory occupation, wherein, the memory factor represents the target item determined based on the number of divisions of the sliding window. Occupied memory; confirming the intersection information of the current-limiting glitch factor and the memory factor; taking the coordinate data representing the abscissa value of the intersection in the intersection information as the optimal number of divisions of the sliding window.
  • the disclosed apparatus, apparatus and method may be implemented in other manners.
  • the device embodiments described above are only illustrative.
  • the division of the units is only logical function division.
  • there may be other division methods, or units with the same function may be grouped into one Units, such as multiple units or components, may be combined or may be integrated into another system, or some features may be omitted, or not implemented.
  • the shown or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may also be electrical, mechanical or other forms of connection.
  • the units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solutions of the embodiments of the present application.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a storage medium.
  • the technical solutions of the present application are essentially or part of contributions to the prior art, or all or part of the technical solutions can be embodied in the form of software products, and the computer software products are stored in a storage medium , including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage medium includes: a U disk, a removable hard disk, a read-only memory (ROM, Read-Only Memory), a magnetic disk or an optical disk and other media that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Mathematical Physics (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Analysis (AREA)
  • Computational Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Pure & Applied Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Operations Research (AREA)
  • Algebra (AREA)
  • Databases & Information Systems (AREA)
  • Memory System (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

A sliding window configuration method and apparatus, a computer device and a storage medium, relating to the field of security protection technology. Said method comprises: using a current-limiting burr factor to quantify the probability of a current-limiting burr occurring in a sliding window, wherein the current-limiting burr factor characterizes a product of a request density of the sliding window and a burr coverage degree (S101); using a memory factor to quantify the effect of a segmentation number of the sliding window on memory occupancy, wherein the memory factor characterizes the memory occupied by a target item determined on the basis of the segmentation number of the sliding window (S102); confirming information of intersection of the current-limiting burr factor and the memory factor (S103); and taking coordinate data characterizing a horizontal coordinate value of the intersection in the intersection information as an optimal segmentation number of the sliding window (S104). With said method, an optimal segmentation number can be obtained, thereby effectively reducing the probability of a current-limiting burr occurring, whilst reducing the occupied memory, so as to achieve an optimal current-limiting effect.

Description

一种滑动窗口的配置方法、装置、计算机设备及存储介质A sliding window configuration method, device, computer equipment and storage medium
本申请要求于2020年11月06日提交中国专利局、申请号为202011229805.5,发明名称为“一种滑动窗口的配置方法、装置、计算机设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on November 06, 2020 with the application number 202011229805.5 and the title of the invention is "A sliding window configuration method, device, computer equipment and storage medium", all of which are The contents are incorporated herein by reference.
技术领域technical field
本申请涉及安全防护技术领域,尤其涉及一种滑动窗口的配置方法、装置、计算机设备及存储介质。The present application relates to the technical field of security protection, and in particular, to a configuration method, device, computer equipment and storage medium for a sliding window.
背景技术Background technique
在现有技术中,经常会使用限流策略来防止请求的爆发式增长而造成服务器的瘫痪,滑动窗口限流是经常被采用的一种限流方式。但是发明人意识到在实际的开发和测试中,开发人员事先并不知道窗口限流的最合理的参数,导致并不能很好的评估该限流策略对项目的实际作用。如需要等到后续生产过程才进行验证,导致限流参数配置的合理性评估滞后;同时前期测试只能测试功能层面的效果,限流参数的配置效果不可预知。In the prior art, the current limiting strategy is often used to prevent the server from being paralyzed due to the explosive growth of requests, and the sliding window current limiting is a current limiting method that is often adopted. However, the inventor realizes that in actual development and testing, the developers do not know the most reasonable parameters of the window current limit in advance, so that the actual effect of the current limit strategy on the project cannot be well evaluated. If the verification needs to wait until the subsequent production process, the rationality evaluation of the current limiting parameter configuration will be delayed. At the same time, the preliminary test can only test the effect at the functional level, and the configuration effect of the current limiting parameter is unpredictable.
申请内容Application content
本申请实施例提供了一种滑动窗口的配置方法、装置、计算机设备及存储介质,旨在解决现有滑动窗口限流技术无法准确配置分割数的问题。Embodiments of the present application provide a sliding window configuration method, device, computer equipment, and storage medium, which aim to solve the problem that the existing sliding window current limiting technology cannot accurately configure the number of divisions.
第一方面,本申请实施例提供了一种滑动窗口的配置方法,其中,包括:In a first aspect, an embodiment of the present application provides a method for configuring a sliding window, including:
采用限流毛刺因子对滑动窗口发生限流毛刺的概率进行量化,其中,所述限流毛刺因子表征所述滑动窗口的请求密度与毛刺覆盖度的乘积;A current-limiting glitch factor is used to quantify the probability of a current-limiting glitch occurring in the sliding window, wherein the current-limiting glitch factor represents the product of the request density and the glitch coverage of the sliding window;
采用内存因子对滑动窗口的分割数对内存占用的影响进行量化,其中,所述内存因子表征基于所述滑动窗口的分割数确定的目标项目所占用的内存;Using a memory factor to quantify the impact of the number of divisions of the sliding window on the memory occupation, wherein the memory factor represents the memory occupied by the target item determined based on the number of divisions of the sliding window;
确认所述限流毛刺因子与所述内存因子的交点信息;Confirm the intersection information of the current-limiting glitch factor and the memory factor;
将所述交点信息中表征交点横坐标数值的坐标数据作为所述滑动窗口的最佳分割数。The coordinate data representing the abscissa value of the intersection point in the intersection point information is used as the optimal number of divisions of the sliding window.
第二方面,本申请实施例提供了一种滑动窗口的配置装置,其中,包括:In a second aspect, an embodiment of the present application provides a configuration device for a sliding window, including:
限流毛刺概率量化单元,用于采用限流毛刺因子对滑动窗口发生限流毛刺的概率进行量化,其中,所述限流毛刺因子表征滑动窗口的请求密度与毛刺覆盖度的乘积;a current-limiting burr probability quantization unit, used for quantifying the probability of a current-limiting burr occurring in the sliding window by using a current-limiting burr factor, wherein the current-limiting burr factor represents the product of the request density of the sliding window and the burr coverage;
内存占用量化单元,用于采用内存因子对滑动窗口的分割数对内存占用的影响进行量化,其中,所述内存因子表征基于滑动窗口的分割数确定的目标项目所占用的内存;a memory occupancy quantification unit, used for quantifying the impact of the number of divisions of the sliding window on the memory occupation by using a memory factor, wherein the memory factor represents the memory occupied by the target item determined based on the number of divisions of the sliding window;
交点确认单元,用于确认所述限流毛刺因子与所述内存因子的交点信息;an intersection confirmation unit, configured to confirm the intersection information of the current-limiting glitch factor and the memory factor;
分割数设置单元,用于将所述交点信息中表征交点横坐标数值的坐标数据作为所述滑动窗口的最佳分割数。A division number setting unit, configured to use the coordinate data representing the abscissa value of the intersection point in the intersection point information as the optimal division number of the sliding window.
第三方面,本申请实施例提供了一种计算机设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现如第一方面所述的滑动窗口的配置方法。In a third aspect, embodiments of the present application provide a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer The configuration method of the sliding window described in the first aspect is implemented in a program.
第四方面,本申请实施例提供了一种计算机可读存储介质,其中,所述计算机可读存储介质存储有计算机程序,所述计算机程序当被处理器执行时使所述处理器执行如第一方面所述的滑动窗口的配置方法。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when executed by a processor, the computer program causes the processor to execute the process as described in Section 1. In one aspect, the configuration method of the sliding window is described.
本申请实施例提供了一种滑动窗口的配置方法、装置、计算机设备及存储介质,基于本申请实施例提供的方法,可以获取最优的分割数,从而有效降低限流毛刺发生的概率,同时降低占用的内存,达到最优的限流效果。The embodiments of the present application provide a configuration method, device, computer equipment, and storage medium for a sliding window. Based on the method provided by the embodiments of the present application, the optimal number of divisions can be obtained, thereby effectively reducing the probability of current-limiting glitches, and at the same time Reduce the occupied memory to achieve the optimal current limiting effect.
附图说明Description of drawings
为了更清楚地说明本申请实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solutions of the embodiments of the present application more clearly, the following briefly introduces the accompanying drawings used in the description of the embodiments. For those of ordinary skill, other drawings can also be obtained from these drawings without any creative effort.
图1为本申请实施例提供的一种滑动窗口的配置方法的流程示意图;1 is a schematic flowchart of a method for configuring a sliding window according to an embodiment of the present application;
图2为本申请实施例提供的一种滑动窗口的配置方法的子流程示意图;2 is a schematic sub-flow diagram of a method for configuring a sliding window according to an embodiment of the present application;
图3为本申请实施例提供的一种滑动窗口的配置方法的另一子流程示意图;3 is a schematic diagram of another sub-flow of a method for configuring a sliding window according to an embodiment of the present application;
图4为本申请实施例提供的一种滑动窗口的配置方法的另一子流程示意图;4 is a schematic diagram of another sub-flow of a method for configuring a sliding window provided by an embodiment of the present application;
图5为本申请实施例提供的限流毛刺因子曲线和内存因子曲线的示意图;5 is a schematic diagram of a current-limiting glitch factor curve and a memory factor curve provided by an embodiment of the present application;
图6为本申请实施例提供的一种滑动窗口的配置装置的示意性框图;6 is a schematic block diagram of an apparatus for configuring a sliding window according to an embodiment of the present application;
图7为本申请实施例提供的一种滑动窗口的配置装置的子单元示意性框图;FIG. 7 is a schematic block diagram of subunits of a sliding window configuration device provided by an embodiment of the present application;
图8为本申请实施例提供的一种滑动窗口的配置装置的另一子单元示意性框图;FIG. 8 is a schematic block diagram of another subunit of a sliding window configuration device provided by an embodiment of the present application;
图9为本申请实施例提供的一种滑动窗口的配置装置的另一子单元示意性框图;9 is a schematic block diagram of another subunit of a sliding window configuration device provided by an embodiment of the present application;
图10为本申请实施例提供的计算机设备的示意性框图。FIG. 10 is a schematic block diagram of a computer device provided by an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
应当理解,当在本说明书和所附权利要求书中使用时,术语“包括”和“包含”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。It is to be understood that, when used in this specification and the appended claims, the terms "comprising" and "comprising" indicate the presence of the described features, integers, steps, operations, elements and/or components, but do not exclude one or The presence or addition of a number of other features, integers, steps, operations, elements, components, and/or sets thereof.
还应当理解,在此本申请说明书中所使用的术语仅仅是出于描述特定实施例的目的而并不意在限制本申请。如在本申请说明书和所附权利要求书中所使用的那样,除非上下文清楚地指明其它情况,否则单数形式的“一”、“一个”及“该”意在包括复数形式。It should also be understood that the terminology used in the specification of the application herein is for the purpose of describing particular embodiments only and is not intended to limit the application. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural unless the context clearly dictates otherwise.
还应当进一步理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。It should also be further understood that, as used in this specification and the appended claims, the term "and/or" refers to and including any and all possible combinations of one or more of the associated listed items .
请参阅图1,图1为本申请实施例提供的一种滑动窗口的配置方法的流程图,如图所示,其包括步骤S101~S104:Please refer to FIG. 1. FIG. 1 is a flowchart of a method for configuring a sliding window provided by an embodiment of the present application. As shown in the figure, the method includes steps S101 to S104:
S101、采用限流毛刺因子对滑动窗口发生限流毛刺的概率进行量化,其中,所述限流毛 刺因子表征所述滑动窗口的请求密度与毛刺覆盖度的乘积;S101, using a current-limiting burr factor to quantify the probability that a current-limiting burr occurs in a sliding window, wherein the current-limiting burr factor represents the product of the requested density and the burr coverage of the sliding window;
S102、采用内存因子对滑动窗口的分割数对内存占用的影响进行量化,其中,所述内存因子表征基于所述滑动窗口的分割数确定的目标项目所占用的内存;S102, using a memory factor to quantify the impact of the number of divisions of the sliding window on memory occupation, wherein the memory factor represents the memory occupied by the target item determined based on the number of divisions of the sliding window;
S103、确认所述限流毛刺因子与所述内存因子的交点信息;S103, confirming the intersection information of the current-limiting glitch factor and the memory factor;
S104、将所述交点信息中表征交点横坐标数值的坐标数据作为所述滑动窗口的最佳分割数。S104. Use the coordinate data representing the abscissa value of the intersection in the intersection information as the optimal number of divisions of the sliding window.
具体的,滑动窗口限流是一种限流策略,其可以避免固定窗口限流的一些弊端。滑动窗口的核心参数就是窗口的分割数(x),分割数越多,其滑动频率越高,分割数越少,其滑动频率越低。在不同的滑动频率下,其具有不同的限流效果,同时限流毛刺发生的概率也有所不同,本实施例通过一限流毛刺因子对滑动窗口发生限流毛刺的概率进行量化。Specifically, the sliding window current limiting is a current limiting strategy, which can avoid some drawbacks of the fixed window current limiting. The core parameter of the sliding window is the number of divisions (x) of the window. The more divisions, the higher the sliding frequency, and the fewer the divisions, the lower the sliding frequency. Under different sliding frequencies, it has different current-limiting effects, and the probability of current-limiting burrs occurring is also different. In this embodiment, a current-limiting burr factor is used to quantify the probability of current-limiting burrs occurring in the sliding window.
在一实施例中,如图2所示,所述步骤S101包括步骤S201~S205:In an embodiment, as shown in FIG. 2 , the step S101 includes steps S201-S205:
S201、获取所述滑动窗口的值,并将利用自变量x对分割数进行表示;S201, obtain the value of the sliding window, and use the independent variable x to represent the number of divisions;
该滑动窗口的值为预先设置,例如滑动窗口的值可以是6s,分割数为自变量,所以可利用一自变量x进行表示。The value of the sliding window is preset, for example, the value of the sliding window can be 6s, and the number of divisions is an independent variable, so it can be represented by an independent variable x.
S202、计算所述滑动窗口的值除以所述分割数的值,得到小窗口的大小;S202, calculating the value of the sliding window divided by the value of the number of divisions to obtain the size of the small window;
滑动窗口代表了限流区域的大小,将滑动窗口按照分割数进行分割即可得到多个小窗口,即将滑动窗口的值除以分割数的值,即可得到小窗口的值。The sliding window represents the size of the current-limiting area. Divide the sliding window according to the number of divisions to obtain multiple small windows, that is, divide the value of the sliding window by the value of the number of divisions to obtain the value of the small window.
例如滑动窗口的值为6s,分割数为6个,那么可得到大小相同且连续的6个小窗口,每个小窗口的大小为1s。也即滑动间隔时间为1s。For example, the value of the sliding window is 6s, and the number of divisions is 6, then 6 small windows with the same size and continuous can be obtained, and the size of each small window is 1s. That is, the sliding interval is 1s.
S203、将所述滑动窗口的值减去所述小窗口的值,得到毛刺发生概率区;S203, subtracting the value of the sliding window from the value of the small window to obtain a burr occurrence probability area;
此步骤将整个滑动窗口的大小减去小窗口的大小,这样即得到了上一滑动窗口与当前滑动窗口重叠的区域,该区域即为毛刺发生概率区,通过上述减法可得到所述毛刺发生概率区的大小。In this step, the size of the entire sliding window is subtracted from the size of the small window, so as to obtain the area where the previous sliding window and the current sliding window overlap, and this area is the burr occurrence probability area, and the burr occurrence probability can be obtained by the above subtraction area size.
例如滑动窗口的值为6s,小窗口的值为1s,那么毛刺发生概率区的大小为5s。For example, the value of the sliding window is 6s, and the value of the small window is 1s, then the size of the glitch probability area is 5s.
S204、将所述滑动窗口的值除以所述毛刺发生概率区的值,得到毛刺覆盖度;S204, dividing the value of the sliding window by the value of the burr occurrence probability region to obtain the burr coverage;
此步骤将整个滑动窗口的值除以前述毛刺发生概率区的值,得到的值即为毛刺覆盖度,毛刺覆盖度代表了毛刺在滑动窗口的覆盖程度。In this step, the value of the entire sliding window is divided by the value of the aforementioned burr occurrence probability area, and the obtained value is the burr coverage, and the burr coverage represents the coverage of the burr in the sliding window.
例如滑动窗口的值为6s,毛刺发生概率区的值为5s,那么毛刺覆盖度为1.2。For example, the value of the sliding window is 6s, and the value of the burr occurrence probability area is 5s, then the burr coverage is 1.2.
S205、将所述滑动窗口的允许最大请求数的值除以所述滑动窗口的值,得到请求密度;S205, dividing the value of the maximum allowable number of requests of the sliding window by the value of the sliding window to obtain the request density;
滑动窗口的作用也即对请求的数量进行限制,滑动窗口的允许最大请求数代表了滑动窗口所能允许的最大请求的数量。The function of the sliding window is to limit the number of requests. The maximum number of requests allowed by the sliding window represents the maximum number of requests allowed by the sliding window.
例如滑动窗口的允许最大请求数的值为120次,滑动窗口的值为6s,那么请求密度为20。For example, the maximum number of requests allowed by the sliding window is 120 times, and the value of the sliding window is 6s, then the request density is 20.
S206、将所述请求密度的值乘以所述毛刺覆盖度的值,得到限流毛刺因子。S206. Multiply the value of the requested density by the value of the burr coverage to obtain a current-limiting burr factor.
本申请实施例中,限流毛刺因子的值根据请求密度和毛刺覆盖度的值计算得到,具体是将请求密度的值乘以毛刺覆盖度的值。例如请求密度的值为20,毛刺覆盖度的值为1.2,那 么限流毛刺因子为24。In this embodiment of the present application, the value of the current-limiting burr factor is calculated according to the value of the requested density and the burr coverage, and specifically, the value of the requested density is multiplied by the value of the burr coverage. For example, if the requested density is 20 and the glitch coverage is 1.2, then the current-limit glitch factor is 24.
也就是说,限流毛刺因子Y按下式计算得到:That is to say, the current-limiting glitch factor Y is calculated as follows:
Figure PCTCN2021097187-appb-000001
Figure PCTCN2021097187-appb-000001
其中,T为滑动窗口的值,x为分割数,Q为滑动窗口的允许最大请求数的值。其中的x大于或等于2,代表滑动窗口至少分割2部分。Among them, T is the value of the sliding window, x is the number of divisions, and Q is the value of the maximum number of requests allowed for the sliding window. where x is greater than or equal to 2, which means that the sliding window is divided into at least 2 parts.
将上式进行变换得到:Transform the above formula to get:
Figure PCTCN2021097187-appb-000002
Figure PCTCN2021097187-appb-000002
从上式可以看出,可以看到一个项目中的允许请求最大数Q和窗口时间在一个项目中是不会变化的,所以随着分割数x的增大,限流毛刺因子Y会越来越小,直至趋向于一个固定值
Figure PCTCN2021097187-appb-000003
也就是说会趋向于一个理想的最小的限流毛刺因子,所以理想的情况是x的值越大越好,也就是分割数越大,限流的效果就会越好。
As can be seen from the above formula, it can be seen that the maximum number of allowed requests Q and the window time in a project will not change in a project, so as the number of divisions x increases, the current limiting glitch factor Y will become more and more smaller until it tends to a fixed value
Figure PCTCN2021097187-appb-000003
That is to say, it will tend to an ideal minimum current-limiting glitch factor, so the ideal situation is that the larger the value of x, the better, that is, the larger the number of divisions, the better the current-limiting effect will be.
在所述步骤S102中,如上所述,限流毛刺因子的计算公式为:In the step S102, as mentioned above, the calculation formula of the current-limiting glitch factor is:
Figure PCTCN2021097187-appb-000004
Figure PCTCN2021097187-appb-000004
从上式可以看出,理想的情况是x的值越大越好,即分割数越大,限流的效果就会越好。但是随着分割数的无穷大增加,其占用内存的量也会急剧增加,这样会严重影响整个系统的正常运行。所以本申请实施例引入一个内存因子来衡量随着分割数的增加所占内存的增加情况。It can be seen from the above formula that the ideal situation is that the larger the value of x, the better, that is, the larger the number of divisions, the better the current limiting effect will be. However, as the number of divisions increases infinitely, the amount of memory it occupies will also increase sharply, which will seriously affect the normal operation of the entire system. Therefore, the embodiment of the present application introduces a memory factor to measure the increase of the memory occupied with the increase of the number of divisions.
在一实施例中,如图3所示,所述步骤S102包括步骤S301~S302:In an embodiment, as shown in FIG. 3 , the step S102 includes steps S301-S302:
S301、预先将所述内存因子与所述滑动窗口的分割数的关系设置为一元一次关系,并设置所述一元一次关系的初始参数;S301, setting the relationship between the memory factor and the number of divisions of the sliding window as a one-dimensional primary relationship in advance, and setting the initial parameters of the one-dimensional primary relationship;
本申请实施例中,将滑动窗口的分割数与内存因子的关系定义为一元关系,同时仅具有一个自变量,所以总体上为一元一次关系,例如F=ax+b,其中a和b为常量,x为分割数,F为内存因子。In the embodiment of the present application, the relationship between the number of divisions of the sliding window and the memory factor is defined as a univariate relationship, and there is only one independent variable at the same time, so it is generally a univariate primary relationship, such as F=ax+b, where a and b are constants , x is the number of divisions, and F is the memory factor.
S302、根据所述目标项目的可用内存大小对所述一元一次关系的初始参数进行参数优化,得到优化后的参数。S302. Perform parameter optimization on the initial parameters of the unary primary relationship according to the available memory size of the target item, to obtain optimized parameters.
本申请实施例中,需要获取前述公式中a和b的值,为了计算出a和b的值,可以先对a和b的值进行初始化,即设置一个初始值,然后根据目标项目的可用内存大小对a和b的值进行优化,使得a和b的值不断贴近目标值,从而使分割数与F的关系更贴真实情况。In the embodiment of the present application, it is necessary to obtain the values of a and b in the aforementioned formula. In order to calculate the values of a and b, the values of a and b can be initialized first, that is, an initial value is set, and then according to the available memory of the target project The size optimizes the values of a and b, so that the values of a and b are constantly close to the target value, so that the relationship between the number of divisions and F is closer to the real situation.
在所述步骤S103中,本申请实施例中,限流毛刺因子和内存因子代表了对分割数的约束,二者从不同角度表达了分割数对真实情况的影响,为了准确获取最优的分割数,本申请可以绘制限流毛刺因子代表的曲线和内存因子代表的曲线,从而确定分割数。In the step S103, in the embodiment of the present application, the current-limiting glitch factor and the memory factor represent constraints on the number of divisions, and the two express the influence of the number of divisions on the real situation from different angles. In order to accurately obtain the optimal division number, the application can draw the curve represented by the current-limiting glitch factor and the curve represented by the memory factor, thereby determining the number of divisions.
在一实施例中,如图4所示,所述步骤S103包括步骤S401~S403:In an embodiment, as shown in FIG. 4 , the step S103 includes steps S401 to S403:
S401、以所述分割数为横坐标、所述限流毛刺因子为纵坐标绘制所述限流毛刺因子随所述滑动窗口的分割数变化得到的限流毛刺因子曲线;S401, taking the division number as the abscissa and the current-limiting glitch factor as the ordinate, drawing a current-limiting glitch factor curve obtained by changing the current-limiting glitch factor with the number of divisions of the sliding window;
此步骤是绘制限流毛刺因子曲线,如前所述,本实施例中的限流毛刺因子的计算公式为:
Figure PCTCN2021097187-appb-000005
This step is to draw the current-limiting glitch factor curve. As mentioned above, the calculation formula of the current-limiting glitch factor in this embodiment is:
Figure PCTCN2021097187-appb-000005
从上述公式可以看出,限流毛刺因子将会随着分割数的增加而趋向于一个固定值
Figure PCTCN2021097187-appb-000006
所以以分割数为横坐标,限流毛刺因子为纵坐标得到的限流毛刺因子曲线将会是一个随分割数的增加而逐渐下降且不断趋近于固定值
Figure PCTCN2021097187-appb-000007
的曲线。
It can be seen from the above formula that the current-limiting glitch factor will tend to a fixed value as the number of divisions increases.
Figure PCTCN2021097187-appb-000006
Therefore, taking the number of divisions as the abscissa and the current-limiting glitch factor as the ordinate, the current-limiting glitch factor curve will gradually decrease with the increase of the number of divisions and approach a fixed value.
Figure PCTCN2021097187-appb-000007
the curve.
上述限流毛刺因子曲线的横坐标起点是2,其终点可不进行设置,也可以设置在一定范围内,例如设置为100或200等,因为如果不断增加分割数,其占用的内存将会不断增大,后续的曲线将不具有实际意义。The starting point of the abscissa of the above current-limiting glitch factor curve is 2, and the end point can be set not or within a certain range, such as 100 or 200, because if the number of divisions is continuously increased, the memory occupied by it will continue to increase. large, the subsequent curves will be of no practical significance.
S402、以所述分割数为横坐标、所述内存因子为纵坐标绘制所述内存因子随所述滑动窗口的分割数变化得到的内存因子曲线。S402. Using the division number as the abscissa and the memory factor as the ordinate, draw a memory factor curve obtained by the memory factor changing with the division number of the sliding window.
此步骤是绘制内存因子曲线,如前所述,本实施例中的内存因子曲线的计算公式为:This step is to draw the memory factor curve. As mentioned above, the calculation formula of the memory factor curve in this embodiment is:
F=ax+b:F=ax+b:
从上述公式可以看出,内存因子将会随着分割数的增加而增加,并且是线性增加,所以以分割数为横坐标,内存因子为纵坐标得到的内存因子曲线将会是一个随分割数的增加而线性增加的直线。本申请实施例中的曲线是广义概念上的曲线,其也包含了直线的概念。It can be seen from the above formula that the memory factor will increase with the increase of the number of divisions, and it will increase linearly, so the memory factor curve obtained by taking the number of divisions as the abscissa and the memory factor as the ordinate will be a curve with the number of divisions increases and linearly increases. The curve in the embodiment of the present application is a curve in a broad concept, which also includes the concept of a straight line.
在实际应用中,可以将所述b设置为0,那么内存因子与所述分割数将形成正比例关系,即从坐标轴的原点出发,沿着一条直线不断延伸。In practical applications, the b can be set to 0, then the memory factor and the number of divisions will form a proportional relationship, that is, starting from the origin of the coordinate axis and extending along a straight line.
S403、获取所述限流毛刺因子曲线与所述内存因子曲线的交点信息。S403. Obtain the intersection point information of the current-limiting glitch factor curve and the memory factor curve.
此步骤中,获取所述限流毛刺因子曲线与内存因子曲线的交点信息,该交点信息包含了交点的横坐标和纵坐标。In this step, the intersection information of the current-limiting glitch factor curve and the memory factor curve is acquired, where the intersection information includes the abscissa and the ordinate of the intersection.
最后在所述步骤S104中,将所述交点信息中表征交点横坐标数值的坐标数据作为滑动窗口的最佳分割数。Finally, in the step S104, the coordinate data representing the abscissa value of the intersection point in the intersection point information is used as the optimal number of divisions of the sliding window.
结合图5所示(该图以
Figure PCTCN2021097187-appb-000008
为例,毛刺因子曲线也即限流毛刺因子曲线),从前面的限流毛刺因子曲线和内存因子曲线的描述可知,限流毛刺因子曲线是一条不断下降的曲线,内存因子曲线是一条不断上升的直线,二者将会在某个点上相交,相交的点即为交点,此交点的横坐标即为最佳分割数。
Combined with the one shown in Figure 5 (this figure is based on
Figure PCTCN2021097187-appb-000008
For example, the glitch factor curve is also the current-limiting glitch factor curve). From the previous descriptions of the current-limiting glitch factor curve and the memory factor curve, it can be seen that the current-limiting glitch factor curve is a continuously decreasing curve, and the memory factor curve is a continuously rising curve. , the two will intersect at a certain point, the intersecting point is the intersection, and the abscissa of this intersection is the optimal number of divisions.
此步骤中,交点的意义就是所设置的分割数,正好让限流毛刺因子能够朝向固定值
Figure PCTCN2021097187-appb-000009
靠近,同时又能保证内存因子不至于过高,达到最佳临界点的作用。
In this step, the meaning of the intersection point is the set number of divisions, just so that the current-limiting glitch factor can be directed to a fixed value
Figure PCTCN2021097187-appb-000009
close, and at the same time, it can ensure that the memory factor is not too high and achieves the role of the optimal critical point.
在一实施例中,所述将所述交点信息中表征交点横坐标数值的坐标数据作为所述滑动窗口的最佳分割数之后,包括:In one embodiment, after taking the coordinate data representing the abscissa value of the intersection in the intersection information as the optimal number of divisions of the sliding window, the method includes:
采用所述最佳分割数作为所述滑动窗口的分割数对接收到的请求进行限流。The optimal number of divisions is used as the number of divisions of the sliding window to limit the current of the received requests.
本实施例即为采用最佳分割数作为滑动窗口的分割数,然后采用该滑动窗口以及滑动窗口的允许最大请求数对接收到的请求进行限流。In this embodiment, the optimal number of divisions is used as the number of divisions of the sliding window, and then the sliding window and the maximum allowable number of requests of the sliding window are used to limit the current of the received requests.
采用本申请实施例提供的方法进行限流,可以降低限流毛刺发生的概率,同时降低占用的内存,达到最优的限流效果。Using the method provided by the embodiments of the present application to limit the current can reduce the probability of the occurrence of the current-limiting burr, reduce the occupied memory, and achieve the optimal current-limiting effect.
在一实施例中,所述的根据所述目标项目的可用内存大小对所述一元一次关系的初始参 数进行参数优化,得到优化后的参数,包括:In one embodiment, described according to the available memory size of the target item, the initial parameters of the unary primary relationship are parameterized, and the optimized parameters are obtained, including:
获取所述目标项目的可用内存大小,并根据所述可用内存大小调整所述一元一次关系的斜率。The available memory size of the target item is acquired, and the slope of the unary primary relationship is adjusted according to the available memory size.
本申请实施例中,可以根据实际应用场景(即目标项目)的情况来调整内存因子曲线的斜率(如图5中的虚线的内存因子曲线),如果实际应用场景中可用内存较大,则可以将斜率调小,如果实际应用场景中可用内存较小(内存相对紧张),则可以将斜率调大,这样就可以按照实际情况选择出最理想的分割数。In the embodiment of the present application, the slope of the memory factor curve (the memory factor curve of the dotted line in FIG. 5 ) may be adjusted according to the actual application scenario (ie, the target project). Adjust the slope to a small value. If the available memory in the actual application scenario is small (the memory is relatively tight), you can adjust the slope to a large value, so that the optimal number of divisions can be selected according to the actual situation.
在一实施例中,所述获取所述目标项目的可用内存大小,并根据所述可用内存大小调整所述一元一次关系的斜率,包括:In one embodiment, the acquiring the available memory size of the target item, and adjusting the slope of the unary primary relationship according to the available memory size, includes:
获取所述目标项目的可用内存大小,并获取所述可用内存大小所属范围;Obtain the available memory size of the target project, and obtain the range to which the available memory size belongs;
根据所述可用内存大小所属范围在内存因子库中查询斜率,并按照所述斜率对所述内存因子进行设置,其中,所述内存因子库中存储有不同内存大小所属范围与斜率的对应关系。The slope is queried in the memory factor database according to the range to which the available memory size belongs, and the memory factor is set according to the slope, wherein the memory factor database stores the corresponding relationship between the range of different memory sizes and the slope.
本实施例中,可以预先设置好可用内存大小范围与斜率之间的对应关系,并将该对应关系存储于内存因子库中,这样在实际项目中,可以获取其可用内存大小,从而确定其所属范围,然后从内存因子库中查询与之对应的斜率,然后按照该斜率设置内存因子的斜率。通过本实施例,可以使得内存因子曲线更符合实际项目的真实情况,并且还可以实时获取可用内存大小,动态调整内存因子的斜率,从而动态调整滑动窗口的分割数。In this embodiment, the corresponding relationship between the available memory size range and the slope can be preset, and the corresponding relationship is stored in the memory factor library, so that in the actual project, the available memory size can be obtained, so as to determine its belonging range, and then query the corresponding slope from the memory factor library, and then set the slope of the memory factor according to the slope. Through this embodiment, the memory factor curve can be made more in line with the real situation of the actual project, and the available memory size can also be acquired in real time, and the slope of the memory factor can be dynamically adjusted, thereby dynamically adjusting the number of divisions of the sliding window.
本申请实施例还提供一种滑动窗口的配置装置,该一种滑动窗口的配置装置用于执行前述一种滑动窗口的配置方法的任一实施例。具体地,请参阅图6,图6是本申请实施例提供的滑动窗口的配置装置的示意性框图。该滑动窗口的配置装置600可以配置于服务器中。The embodiment of the present application further provides a configuration device for a sliding window, and the configuration device for a sliding window is used to execute any embodiment of the foregoing method for configuring a sliding window. Specifically, please refer to FIG. 6 , which is a schematic block diagram of an apparatus for configuring a sliding window provided by an embodiment of the present application. The configuration device 600 of the sliding window can be configured in the server.
该滑动窗口的配置装置600可以包括:The configuration device 600 of the sliding window may include:
限流毛刺概率量化单元601,用于采用限流毛刺因子对滑动窗口发生限流毛刺的概率进行量化,其中,所述限流毛刺因子表征滑动窗口的请求密度与毛刺覆盖度的乘积;A current-limiting glitch probability quantification unit 601, configured to quantify the probability of a current-limiting glitch occurring in the sliding window by using a current-limiting glitch factor, wherein the current-limiting glitch factor represents the product of the request density and the glitch coverage of the sliding window;
内存占用量化单元602,用于采用内存因子对滑动窗口的分割数对内存占用的影响进行量化,其中,所述内存因子表征基于滑动窗口的分割数确定的目标项目所占用的内存;The memory occupation quantification unit 602 is used to quantify the impact of the partition number of the sliding window on the memory occupation by using a memory factor, wherein the memory factor represents the memory occupied by the target item determined based on the partition number of the sliding window;
交点确认单元603,用于确认所述限流毛刺因子与所述内存因子的交点信息;an intersection confirmation unit 603, configured to confirm the intersection information of the current-limiting glitch factor and the memory factor;
分割数设置单元604,用于将所述交点信息中表征交点横坐标数值的坐标数据作为所述滑动窗口的最佳分割数。The division number setting unit 604 is configured to use the coordinate data representing the abscissa value of the intersection point in the intersection point information as the optimal division number of the sliding window.
在一实施例中,如图7所示,所述限流毛刺概率量化单元601包括:In one embodiment, as shown in FIG. 7 , the current-limiting glitch probability quantization unit 601 includes:
表示单元701,用于获取所述滑动窗口的值,并将利用自变量x对分割数进行表示; Representation unit 701, used to obtain the value of the sliding window, and will use the independent variable x to represent the number of divisions;
小窗口计算单元702,用于计算所述滑动窗口的值除以所述分割数的值,得到小窗口的大小;A small window calculation unit 702, configured to calculate the value of the sliding window divided by the value of the division number to obtain the size of the small window;
毛刺发生概率区计算单元703,用于将所述滑动窗口的值减去所述小窗口的值,得到毛刺发生概率区;A glitch occurrence probability area calculation unit 703, configured to subtract the value of the small window from the value of the sliding window to obtain a glitch occurrence probability area;
毛刺覆盖度计算单元704,用于将所述滑动窗口的值除以所述毛刺发生概率区的值,得到毛刺覆盖度;A burr coverage calculation unit 704, configured to divide the value of the sliding window by the value of the burr occurrence probability region to obtain the burr coverage;
请求密度计算单元705,用于将所述滑动窗口的允许最大请求数的值除以所述滑动窗口的值,得到请求密度;a request density calculation unit 705, configured to divide the value of the maximum allowable number of requests of the sliding window by the value of the sliding window to obtain the request density;
限流毛刺因子计算单元706,用于将所述请求密度的值乘以所述毛刺覆盖度的值,得到限流毛刺因子。The current-limiting glitch factor calculation unit 706 is configured to multiply the value of the requested density by the value of the burr coverage to obtain the current-limiting glitch factor.
在一实施例中,如图8所示,所述内存占用量化单元602包括:In one embodiment, as shown in FIG. 8 , the memory occupancy quantization unit 602 includes:
关系设置单元801,用于预先将所述内存因子与所述滑动窗口的分割数的关系设置为一元一次关系,并设置所述一元一次关系的初始参数;The relationship setting unit 801 is used to pre-set the relationship between the memory factor and the number of divisions of the sliding window as a one-dimensional primary relationship, and set the initial parameters of the one-dimensional primary relationship;
参数优化单元802,用于根据所述目标项目的可用内存大小对所述一元一次关系的初始参数进行参数优化,得到优化后的参数。A parameter optimization unit 802, configured to perform parameter optimization on the initial parameters of the one-dimensional linear relationship according to the available memory size of the target item to obtain optimized parameters.
在一实施例中,如图9所示,所述交点确认单元603包括:In one embodiment, as shown in FIG. 9 , the intersection confirmation unit 603 includes:
限流毛刺因子曲线绘制单元901,用于以所述分割数为横坐标、所述限流毛刺因子为纵坐标绘制所述限流毛刺因子随所述滑动窗口的分割数变化得到的限流毛刺因子曲线;A current-limiting burr factor curve drawing unit 901, configured to draw the current-limiting burr obtained by taking the division number as the abscissa and the current-limiting burr factor as the ordinate, which is obtained by changing the current-limiting burr factor with the number of divisions of the sliding window factor curve;
内存因子曲线绘制单元902,用于以所述分割数为横坐标、所述内存因子为纵坐标绘制所述内存因子随所述滑动窗口的分割数变化得到的内存因子曲线;A memory factor curve drawing unit 902, configured to draw a memory factor curve obtained by taking the division number as the abscissa and the memory factor as the ordinate;
交点获取单元903,用于获取所述限流毛刺因子曲线与所述内存因子曲线的交点信息。The intersection obtaining unit 903 is configured to obtain intersection information of the current-limiting glitch factor curve and the memory factor curve.
在一实施例中,所述的滑动窗口的配置装置600还包括:In one embodiment, the sliding window configuration device 600 further includes:
限流单元,用于采用所述最佳分割数作为所述滑动窗口的分割数对接收到的请求进行限流。A current limiting unit, configured to use the optimal number of divisions as the number of divisions of the sliding window to limit the current of the received requests.
在一实施例中,所述参数优化单元802包括:In one embodiment, the parameter optimization unit 802 includes:
斜率调整单元,用于获取所述目标项目的可用内存大小,并根据所述可用内存大小调整所述一元一次关系的斜率。A slope adjustment unit, configured to obtain the available memory size of the target item, and adjust the slope of the unary primary relationship according to the available memory size.
在一实施例中,所述斜率调整单元包括:In one embodiment, the slope adjustment unit includes:
范围获取单元,用于获取所述目标项目的可用内存大小,并获取所述可用内存大小所属范围;a range obtaining unit, configured to obtain the available memory size of the target item, and obtain the range to which the available memory size belongs;
斜率设置单元,用于根据所述可用内存大小所属范围在预设的内存因子库中查询斜率,并按照所述斜率对所述内存因子进行设置,其中,所述内存因子库中存储有不同内存大小所属范围与斜率的对应关系。a slope setting unit, configured to query the slope in a preset memory factor library according to the range to which the available memory size belongs, and set the memory factor according to the slope, wherein different memories are stored in the memory factor library The corresponding relationship between the range to which the size belongs and the slope.
基于本申请实施例提供的滑动窗口的配置装置,可以获取最优的分割数,从而有效降低限流毛刺发生的概率,同时降低占用的内存,达到最优的限流效果。Based on the sliding window configuration device provided in the embodiment of the present application, the optimal number of divisions can be obtained, thereby effectively reducing the probability of occurrence of current limiting burrs, reducing the occupied memory at the same time, and achieving the optimal current limiting effect.
上述滑动窗口的配置装置600可以实现为计算机程序的形式,该计算机程序可以在如图10所示的计算机设备上运行。The above-mentioned configuration apparatus 600 for a sliding window can be implemented in the form of a computer program, and the computer program can be executed on a computer device as shown in FIG. 10 .
请参阅图10,图10是本申请实施例提供的计算机设备的示意性框图。该计算机设备10是服务器,服务器可以是独立的服务器,也可以是多个服务器组成的服务器集群。Please refer to FIG. 10. FIG. 10 is a schematic block diagram of a computer device provided by an embodiment of the present application. The computer device 10 is a server, and the server may be an independent server or a server cluster composed of multiple servers.
参阅图10,该计算机设备1000包括通过系统总线1001连接的处理器1002、存储器和网络接口1005,其中,存储器可以包括非易失性存储介质1003和内存储器1004。Referring to FIG. 10 , the computer device 1000 includes a processor 1002 , a memory and a network interface 1005 connected through a system bus 1001 , wherein the memory may include a non-volatile storage medium 1003 and an internal memory 1004 .
该非易失性存储介质1003可存储操作系统10031和计算机程序10032。该计算机程序 10032被执行时,可使得处理器1002执行滑动窗口的配置方法。The nonvolatile storage medium 1003 can store an operating system 10031 and a computer program 10032 . When the computer program 10032 is executed, it can cause the processor 1002 to execute the configuration method of the sliding window.
该处理器1002用于提供计算和控制能力,支撑整个计算机设备1000的运行。The processor 1002 is used to provide computing and control capabilities to support the operation of the entire computer device 1000 .
该内存储器1004为非易失性存储介质1003中的计算机程序10032的运行提供环境,该计算机程序10032被处理器1002执行时,可使得处理器1002执行滑动窗口的配置方法。The internal memory 1004 provides an environment for running the computer program 10032 in the non-volatile storage medium 1003. When the computer program 10032 is executed by the processor 1002, the processor 1002 can execute the sliding window configuration method.
该网络接口1005用于进行网络通信,如提供数据信息的传输等。本领域技术人员可以理解,图10中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备1000的限定,具体的计算机设备1000可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。The network interface 1005 is used for network communication, such as providing transmission of data information. Those skilled in the art can understand that the structure shown in FIG. 10 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 1000 to which the solution of the present application is applied. The specific computer device 1000 may include more or fewer components than shown, or combine certain components, or have a different arrangement of components.
其中,所述处理器1002用于运行存储在存储器中的计算机程序10032,以实现如下功能:采用限流毛刺因子对滑动窗口发生限流毛刺的概率进行量化,其中,所述限流毛刺因子表征所述滑动窗口的请求密度与毛刺覆盖度的乘积;采用内存因子对滑动窗口的分割数对内存占用的影响进行量化,其中,所述内存因子表征基于所述滑动窗口的分割数确定的目标项目所占用的内存;确认所述限流毛刺因子与所述内存因子的交点信息;将所述交点信息中表征交点横坐标数值的坐标数据作为所述滑动窗口的最佳分割数。Wherein, the processor 1002 is configured to run the computer program 10032 stored in the memory, so as to realize the following function: using a current-limiting glitch factor to quantify the probability of a current-limiting glitch occurring in the sliding window, wherein the current-limiting glitch factor represents the The product of the request density of the sliding window and the burr coverage; using a memory factor to quantify the impact of the number of divisions of the sliding window on the memory occupation, wherein the memory factor represents the target item determined based on the number of divisions of the sliding window The occupied memory; confirming the intersection information of the current-limiting glitch factor and the memory factor; and taking the coordinate data representing the abscissa value of the intersection in the intersection information as the optimal number of divisions of the sliding window.
在一实施例中,处理器1002在执行所述采用限流毛刺因子对滑动窗口发生限流毛刺的概率进行量化,其中,所述限流毛刺因子表征滑动窗口的请求密度与毛刺覆盖度的乘积的步骤时,执行如下操作:获取所述滑动窗口的值,并将利用自变量x对分割数进行表示;计算所述滑动窗口的值除以所述分割数的值,得到小窗口的大小;将所述滑动窗口的值减去所述小窗口的值,得到毛刺发生概率区;将所述滑动窗口的值除以所述毛刺发生概率区的值,得到毛刺覆盖度;将所述滑动窗口的允许最大请求数的值除以所述滑动窗口的值,得到请求密度;将所述请求密度的值乘以所述毛刺覆盖度的值,得到限流毛刺因子。In one embodiment, the processor 1002 quantifies the probability of the current-limiting glitch occurring in the sliding window by using the current-limiting glitch factor, wherein the current-limiting glitch factor represents the product of the request density and the glitch coverage of the sliding window. During the step of , perform the following operations: obtain the value of the sliding window, and use the independent variable x to represent the number of divisions; calculate the value of the sliding window divided by the value of the number of divisions to obtain the size of the small window; Subtract the value of the sliding window from the value of the small window to obtain the glitch occurrence probability area; divide the value of the sliding window by the value of the glitch occurrence probability area to obtain the glitch coverage; The value of the maximum allowable number of requests is divided by the value of the sliding window to obtain the request density; the value of the request density is multiplied by the value of the burr coverage to obtain the current limiting burr factor.
在一实施例中,处理器1002在执行所述采用内存因子对滑动窗口的分割数对内存占用的影响进行量化,其中,所述内存因子表征基于滑动窗口的分割数确定的目标项目所占用的内存的步骤时,执行如下操作:预先将所述内存因子与所述滑动窗口的分割数的关系设置为一元一次关系,并设置所述一元一次关系的初始参数;根据所述目标项目的可用内存大小对所述一元一次关系的初始参数进行参数优化,得到优化后的参数。In one embodiment, the processor 1002 quantifies the impact of the number of partitions of the sliding window on memory occupation by using a memory factor, wherein the memory factor represents the amount of space occupied by the target item determined based on the number of partitions of the sliding window. During the step of memory, perform the following operations: set the relationship between the memory factor and the number of divisions of the sliding window as a one-dimensional relationship in advance, and set the initial parameters of the one-dimensional relationship; according to the available memory of the target item Parameter optimization is performed on the initial parameters of the one-dimensional linear relationship to obtain the optimized parameters.
在一实施例中,处理器1002在执行所述确认所述限流毛刺因子与所述内存因子的交点信息的步骤时,执行如下操作:以所述分割数为横坐标、所述限流毛刺因子为纵坐标绘制所述限流毛刺因子随所述滑动窗口的分割数变化得到的限流毛刺因子曲线;以所述分割数为横坐标、所述内存因子为纵坐标绘制所述内存因子随所述滑动窗口的分割数变化得到的内存因子曲线;获取所述限流毛刺因子曲线与所述内存因子曲线的交点信息。In one embodiment, when the processor 1002 performs the step of confirming the intersection point information of the current-limiting glitch factor and the memory factor, the processor 1002 performs the following operations: taking the division number as the abscissa, the current-limiting glitch The current-limiting glitch factor curve obtained by plotting the current-limiting glitch factor with the number of divisions of the sliding window as the ordinate is the factor; plotting the current-limiting glitch factor curve with the division number as the abscissa and the memory factor as the ordinate. The memory factor curve obtained by changing the number of divisions of the sliding window; and obtaining the intersection point information of the current-limiting glitch factor curve and the memory factor curve.
在一实施例中,处理器1002在执行所述将所述交点信息中表征交点横坐标数值的坐标数据作为所述滑动窗口的最佳分割数的步骤之后,执行如下操作:采用所述最佳分割数作为所述滑动窗口的分割数对接收到的请求进行限流。In one embodiment, after performing the step of using the coordinate data representing the abscissa value of the intersection in the intersection information as the optimal number of divisions of the sliding window, the processor 1002 performs the following operation: using the optimal The number of divisions is used as the number of divisions of the sliding window to limit the current of the received requests.
在一实施例中,处理器1002在执行所述根据所述目标项目的可用内存大小对所述一元一次关系的初始参数进行参数优化,得到优化后的参数的步骤时,执行如下操作:获取所述目 标项目的可用内存大小,并根据所述可用内存大小调整所述一元一次关系的斜率。In one embodiment, when the processor 1002 performs the step of performing parameter optimization on the initial parameters of the unary primary relationship according to the available memory size of the target item to obtain the optimized parameters, the processor 1002 performs the following operations: obtaining the The available memory size of the target item is adjusted, and the slope of the unary primary relationship is adjusted according to the available memory size.
在一实施例中,处理器1002在执行所述获取所述目标项目的可用内存大小,并根据所述可用内存大小调整所述一元一次关系的斜率的步骤时,执行如下操作:获取所述目标项目的可用内存大小,并获取所述可用内存大小所属范围;根据所述可用内存大小所属范围在预设的内存因子库中查询斜率,并按照所述斜率对所述内存因子进行设置,其中,所述内存因子库中存储有不同内存大小所属范围与斜率的对应关系。In one embodiment, when the processor 1002 performs the step of acquiring the available memory size of the target item and adjusting the slope of the unary primary relationship according to the available memory size, the processor 1002 performs the following operations: acquiring the target item The available memory size of the project, and obtain the range to which the available memory size belongs; query the slope in the preset memory factor library according to the range to which the available memory size belongs, and set the memory factor according to the slope, wherein, The memory factor library stores the correspondence between the ranges and slopes to which different memory sizes belong.
本领域技术人员可以理解,图10中示出的计算机设备的实施例并不构成对计算机设备具体构成的限定,在其他实施例中,计算机设备可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。例如,在一些实施例中,计算机设备可以仅包括存储器及处理器,在这样的实施例中,存储器及处理器的结构及功能与图10所示实施例一致,在此不再赘述。Those skilled in the art can understand that the embodiment of the computer device shown in FIG. 10 does not constitute a limitation on the specific structure of the computer device. Either some components are combined, or different component arrangements. For example, in some embodiments, the computer device may only include a memory and a processor. In such an embodiment, the structures and functions of the memory and the processor are the same as those of the embodiment shown in FIG. 10 , which will not be repeated here.
应当理解,在本申请实施例中,处理器1002可以是中央处理单元(Central Processing Unit,CPU),该处理器1002还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。其中,通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。It should be understood that, in this embodiment of the present application, the processor 1002 may be a central processing unit (Central Processing Unit, CPU), and the processor 1002 may also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Wherein, the general-purpose processor can be a microprocessor or the processor can also be any conventional processor or the like.
在本申请的另一实施例中提供计算机可读存储介质。该计算机可读存储介质可以为非易失性的计算机可读存储介质,也可以为易失性的计算机可读存储介质。该计算机可读存储介质存储有计算机程序,其中计算机程序被处理器执行时实现以下步骤:采用限流毛刺因子对滑动窗口发生限流毛刺的概率进行量化,其中,所述限流毛刺因子表征所述滑动窗口的请求密度与毛刺覆盖度的乘积;采用内存因子对滑动窗口的分割数对内存占用的影响进行量化,其中,所述内存因子表征基于所述滑动窗口的分割数确定的目标项目所占用的内存;确认所述限流毛刺因子与所述内存因子的交点信息;将所述交点信息中表征交点横坐标数值的坐标数据作为所述滑动窗口的最佳分割数。In another embodiment of the present application, a computer-readable storage medium is provided. The computer-readable storage medium may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. The computer-readable storage medium stores a computer program, wherein when the computer program is executed by the processor, the following steps are implemented: using a current-limiting glitch factor to quantify the probability of a current-limiting glitch occurring in the sliding window, wherein the current-limiting glitch factor represents all the current-limiting glitches. The product of the request density of the sliding window and the burr coverage; adopt the memory factor to quantify the impact of the number of divisions of the sliding window on the memory occupation, wherein, the memory factor represents the target item determined based on the number of divisions of the sliding window. Occupied memory; confirming the intersection information of the current-limiting glitch factor and the memory factor; taking the coordinate data representing the abscissa value of the intersection in the intersection information as the optimal number of divisions of the sliding window.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的设备、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those skilled in the art can clearly understand that, for the convenience and brevity of description, for the specific working process of the above-described devices, devices and units, reference may be made to the corresponding processes in the foregoing method embodiments, which will not be repeated here. Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. Interchangeability, the above description has generally described the components and steps of each example in terms of function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of this application.
在本申请所提供的几个实施例中,应该理解到,所揭露的设备、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为逻辑功能划分,实际实现时可以有另外的划分方式,也可以将具有相同功能的单元集合成一个单元,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以 忽略,或不执行。另外,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口、装置或单元的间接耦合或通信连接,也可以是电的,机械的或其它的形式连接。In the several embodiments provided in this application, it should be understood that the disclosed apparatus, apparatus and method may be implemented in other manners. For example, the device embodiments described above are only illustrative. For example, the division of the units is only logical function division. In actual implementation, there may be other division methods, or units with the same function may be grouped into one Units, such as multiple units or components, may be combined or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may also be electrical, mechanical or other forms of connection.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本申请实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solutions of the embodiments of the present application.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以是两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分,或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a storage medium. Based on this understanding, the technical solutions of the present application are essentially or part of contributions to the prior art, or all or part of the technical solutions can be embodied in the form of software products, and the computer software products are stored in a storage medium , including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a removable hard disk, a read-only memory (ROM, Read-Only Memory), a magnetic disk or an optical disk and other media that can store program codes.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。The above are only specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of various equivalents within the technical scope disclosed in the present application. Modifications or substitutions shall be covered by the protection scope of this application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (20)

  1. 一种滑动窗口的配置方法,其中,包括:A sliding window configuration method, comprising:
    采用限流毛刺因子对滑动窗口发生限流毛刺的概率进行量化,其中,所述限流毛刺因子表征所述滑动窗口的请求密度与毛刺覆盖度的乘积;A current-limiting glitch factor is used to quantify the probability of a current-limiting glitch occurring in the sliding window, wherein the current-limiting glitch factor represents the product of the request density and the glitch coverage of the sliding window;
    采用内存因子对滑动窗口的分割数对内存占用的影响进行量化,其中,所述内存因子表征基于所述滑动窗口的分割数确定的目标项目所占用的内存;Using a memory factor to quantify the impact of the number of divisions of the sliding window on the memory occupation, wherein the memory factor represents the memory occupied by the target item determined based on the number of divisions of the sliding window;
    确认所述限流毛刺因子与所述内存因子的交点信息;Confirm the intersection information of the current-limiting glitch factor and the memory factor;
    将所述交点信息中表征交点横坐标数值的坐标数据作为所述滑动窗口的最佳分割数。The coordinate data representing the abscissa value of the intersection point in the intersection point information is used as the optimal number of divisions of the sliding window.
  2. 根据权利要求1所述的滑动窗口的配置方法,其中,所述采用限流毛刺因子对滑动窗口发生限流毛刺的概率进行量化,其中,所述限流毛刺因子表征滑动窗口的请求密度与毛刺覆盖度的乘积,包括:The method for configuring a sliding window according to claim 1, wherein the current-limiting glitch factor is used to quantify the probability of a current-limiting glitch occurring in the sliding window, wherein the current-limiting glitch factor represents the request density and glitch of the sliding window The product of coverage, including:
    获取所述滑动窗口的值,并将利用自变量x对分割数进行表示;Obtain the value of the sliding window, and use the independent variable x to represent the number of divisions;
    计算所述滑动窗口的值除以所述分割数的值,得到小窗口的大小;Calculate the value of the sliding window divided by the value of the number of divisions to obtain the size of the small window;
    将所述滑动窗口的值减去所述小窗口的值,得到毛刺发生概率区;The value of the sliding window is subtracted from the value of the small window to obtain the burr occurrence probability area;
    将所述滑动窗口的值除以所述毛刺发生概率区的值,得到毛刺覆盖度;Divide the value of the sliding window by the value of the burr occurrence probability area to obtain the burr coverage;
    将所述滑动窗口的允许最大请求数的值除以所述滑动窗口的值,得到请求密度;Divide the value of the maximum number of requests allowed by the sliding window by the value of the sliding window to obtain the request density;
    将所述请求密度的值乘以所述毛刺覆盖度的值,得到限流毛刺因子。Multiply the value of the requested density by the value of the burr coverage to obtain a current-limiting burr factor.
  3. 根据权利要求1所述的滑动窗口的配置方法,其中,所述采用内存因子对滑动窗口的分割数对内存占用的影响进行量化,其中,所述内存因子表征基于滑动窗口的分割数确定的目标项目所占用的内存,包括:The method for configuring a sliding window according to claim 1, wherein the memory factor is used to quantify the impact of the number of divisions of the sliding window on memory occupation, wherein the memory factor represents the target determined based on the number of divisions of the sliding window The memory used by the project, including:
    预先将所述内存因子与所述滑动窗口的分割数的关系设置为一元一次关系,并设置所述一元一次关系的初始参数;The relationship between the memory factor and the number of divisions of the sliding window is set as a one-dimensional primary relationship in advance, and the initial parameters of the one-dimensional primary relationship are set;
    根据所述目标项目的可用内存大小对所述一元一次关系的初始参数进行参数优化,得到优化后的参数。Parameter optimization is performed on the initial parameters of the one-dimensional primary relationship according to the available memory size of the target item to obtain optimized parameters.
  4. 根据权利要求1所述的滑动窗口的配置方法,其中,所述确认所述限流毛刺因子与所述内存因子的交点信息,包括:The method for configuring a sliding window according to claim 1, wherein the confirming the intersection information of the current-limiting glitch factor and the memory factor comprises:
    以所述分割数为横坐标、所述限流毛刺因子为纵坐标绘制所述限流毛刺因子随所述滑动窗口的分割数变化得到的限流毛刺因子曲线;Taking the division number as the abscissa and the current-limiting glitch factor as the ordinate to draw a current-limiting glitch factor curve obtained by changing the current-limiting glitch factor with the division number of the sliding window;
    以所述分割数为横坐标、所述内存因子为纵坐标绘制所述内存因子随所述滑动窗口的分割数变化得到的内存因子曲线;Taking the division number as the abscissa and the memory factor as the ordinate, draw the memory factor curve obtained by the memory factor changing with the division number of the sliding window;
    获取所述限流毛刺因子曲线与所述内存因子曲线的交点信息。Obtain the intersection information of the current-limiting glitch factor curve and the memory factor curve.
  5. 根据权利要求1所述的滑动窗口的配置方法,其中,所述将所述交点信息中表征交点横坐标数值的坐标数据作为所述滑动窗口的最佳分割数之后,还包括:The method for configuring a sliding window according to claim 1, wherein after taking the coordinate data representing the abscissa value of the intersection point in the intersection point information as the optimal number of divisions of the sliding window, the method further comprises:
    采用所述最佳分割数作为所述滑动窗口的分割数对接收到的请求进行限流。The optimal number of divisions is used as the number of divisions of the sliding window to limit the current of the received requests.
  6. 根据权利要求3所述的滑动窗口的配置方法,其中,所述根据所述目标项目的可用内 存大小对所述一元一次关系的初始参数进行参数优化,得到优化后的参数,包括:The configuration method of sliding window according to claim 3, wherein, described according to the available memory size of the target project The initial parameters of the one-dimensional relationship are optimized, and the optimized parameters are obtained, including:
    获取所述目标项目的可用内存大小,并根据所述可用内存大小调整所述一元一次关系的斜率。The available memory size of the target item is acquired, and the slope of the unary primary relationship is adjusted according to the available memory size.
  7. 根据权利要求6所述的滑动窗口的配置方法,其中,所述获取所述目标项目的可用内存大小,并根据所述可用内存大小调整所述一元一次关系的斜率,包括:The method for configuring a sliding window according to claim 6, wherein the obtaining the available memory size of the target item, and adjusting the slope of the unary primary relationship according to the available memory size, comprises:
    获取所述目标项目的可用内存大小,并获取所述可用内存大小所属范围;Obtain the available memory size of the target project, and obtain the range to which the available memory size belongs;
    根据所述可用内存大小所属范围在预设的内存因子库中查询斜率,并按照所述斜率对所述内存因子进行设置,其中,所述内存因子库中存储有不同内存大小所属范围与斜率的对应关系。The slope is queried in a preset memory factor library according to the range to which the available memory size belongs, and the memory factor is set according to the slope, wherein the memory factor library stores the ranges and slopes of different memory sizes. Correspondence.
  8. 一种滑动窗口的配置装置,其中,包括:A sliding window configuration device, comprising:
    限流毛刺概率量化单元,用于采用限流毛刺因子对滑动窗口发生限流毛刺的概率进行量化,其中,所述限流毛刺因子表征滑动窗口的请求密度与毛刺覆盖度的乘积;a current-limiting burr probability quantization unit, used for quantifying the probability of a current-limiting burr occurring in the sliding window by using a current-limiting burr factor, wherein the current-limiting burr factor represents the product of the request density of the sliding window and the burr coverage;
    内存占用量化单元,用于采用内存因子对滑动窗口的分割数对内存占用的影响进行量化,其中,所述内存因子表征基于滑动窗口的分割数确定的目标项目所占用的内存;a memory occupancy quantification unit, used for quantifying the impact of the number of divisions of the sliding window on the memory occupation by using a memory factor, wherein the memory factor represents the memory occupied by the target item determined based on the number of divisions of the sliding window;
    交点确认单元,用于确认所述限流毛刺因子与所述内存因子的交点信息;an intersection confirmation unit, configured to confirm the intersection information of the current-limiting glitch factor and the memory factor;
    分割数设置单元,用于将所述交点信息中表征交点横坐标数值的坐标数据作为所述滑动窗口的最佳分割数。A division number setting unit, configured to use the coordinate data representing the abscissa value of the intersection point in the intersection point information as the optimal division number of the sliding window.
  9. 一种计算机设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现:A computer device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements when executing the computer program:
    采用限流毛刺因子对滑动窗口发生限流毛刺的概率进行量化,其中,所述限流毛刺因子表征所述滑动窗口的请求密度与毛刺覆盖度的乘积;A current-limiting glitch factor is used to quantify the probability of a current-limiting glitch occurring in the sliding window, wherein the current-limiting glitch factor represents the product of the request density and the glitch coverage of the sliding window;
    采用内存因子对滑动窗口的分割数对内存占用的影响进行量化,其中,所述内存因子表征基于所述滑动窗口的分割数确定的目标项目所占用的内存;Using a memory factor to quantify the impact of the number of divisions of the sliding window on the memory occupation, wherein the memory factor represents the memory occupied by the target item determined based on the number of divisions of the sliding window;
    确认所述限流毛刺因子与所述内存因子的交点信息;Confirm the intersection information of the current-limiting glitch factor and the memory factor;
    将所述交点信息中表征交点横坐标数值的坐标数据作为所述滑动窗口的最佳分割数。The coordinate data representing the abscissa value of the intersection point in the intersection point information is used as the optimal number of divisions of the sliding window.
  10. 根据权利要求9所述的计算机设备,其中,所述采用限流毛刺因子对滑动窗口发生限流毛刺的概率进行量化,其中,所述限流毛刺因子表征滑动窗口的请求密度与毛刺覆盖度的乘积,包括:The computer device according to claim 9, wherein the probability of occurrence of a current-limiting glitch in the sliding window is quantified by using a current-limiting glitch factor, wherein the current-limiting glitch factor represents the difference between the request density of the sliding window and the glitch coverage. Product, including:
    获取所述滑动窗口的值,并将利用自变量x对分割数进行表示;Obtain the value of the sliding window, and use the independent variable x to represent the number of divisions;
    计算所述滑动窗口的值除以所述分割数的值,得到小窗口的大小;Calculate the value of the sliding window divided by the value of the number of divisions to obtain the size of the small window;
    将所述滑动窗口的值减去所述小窗口的值,得到毛刺发生概率区;The value of the sliding window is subtracted from the value of the small window to obtain the burr occurrence probability area;
    将所述滑动窗口的值除以所述毛刺发生概率区的值,得到毛刺覆盖度;Divide the value of the sliding window by the value of the burr occurrence probability area to obtain the burr coverage;
    将所述滑动窗口的允许最大请求数的值除以所述滑动窗口的值,得到请求密度;Divide the value of the maximum number of requests allowed by the sliding window by the value of the sliding window to obtain the request density;
    将所述请求密度的值乘以所述毛刺覆盖度的值,得到限流毛刺因子。Multiply the value of the requested density by the value of the burr coverage to obtain a current-limiting burr factor.
  11. 根据权利要求9所述的计算机设备,其中,所述采用内存因子对滑动窗口的分割数对内存占用的影响进行量化,其中,所述内存因子表征基于滑动窗口的分割数确定的目标项目 所占用的内存,包括:The computer device according to claim 9, wherein the memory factor is used to quantify the impact of the number of divisions of the sliding window on the memory occupation, wherein the memory factor represents the occupation of the target item determined based on the number of divisions of the sliding window. memory, including:
    预先将所述内存因子与所述滑动窗口的分割数的关系设置为一元一次关系,并设置所述一元一次关系的初始参数;The relationship between the memory factor and the number of divisions of the sliding window is set as a one-dimensional primary relationship in advance, and the initial parameters of the one-dimensional primary relationship are set;
    根据所述目标项目的可用内存大小对所述一元一次关系的初始参数进行参数优化,得到优化后的参数。Parameter optimization is performed on the initial parameters of the one-dimensional primary relationship according to the available memory size of the target item to obtain optimized parameters.
  12. 根据权利要求9所述的计算机设备,其中,所述确认所述限流毛刺因子与所述内存因子的交点信息,包括:The computer device according to claim 9, wherein the confirming the intersection information of the current-limiting glitch factor and the memory factor comprises:
    以所述分割数为横坐标、所述限流毛刺因子为纵坐标绘制所述限流毛刺因子随所述滑动窗口的分割数变化得到的限流毛刺因子曲线;Taking the division number as the abscissa and the current-limiting glitch factor as the ordinate to draw a current-limiting glitch factor curve obtained by changing the current-limiting glitch factor with the division number of the sliding window;
    以所述分割数为横坐标、所述内存因子为纵坐标绘制所述内存因子随所述滑动窗口的分割数变化得到的内存因子曲线;Taking the division number as the abscissa and the memory factor as the ordinate, draw the memory factor curve obtained by the memory factor changing with the division number of the sliding window;
    获取所述限流毛刺因子曲线与所述内存因子曲线的交点信息。Obtain the intersection information of the current-limiting glitch factor curve and the memory factor curve.
  13. 根据权利要求9所述的计算机设备,其中,所述将所述交点信息中表征交点横坐标数值的坐标数据作为所述滑动窗口的最佳分割数之后,还包括:The computer device according to claim 9, wherein after taking the coordinate data representing the abscissa value of the intersection in the intersection information as the optimal number of divisions of the sliding window, the method further comprises:
    采用所述最佳分割数作为所述滑动窗口的分割数对接收到的请求进行限流。The optimal number of divisions is used as the number of divisions of the sliding window to limit the current of the received requests.
  14. 根据权利要求11所述的计算机设备,其中,所述根据所述目标项目的可用内存大小对所述一元一次关系的初始参数进行参数优化,得到优化后的参数,包括:The computer device according to claim 11, wherein the parameter optimization is performed on the initial parameters of the one-dimensional linear relationship according to the available memory size of the target item, and the optimized parameters are obtained, comprising:
    获取所述目标项目的可用内存大小,并根据所述可用内存大小调整所述一元一次关系的斜率。The available memory size of the target item is acquired, and the slope of the unary primary relationship is adjusted according to the available memory size.
  15. 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有计算机程序,所述计算机程序当被处理器执行时使所述处理器执行:A computer-readable storage medium, wherein the computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to execute:
    采用限流毛刺因子对滑动窗口发生限流毛刺的概率进行量化,其中,所述限流毛刺因子表征所述滑动窗口的请求密度与毛刺覆盖度的乘积;A current-limiting glitch factor is used to quantify the probability of a current-limiting glitch occurring in the sliding window, wherein the current-limiting glitch factor represents the product of the request density and the glitch coverage of the sliding window;
    采用内存因子对滑动窗口的分割数对内存占用的影响进行量化,其中,所述内存因子表征基于所述滑动窗口的分割数确定的目标项目所占用的内存;Using a memory factor to quantify the impact of the number of divisions of the sliding window on the memory occupation, wherein the memory factor represents the memory occupied by the target item determined based on the number of divisions of the sliding window;
    确认所述限流毛刺因子与所述内存因子的交点信息;Confirm the intersection information of the current-limiting glitch factor and the memory factor;
    将所述交点信息中表征交点横坐标数值的坐标数据作为所述滑动窗口的最佳分割数。The coordinate data representing the abscissa value of the intersection point in the intersection point information is used as the optimal number of divisions of the sliding window.
  16. 根据权利要求15所述的计算机可读存储介质,其中,所述采用限流毛刺因子对滑动窗口发生限流毛刺的概率进行量化,其中,所述限流毛刺因子表征滑动窗口的请求密度与毛刺覆盖度的乘积,包括:The computer-readable storage medium according to claim 15, wherein the probability of occurrence of a current-limiting glitch in the sliding window is quantified by using a current-limiting glitch factor, wherein the current-limiting glitch factor represents a request density and a glitch of the sliding window The product of coverage, including:
    获取所述滑动窗口的值,并将利用自变量x对分割数进行表示;Obtain the value of the sliding window, and use the independent variable x to represent the number of divisions;
    计算所述滑动窗口的值除以所述分割数的值,得到小窗口的大小;Calculate the value of the sliding window divided by the value of the number of divisions to obtain the size of the small window;
    将所述滑动窗口的值减去所述小窗口的值,得到毛刺发生概率区;The value of the sliding window is subtracted from the value of the small window to obtain the burr occurrence probability area;
    将所述滑动窗口的值除以所述毛刺发生概率区的值,得到毛刺覆盖度;Divide the value of the sliding window by the value of the burr occurrence probability area to obtain the burr coverage;
    将所述滑动窗口的允许最大请求数的值除以所述滑动窗口的值,得到请求密度;Divide the value of the maximum number of requests allowed by the sliding window by the value of the sliding window to obtain the request density;
    将所述请求密度的值乘以所述毛刺覆盖度的值,得到限流毛刺因子。Multiply the value of the requested density by the value of the burr coverage to obtain a current-limiting burr factor.
  17. 根据权利要求15所述的计算机可读存储介质,其中,所述采用内存因子对滑动窗口的分割数对内存占用的影响进行量化,其中,所述内存因子表征基于滑动窗口的分割数确定的目标项目所占用的内存,包括:16. The computer-readable storage medium of claim 15, wherein the use of a memory factor to quantify the impact of the number of divisions of the sliding window on memory usage, wherein the memory factor represents a target determined based on the number of divisions of the sliding window The memory used by the project, including:
    预先将所述内存因子与所述滑动窗口的分割数的关系设置为一元一次关系,并设置所述一元一次关系的初始参数;The relationship between the memory factor and the number of divisions of the sliding window is set as a one-dimensional primary relationship in advance, and the initial parameters of the one-dimensional primary relationship are set;
    根据所述目标项目的可用内存大小对所述一元一次关系的初始参数进行参数优化,得到优化后的参数。Parameter optimization is performed on the initial parameters of the one-dimensional primary relationship according to the available memory size of the target item to obtain optimized parameters.
  18. 根据权利要求15所述的计算机可读存储介质,其中,所述确认所述限流毛刺因子与所述内存因子的交点信息,包括:The computer-readable storage medium of claim 15, wherein the confirming the intersection information of the current-limiting glitch factor and the memory factor comprises:
    以所述分割数为横坐标、所述限流毛刺因子为纵坐标绘制所述限流毛刺因子随所述滑动窗口的分割数变化得到的限流毛刺因子曲线;Taking the division number as the abscissa and the current-limiting glitch factor as the ordinate to draw a current-limiting glitch factor curve obtained by changing the current-limiting glitch factor with the division number of the sliding window;
    以所述分割数为横坐标、所述内存因子为纵坐标绘制所述内存因子随所述滑动窗口的分割数变化得到的内存因子曲线;Taking the division number as the abscissa and the memory factor as the ordinate, draw the memory factor curve obtained by the memory factor changing with the division number of the sliding window;
    获取所述限流毛刺因子曲线与所述内存因子曲线的交点信息。Obtain the intersection information of the current-limiting glitch factor curve and the memory factor curve.
  19. 根据权利要求15所述的计算机可读存储介质,其中,所述将所述交点信息中表征交点横坐标数值的坐标数据作为所述滑动窗口的最佳分割数之后,还包括:The computer-readable storage medium according to claim 15, wherein after taking the coordinate data representing the abscissa value of the intersection in the intersection information as the optimal number of divisions of the sliding window, the method further comprises:
    采用所述最佳分割数作为所述滑动窗口的分割数对接收到的请求进行限流。The optimal number of divisions is used as the number of divisions of the sliding window to limit the current of the received requests.
  20. 根据权利要求17所述的计算机可读存储介质,其中,所述根据所述目标项目的可用内存大小对所述一元一次关系的初始参数进行参数优化,得到优化后的参数,包括:The computer-readable storage medium according to claim 17, wherein the parameter optimization is performed on the initial parameters of the unary primary relationship according to the available memory size of the target item, and the optimized parameters are obtained, comprising:
    获取所述目标项目的可用内存大小,并根据所述可用内存大小调整所述一元一次关系的斜率。The available memory size of the target item is acquired, and the slope of the unary primary relationship is adjusted according to the available memory size.
PCT/CN2021/097187 2020-11-06 2021-05-31 Sliding window configuration method and apparatus, computer device and storage medium WO2022095430A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011229805.5A CN112346867B (en) 2020-11-06 2020-11-06 Configuration method and device of sliding window, computer equipment and storage medium
CN202011229805.5 2020-11-06

Publications (1)

Publication Number Publication Date
WO2022095430A1 true WO2022095430A1 (en) 2022-05-12

Family

ID=74429789

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/097187 WO2022095430A1 (en) 2020-11-06 2021-05-31 Sliding window configuration method and apparatus, computer device and storage medium

Country Status (2)

Country Link
CN (1) CN112346867B (en)
WO (1) WO2022095430A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115659162A (en) * 2022-09-15 2023-01-31 云南财经大学 Method, system and equipment for extracting features in radar radiation source signal pulse

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112346867B (en) * 2020-11-06 2024-05-14 平安科技(深圳)有限公司 Configuration method and device of sliding window, computer equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1968192A (en) * 2006-05-09 2007-05-23 华为技术有限公司 Flow control method and apparatus
CN101212401A (en) * 2006-12-29 2008-07-02 中兴通讯股份有限公司 Grid-oriented configurable data transmission method and system
CN103345392A (en) * 2013-06-26 2013-10-09 华为技术有限公司 Information processing method and device
US20140215077A1 (en) * 2013-01-26 2014-07-31 Lyatiss, Inc. Methods and systems for detecting, locating and remediating a congested resource or flow in a virtual infrastructure
CN105024946A (en) * 2015-06-16 2015-11-04 清华大学 Bandwidth allocation method based on sliding window, device and system
US20160174209A1 (en) * 2014-12-12 2016-06-16 Korea University Research And Business Foundation Method and Apparatus of Allocating Resources for Terminal in Wireless Communication System
CN112346867A (en) * 2020-11-06 2021-02-09 平安科技(深圳)有限公司 Configuration method and device of sliding window, computer equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108551465B (en) * 2018-03-09 2020-06-09 平安科技(深圳)有限公司 Server concurrency control method and device, computer equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1968192A (en) * 2006-05-09 2007-05-23 华为技术有限公司 Flow control method and apparatus
CN101212401A (en) * 2006-12-29 2008-07-02 中兴通讯股份有限公司 Grid-oriented configurable data transmission method and system
US20140215077A1 (en) * 2013-01-26 2014-07-31 Lyatiss, Inc. Methods and systems for detecting, locating and remediating a congested resource or flow in a virtual infrastructure
CN103345392A (en) * 2013-06-26 2013-10-09 华为技术有限公司 Information processing method and device
US20160174209A1 (en) * 2014-12-12 2016-06-16 Korea University Research And Business Foundation Method and Apparatus of Allocating Resources for Terminal in Wireless Communication System
CN105024946A (en) * 2015-06-16 2015-11-04 清华大学 Bandwidth allocation method based on sliding window, device and system
CN112346867A (en) * 2020-11-06 2021-02-09 平安科技(深圳)有限公司 Configuration method and device of sliding window, computer equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115659162A (en) * 2022-09-15 2023-01-31 云南财经大学 Method, system and equipment for extracting features in radar radiation source signal pulse
CN115659162B (en) * 2022-09-15 2023-10-03 云南财经大学 Method, system and equipment for extracting intra-pulse characteristics of radar radiation source signals

Also Published As

Publication number Publication date
CN112346867A (en) 2021-02-09
CN112346867B (en) 2024-05-14

Similar Documents

Publication Publication Date Title
WO2022095430A1 (en) Sliding window configuration method and apparatus, computer device and storage medium
US11099997B2 (en) Data prefetching method and apparatus, and storage device
JP2021511588A (en) Data query methods, devices and devices
CN110209502B (en) Information storage method and device, electronic equipment and storage medium
WO2021073130A1 (en) Frequency modulation method and apparatus for processor, and computing device
KR20120040819A (en) Apparatus and method for adaptive frequency scaling in digital system
US8438275B1 (en) Formatting data for efficient communication over a network
EP4020153A1 (en) Cache space management method and device
JP6840225B2 (en) Mechanism for throttling untrusted interconnect agents
JP5674954B2 (en) Stream data abnormality detection method and apparatus
WO2015188649A1 (en) Method of mapping between virtual cpu and physical cpu, and electronic device
CN111124952B (en) Data management method and device, electronic equipment and readable storage medium
US9740618B2 (en) Memory nest efficiency with cache demand generation
CN113094392A (en) Data caching method and device
CN110750498A (en) Object access method, device and storage medium
JPWO2019215795A1 (en) Information processing equipment, tuning method and tuning program
US20160342540A1 (en) Low latency memory and bus frequency scaling based upon hardware monitoring
WO2024000904A1 (en) Traffic detection method and apparatus, and device and readable storage medium
CN114327918B (en) Method and device for adjusting resource amount, electronic equipment and storage medium
CN112333276B (en) Network access method, system, storage medium and electronic device
JP6849908B2 (en) Information processing device, PLD management program and PLD management method
JP2023539570A (en) Capture pressure control method, device, electronic device and readable storage medium
CN108121507A (en) A kind of data processing method, device and electronic equipment
CN115225094A (en) Data compression method, electronic device and computer program product
US11989415B2 (en) Enabling or disabling data reduction based on measure of data overwrites

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21888133

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21888133

Country of ref document: EP

Kind code of ref document: A1