WO2022105116A1 - High-frequency request processing method and apparatus, electronic device and storage medium - Google Patents

High-frequency request processing method and apparatus, electronic device and storage medium Download PDF

Info

Publication number
WO2022105116A1
WO2022105116A1 PCT/CN2021/090354 CN2021090354W WO2022105116A1 WO 2022105116 A1 WO2022105116 A1 WO 2022105116A1 CN 2021090354 W CN2021090354 W CN 2021090354W WO 2022105116 A1 WO2022105116 A1 WO 2022105116A1
Authority
WO
WIPO (PCT)
Prior art keywords
request
trigger
time
target
stack
Prior art date
Application number
PCT/CN2021/090354
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
Priority claimed from CN202011290509.6A external-priority patent/CN112416583B/en
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2022105116A1 publication Critical patent/WO2022105116A1/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/5061Partitioning or combining of resources
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation

Definitions

  • the present application relates to the technical field of data processing, and in particular, to a high-frequency request processing method, device, electronic device, and storage medium.
  • a first aspect of the present application provides a high-frequency request processing method, the high-frequency request processing method comprising:
  • the request type is the high-frequency request
  • the target request is sent to the preset server for processing, and a response result is obtained.
  • a second aspect of the present application provides an electronic device, the electronic device includes a processor and a memory, the processor is configured to execute at least one computer-readable instruction stored in the memory to implement the following steps:
  • the request type is the high-frequency request
  • the target request is sent to the preset server for processing, and a response result is obtained.
  • a third aspect of the present application provides a computer-readable storage medium having at least one computer-readable instruction stored thereon, the at least one computer-readable instruction being executed by a processor to implement the following steps:
  • the request type is the high-frequency request
  • the target request is sent to the preset server for processing, and a response result is obtained.
  • a fourth aspect of the present application provides a high-frequency request processing device, wherein the high-frequency request processing includes:
  • a determining unit configured to determine a triggering terminal and a triggering user of the triggering request when a triggering request is received;
  • an extraction unit configured to obtain a request log from the trigger terminal, and extract target log information from the request log according to the trigger user;
  • the determining unit is further configured to analyze the target log information to determine the request type to which the trigger request belongs, and the request type includes a high-frequency request;
  • a creation unit configured to create a request stack according to the target log information when the request type is the high-frequency request, and write the trigger request into the request stack;
  • a merging unit for merging all element requests in the request stack to obtain a target request when the request stack is full
  • a sending unit configured to send the target request to a preset server for processing, and obtain a response result.
  • the present application can accurately determine the log information recording the trigger operation of the trigger user through the determined trigger terminal and the trigger user, because all the target log information is stored in the target log information. Therefore, by analyzing the target log information, it can be accurately determined whether the trigger request is a high-frequency request, and by writing the trigger request into the request stack, the trigger can be avoided. The request is lost, thereby ensuring the integrity of the request data. By combining all element requests in the request stack, the generated target request contains multiple requests, and then multiple requests are sent to the preset server at one time. Process to avoid thread blocking.
  • the present application When it is determined that the trigger request belongs to a high-frequency request, the present application combines a plurality of the trigger requests into the target request, and then sends the combined target request to the preset server for processing, so as to avoid
  • the multiple trigger requests repeatedly trigger the preset server, thereby improving the performance of the preset server, thereby improving the reflow efficiency of the response result, and improving the smoothness of the page view.
  • the triggering All trigger requests generated by the user participate in the response so the integrity of the requested data can be ensured when the page view is displayed smoothly.
  • FIG. 1 is a flowchart of a preferred embodiment of the high-frequency request processing method of the present application.
  • FIG. 2 is a flowchart of an embodiment of the present application for determining a trigger terminal and a trigger user.
  • FIG. 3 is a flowchart of an embodiment of the present application for determining the request type to which the trigger request belongs.
  • FIG. 4 is a flowchart of an embodiment of the present application for creating a request stack.
  • FIG. 5 is a functional block diagram of a preferred embodiment of the high-frequency request processing device of the present application.
  • FIG. 6 is a schematic structural diagram of an electronic device implementing a preferred embodiment of the high-frequency request processing method of the present application.
  • FIG. 1 it is a flowchart of a preferred embodiment of the high-frequency request processing method of the present application. According to different requirements, the order of steps in this flowchart can be changed, and some steps can be omitted.
  • the high-frequency request processing method is applied to one or more electronic devices, and the electronic device is a device that can automatically perform numerical calculation and/or information processing according to pre-set or stored computer-readable instructions.
  • Hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), programmable gate arrays (Field-Programmable Gate Arrays, FPGAs), digital processors (Digital Signal Processors, DSPs), embedded devices, etc. .
  • the electronic device can be any electronic product that can interact with the user, such as a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), a game console, an interactive network television ( Internet Protocol Television, IPTV), smart wearable devices, etc.
  • a personal computer a tablet computer
  • a smart phone a personal digital assistant (PDA)
  • PDA personal digital assistant
  • IPTV interactive network television
  • smart wearable devices etc.
  • the electronic equipment may include network equipment and/or user equipment.
  • the network device includes, but is not limited to, a single network electronic device, an electronic device group composed of multiple network electronic devices, or a cloud composed of a large number of hosts or network electronic devices based on cloud computing (Cloud Computing).
  • the network where the electronic device is located includes, but is not limited to, the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (Virtual Private Network, VPN), and the like.
  • VPN Virtual Private Network
  • the scene corresponding to the trigger request may be any scene, for example, the trigger request may be displaying a track of a user dragging an element. Further, the trigger request may be triggered and generated by any user.
  • the trigger terminal refers to the generation terminal of the trigger request, and the trigger terminal may be a mobile phone, a computer, a tablet, or the like.
  • the triggering user refers to a user who triggers the generation of the triggering request.
  • FIG. 2 is a flowchart of an embodiment of the present application for determining a trigger terminal and a trigger user.
  • determining, by the electronic device, a triggering terminal and a triggering user of the triggering request include:
  • S100 parse the trigger request to obtain data information carried by the trigger request.
  • the data information includes a trigger address and a user identification code.
  • S101 Acquire a first preset tag and a second preset tag from a configuration tag library, where the first preset tag is used to indicate an address, and the second preset tag is used to indicate a user.
  • a plurality of pre-defined tags are stored in the configuration tag library.
  • S102 Acquire information corresponding to the first preset tag from the data information as a trigger address, and acquire information corresponding to the second preset tag from the data information as a user identification code.
  • S103 Determine the terminal corresponding to the trigger address as the trigger terminal, and determine the user corresponding to the user identification code as the trigger user.
  • the triggering address and then the triggering terminal can be accurately determined through the first preset label. Meanwhile, the user identification code can be accurately determined through the second preset label, and then the user identification code can be accurately determined through the second preset label. The triggering user is determined.
  • S11 Acquire a request log from the triggering terminal, and extract target log information from the request log according to the triggering user.
  • the request log refers to an operation log recorded on the trigger terminal, and the request log records all operations on the trigger terminal.
  • the target log information refers to all operations of the triggering user on the triggering terminal.
  • the electronic device acquiring the request log from the triggering terminal, and extracting target log information from the request log according to the triggering user includes:
  • the log information corresponding to the user identification code is selected from the request log as the target log information.
  • the request log can be quickly acquired through the log storage path, and the target log information can be accurately determined through the user identification code.
  • S12 Analyze the target log information to determine a request type to which the trigger request belongs, where the request type includes a high-frequency request.
  • the request type further includes a low frequency request.
  • FIG. 3 is a flowchart of an embodiment of the present application for determining the request type to which the trigger request belongs.
  • the electronic device analyzing the target log information to determine the request type to which the trigger request belongs includes:
  • S120 Acquire the response time of all historical requests in the target log information, and acquire the generation time of the trigger request from the target log information.
  • the response time refers to the time when each historical request completes the response
  • the generation time refers to the time when the trigger request is triggered to be generated.
  • S121 Calculate a first time difference between each response time and the generation time, and determine a response time when the first time difference is less than a first preset value as a target time.
  • S122 Sort the target time and the generation time in ascending order to obtain a time queue.
  • S123 Calculate a second time difference between any adjacent times in the time queue, and calculate the number of times that the second time difference is smaller than a second preset value, where the second preset value is smaller than the first preset value .
  • the arbitrary adjacent times refers to any two times that are adjacent to the position on the time queue.
  • the value of the configuration value may be freely configured according to the application scenario, and the present application does not limit the value of the configuration value.
  • premature historical requests can be eliminated, preventing premature historical requests from affecting the determination of the request type, through the comparison of any adjacent time in the time queue, and any The determination of the number of times that the time difference between adjacent times is less than the second preset value can accurately determine the request type to which the trigger request belongs.
  • the request stack is composed of multiple storage areas.
  • FIG. 4 is a flowchart of an embodiment of the present application for creating a request stack.
  • the electronic device creating a request stack according to the target log information includes:
  • S130 Determine the time when the second time difference is smaller than the second preset value as the analysis time, and determine the earliest time and the latest time in the analysis time.
  • S131 Calculate the time difference between the latest time and the earliest time as a time interval, and divide the time interval by the number to obtain the requested access frequency.
  • the requested access frequency refers to the access frequency of requests whose response time ranges from the earliest time to the latest time.
  • S132 Acquire trigger times of all historical requests from the target log information, and calculate a time difference between each trigger time and each response time as a response time.
  • S133 Calculate the time sum of the response time, and calculate the request quantity of all the historical requests.
  • S134 Divide the total time by the number of requests to obtain an average time, and multiply the request access frequency by the average time to obtain the number of storage areas.
  • the number of storage areas in the request stack is the number of storage areas.
  • the number of storage areas is determined based on the requested access frequency and the average time. Since both the requested access frequency and the average time are determined through historical requests, the The number of storage areas is based on actual application scenarios, thereby improving the practicability of the present application.
  • the electronic device writing the trigger request into the request stack includes:
  • the target storage area refers to the next empty storage area where the stack pointer is located, it is possible to prevent the target storage area from including other requests, thereby ensuring that the target storage area can be written into the target storage area.
  • the loss of the trigger request can be avoided, thereby ensuring the integrity of the request data.
  • the fact that the request stack is full indicates that there is no empty storage area in the request stack.
  • the target request carries all the packet contents in the all element requests.
  • the electronic device combines all element requests in the request stack to obtain the target request including:
  • the method body and the target header are encapsulated to obtain the target request.
  • the merging efficiency of the target request can be improved.
  • the generated target request includes multiple requests, and then the multiple requests are sent to the preset server at one time for processing , to avoid thread blocking.
  • S15 Send the target request to a preset server for processing, and obtain a response result.
  • the above response results can also be stored in a node of a blockchain.
  • the preset server refers to a server corresponding to the destination address of the target request.
  • the response results include responses to multiple requests triggered by the user.
  • the method further includes:
  • the prompt information is generated based on the request number requested by each element, so that the triggering user can grasp the response object of the response result. Encrypting the prompt information through a symmetric encryption algorithm can not only improve the encryption efficiency, but also avoid the prompt. The information is tampered with, which improves the security of the prompt information.
  • the present application can accurately determine the log information recording the trigger operation of the trigger user through the determined trigger terminal and the trigger user, because all the target log information is stored in the target log information. Therefore, by analyzing the target log information, it can be accurately determined whether the trigger request is a high-frequency request, and by writing the trigger request into the request stack, the trigger can be avoided. The request is lost, thereby ensuring the integrity of the request data. By combining all element requests in the request stack, the generated target request contains multiple requests, and then multiple requests are sent to the preset server at one time. Process to avoid thread blocking.
  • the present application When it is determined that the trigger request belongs to a high-frequency request, the present application combines a plurality of the trigger requests into the target request, and then sends the combined target request to the preset server for processing, so as to avoid
  • the multiple trigger requests repeatedly trigger the preset server, thereby improving the performance of the preset server, thereby improving the reflow efficiency of the response results, and improving the smoothness of the page view.
  • All trigger requests generated by the user participate in the response, so the integrity of the requested data can be ensured when the page view is displayed smoothly.
  • the high-frequency request processing device 11 includes a determining unit 110 , an extracting unit 111 , a creating unit 112 , a merging unit 113 , a sending unit 114 , an obtaining unit 115 , a generating unit 116 and an encryption unit 117 .
  • the module/unit referred to in this application refers to a series of computer-readable instruction segments that can be acquired by the processor 13 and can perform fixed functions, and are stored in the memory 12 . In this embodiment, the functions of each module/unit will be described in detail in subsequent embodiments.
  • the determining unit 110 determines the trigger terminal and trigger user of the trigger request.
  • the scene corresponding to the trigger request may be any scene, for example, the trigger request may be displaying a track of a user dragging an element. Further, the trigger request may be triggered and generated by any user.
  • the trigger terminal refers to the generation terminal of the trigger request, and the trigger terminal may be a mobile phone, a computer, a tablet, or the like.
  • the triggering user refers to a user who triggers the generation of the triggering request.
  • the determining unit 110 determines the triggering terminal and the triggering user of the triggering request include:
  • the data information includes a trigger address and a user identification code.
  • a first preset tag and a second preset tag are obtained from a configuration tag library, where the first preset tag is used to indicate an address, and the second preset tag is used to indicate a user.
  • a plurality of pre-defined tags are stored in the configuration tag library.
  • the information corresponding to the first preset tag is acquired from the data information as a trigger address, and the information corresponding to the second preset tag is acquired from the data information as a user identification code.
  • a terminal corresponding to the trigger address is determined as the trigger terminal, and a user corresponding to the user identification code is determined as the trigger user.
  • the triggering address and then the triggering terminal can be accurately determined through the first preset label. Meanwhile, the user identification code can be accurately determined through the second preset label, and then the user identification code can be accurately determined through the second preset label. The triggering user is determined.
  • the extracting unit 111 acquires the request log from the trigger terminal, and extracts target log information from the request log according to the trigger user.
  • the request log refers to an operation log recorded on the trigger terminal, and the request log records all operations on the trigger terminal.
  • the target log information refers to all operations of the triggering user on the triggering terminal.
  • the extracting unit 111 acquires the request log from the trigger terminal, and extracts target log information from the request log according to the trigger user, including:
  • the log information corresponding to the user identification code is selected from the request log as the target log information.
  • the request log can be quickly acquired through the log storage path, and the target log information can be accurately determined through the user identification code.
  • the determining unit 110 analyzes the target log information to determine a request type to which the trigger request belongs, where the request type includes a high-frequency request.
  • the request type further includes a low frequency request.
  • the determining unit 110 analyzes the target log information to determine the request type to which the trigger request belongs:
  • the response time refers to the time when each historical request completes the response
  • the generation time refers to the time when the trigger request is triggered to be generated.
  • a first time difference between each response time and the generation time is calculated, and a response time when the first time difference is less than a first preset value is determined as a target time.
  • the arbitrary adjacent times refers to any two times that are adjacent to the position on the time queue.
  • the request type to which the trigger request belongs is the high-frequency request.
  • the value of the configuration value may be freely configured according to the application scenario, and the present application does not limit the value of the configuration value.
  • the request type to which the trigger request belongs is a low frequency request.
  • premature historical requests can be eliminated, preventing premature historical requests from affecting the determination of the request type, through the comparison of any adjacent time in the time queue, and any The determination of the number of times that the time difference between adjacent times is less than the second preset value can accurately determine the request type to which the trigger request belongs.
  • the creating unit 112 creates a request stack according to the target log information, and writes the trigger request into the request stack.
  • the request stack is composed of multiple storage areas.
  • the creating unit 112 creating a request stack according to the target log information includes:
  • the time when the second time difference is smaller than the second preset value is determined as the analysis time, and the earliest time and the latest time in the analysis time are determined.
  • the time difference between the latest time and the earliest time is calculated as a time interval, and the time interval is divided by the quantity to obtain the requested access frequency.
  • the requested access frequency refers to the access frequency of requests whose response time ranges from the earliest time to the latest time.
  • the trigger times of all historical requests are obtained from the target log information, and the time difference between each trigger time and each response time is calculated as the response time.
  • the average time is obtained by dividing the sum of the times by the number of requests, and the number of storage areas is obtained by multiplying the request access frequency by the average time.
  • the request stack is created according to the number of storage areas.
  • the number of storage areas in the request stack is the number of storage areas.
  • the number of storage areas is determined based on the requested access frequency and the average time. Since both the requested access frequency and the average time are determined through historical requests, the The number of storage areas is based on actual application scenarios, thereby improving the practicability of the present application.
  • the creation unit 112 writing the trigger request into the request stack includes:
  • the target storage area refers to the next empty storage area where the stack pointer is located, it is possible to prevent the target storage area from including other requests, thereby ensuring that the target storage area can be written into the target storage area.
  • the loss of the trigger request can be avoided, thereby ensuring the integrity of the request data.
  • the merging unit 113 merges all element requests in the request stack to obtain the target request.
  • the fact that the request stack is full indicates that there is no empty storage area in the request stack.
  • the target request carries all the packet contents in the all element requests.
  • the merging unit 113 merges all element requests in the request stack to obtain the target request including:
  • the method body and the target header are encapsulated to obtain the target request.
  • the merging efficiency of the target request can be improved.
  • the generated target request includes multiple requests, and then the multiple requests are sent to the preset server at one time for processing , to avoid thread blocking.
  • the sending unit 114 sends the target request to the preset server for processing, and obtains a response result.
  • the above response results can also be stored in a node of a blockchain.
  • the preset server refers to a server corresponding to the destination address of the target request.
  • the response results include responses to multiple requests triggered by the user.
  • the obtaining unit 115 obtains the request number of each element request
  • the generating unit 116 generates prompt information according to the request number and the response result
  • the encryption unit 117 uses a symmetric encryption algorithm to encrypt the prompt information to obtain the target ciphertext
  • the sending unit 114 sends the target ciphertext to the trigger terminal.
  • the prompt information is generated based on the request number requested by each element, so that the triggering user can grasp the response object of the response result. Encrypting the prompt information through a symmetric encryption algorithm can not only improve the encryption efficiency, but also avoid the prompt. The information is tampered with, which improves the security of the prompt information.
  • the present application can accurately determine the log information recording the trigger operation of the trigger user through the determined trigger terminal and the trigger user, because all the target log information is stored in the target log information. Therefore, by analyzing the target log information, it can be accurately determined whether the trigger request is a high-frequency request, and by writing the trigger request into the request stack, the trigger can be avoided. The request is lost, thereby ensuring the integrity of the request data. By combining all element requests in the request stack, the generated target request contains multiple requests, and then multiple requests are sent to the preset server at one time. Process to avoid thread blocking.
  • the present application When it is determined that the trigger request belongs to a high-frequency request, the present application combines a plurality of the trigger requests into the target request, and then sends the combined target request to the preset server for processing, so as to avoid
  • the multiple trigger requests repeatedly trigger the preset server, thereby improving the performance of the preset server, thereby improving the reflow efficiency of the response result, and improving the smoothness of the page view.
  • the triggering All trigger requests generated by the user participate in the response so the integrity of the requested data can be ensured when the page view is displayed smoothly.
  • FIG. 6 it is a schematic structural diagram of an electronic device implementing a preferred embodiment of the high-frequency request processing method of the present application.
  • the electronic device 1 includes, but is not limited to, a memory 12 , a processor 13 , and computer-readable instructions stored in the memory 12 and executable on the processor 13 , such as high-frequency request handlers.
  • the schematic diagram is only an example of the electronic device 1, and does not constitute a limitation on the electronic device 1, and may include more or less components than the one shown, or combine some components, or different Components, for example, the electronic device 1 may also include input and output devices, network access devices, buses, and the like.
  • the processor 13 may be a central processing unit (Central Processing Unit, CPU), or other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (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, etc.
  • the processor 13 is the computing core and control center of the electronic device 1, and uses various interfaces and lines to connect the entire electronic device. 1, and the operating system that executes the electronic device 1, as well as various installed applications, program codes, and the like.
  • the computer-readable instructions may be divided into one or more modules/units, and the one or more modules/units are stored in the memory 12 and executed by the processor 13 to Complete this application.
  • the one or more modules/units may be a series of computer-readable instruction segments capable of accomplishing specific functions, and the computer-readable instruction segments are used to describe the execution process of the computer-readable instructions in the electronic device 1 .
  • the computer readable instructions may be divided into a determination unit 110 , an extraction unit 111 , a creation unit 112 , a merge unit 113 , a transmission unit 114 , an acquisition unit 115 , a generation unit 116 , and an encryption unit 117 .
  • the memory 12 can be used to store the computer-readable instructions and/or modules, and the processor 13 executes or executes the computer-readable instructions and/or modules stored in the memory 12 and invokes the computer-readable instructions and/or modules stored in the memory 12.
  • the data in the electronic device 1 realizes various functions of the electronic device 1 .
  • the memory 12 may mainly include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), and the like; the storage data area may Data and the like created according to the use of the electronic device are stored.
  • the memory 12 may include non-volatile and volatile memory such as: hard disk, internal memory, plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, Flash memory card (Flash Card), at least one disk storage device, flash memory device, or other storage device.
  • non-volatile and volatile memory such as: hard disk, internal memory, plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, Flash memory card (Flash Card), at least one disk storage device, flash memory device, or other storage device.
  • the memory 12 may be an external memory and/or an internal memory of the electronic device 1 . Further, the storage 12 may be a storage in physical form, such as a memory stick, a TF card (Trans-flash Card) and the like.
  • TF card Trans-flash Card
  • modules/units integrated in the electronic device 1 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium, and the computer-readable storage medium may be a non-volatile storage medium. Volatile, can also be volatile.
  • the present application can implement all or part of the processes in the methods of the above embodiments, and can also be completed by instructing relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium.
  • the computer-readable instructions when executed by the processor, can implement the steps of the above-mentioned method embodiments.
  • the computer-readable instructions include computer-readable instruction codes
  • the computer-readable instruction codes may be in source code form, object code form, executable file, or some intermediate form, and the like.
  • the computer-readable medium may include: any entity or device capable of carrying the computer-readable instruction code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM, Read-Only). Memory), random access memory (RAM, Random Access Memory).
  • the blockchain referred to in this application is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
  • Blockchain essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information to verify its Validity of information (anti-counterfeiting) and generation of the next block.
  • the blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
  • the memory 12 in the electronic device 1 stores computer-readable instructions to implement a high-frequency request processing method
  • the processor 13 can execute the computer-readable instructions to implement:
  • the request type is the high-frequency request
  • the target request is sent to the preset server for processing, and a response result is obtained.
  • the computer-readable storage medium stores computer-readable instructions, wherein the computer-readable instructions are used to implement the following steps when executed by the processor 13:
  • the request type is the high-frequency request
  • the target request is sent to the preset server for processing, and a response result is obtained.
  • modules described as separate components may or may not be physically separated, and components shown as modules 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 modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional module 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 can be implemented in the form of hardware, or can be implemented in the form of hardware plus software function modules.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The present application relates to data processing, and provides a high-frequency request processing method and apparatus, an electronic device and a storage medium. The method is capable of determining a trigger terminal and a trigger user of a trigger request; obtaining a request log from the trigger terminal, and extracting target log information from the request log according to the trigger user; analyzing the target log information to determine a request type of the trigger request; when the request type is high-frequency request, creating a request stack according to the target log information, and writing the trigger request into the request stack; when the request stack is a full stack, merging all element requests in the request stack to obtain a target request; and sending the target request to a preset server for processing, so as to obtain a response result. The present application is capable of smoothly displaying a page view, while also ensuring the completeness of the request data. In addition, the present application also relates to blockchain technology, and the response result may be stored in a blockchain.

Description

高频请求处理方法、装置、电子设备及存储介质High-frequency request processing method, device, electronic device and storage medium
本申请要求于2020年11月17日提交中国专利局,申请号为202011290509.6,发明名称为“高频请求处理方法、装置、电子设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on November 17, 2020 with the application number 202011290509.6 and the invention title is "High-frequency request processing method, device, electronic device and storage medium", the entire content of which is approved by Reference is incorporated in this application.
技术领域technical field
本申请涉及数据处理技术领域,尤其涉及一种高频请求处理方法、装置、电子设备及存储介质。The present application relates to the technical field of data processing, and in particular, to a high-frequency request processing method, device, electronic device, and storage medium.
背景技术Background technique
在WEB前端领域中,如在Vue、React、Angular等框架中,短时间内出现高频率触发请求容易造成JS线程阻塞,还会引起页面渲染的视图卡顿以及不流畅。例如,在蚂蚁DataV数据可视化中有如下需求:记录用户拖拽元素的轨迹并显示,然而该需求需要监听鼠标的移动,当鼠标每次移动时均产生相应的触发请求,高频率地改变页面视图容易造成页面显示卡顿等问题。In the WEB front-end field, such as in Vue, React, Angular and other frameworks, high-frequency trigger requests in a short period of time can easily cause JS thread blocking, and also cause the view of page rendering to be stuck and unsmooth. For example, in the data visualization of Ant DataV, there are the following requirements: record the trajectory of the element dragged by the user and display it. However, this requirement needs to monitor the movement of the mouse. Every time the mouse moves, a corresponding trigger request is generated, and the page view is frequently changed. It is easy to cause problems such as page display freezes.
为了避免页面视图产生卡顿现象,目前通常采用防抖或者截留方案,然而,发明人意识到这种方式无法对每次触发的请求进行存储,造成请求数据的丢失,不利于请求的响应。In order to prevent the page view from being stuck, an anti-shake or interception scheme is usually adopted at present. However, the inventor realizes that this method cannot store every triggered request, resulting in the loss of the request data, which is not conducive to the response of the request.
发明内容SUMMARY OF THE INVENTION
鉴于以上内容,有必要提供一种高频请求处理方法、装置、电子设备及存储介质,能够在页面视图流畅展示时,确保请求数据的完整性。In view of the above content, it is necessary to provide a high-frequency request processing method, device, electronic device and storage medium, which can ensure the integrity of the requested data when the page view is displayed smoothly.
本申请的第一方面提供一种高频请求处理方法,所述高频请求处理方法包括:A first aspect of the present application provides a high-frequency request processing method, the high-frequency request processing method comprising:
当接收到触发请求时,确定所述触发请求的触发终端及触发用户;When receiving the trigger request, determine the trigger terminal and trigger user of the trigger request;
从所述触发终端中获取请求日志,并根据所述触发用户从所述请求日志中提取目标日志信息;Obtain a request log from the trigger terminal, and extract target log information from the request log according to the trigger user;
分析所述目标日志信息确定所述触发请求所属的请求类型,所述请求类型包括高频请求;Analyze the target log information to determine the request type to which the trigger request belongs, where the request type includes high-frequency requests;
当所述请求类型为所述高频请求时,根据所述目标日志信息创建请求堆栈,并将所述触发请求写入所述请求堆栈中;When the request type is the high-frequency request, create a request stack according to the target log information, and write the trigger request into the request stack;
当所述请求堆栈为满栈时,合并所述请求堆栈中所有元素请求,得到目标请求;When the request stack is full, merge all element requests in the request stack to obtain the target request;
发送所述目标请求至预设服务器进行处理,得到响应结果。The target request is sent to the preset server for processing, and a response result is obtained.
本申请的第二方面提供一种电子设备,所述电子设备包括处理器和存储器,所述处理器用于执行所述存储器中存储的至少一个计算机可读指令以实现以下步骤:A second aspect of the present application provides an electronic device, the electronic device includes a processor and a memory, the processor is configured to execute at least one computer-readable instruction stored in the memory to implement the following steps:
当接收到触发请求时,确定所述触发请求的触发终端及触发用户;When receiving the trigger request, determine the trigger terminal and trigger user of the trigger request;
从所述触发终端中获取请求日志,并根据所述触发用户从所述请求日志中提取目标日志信息;Obtain a request log from the trigger terminal, and extract target log information from the request log according to the trigger user;
分析所述目标日志信息确定所述触发请求所属的请求类型,所述请求类型包括高频请求;Analyze the target log information to determine the request type to which the trigger request belongs, where the request type includes high-frequency requests;
当所述请求类型为所述高频请求时,根据所述目标日志信息创建请求堆栈,并将所述触发请求写入所述请求堆栈中;When the request type is the high-frequency request, create a request stack according to the target log information, and write the trigger request into the request stack;
当所述请求堆栈为满栈时,合并所述请求堆栈中所有元素请求,得到目标请求;When the request stack is full, merge all element requests in the request stack to obtain the target request;
发送所述目标请求至预设服务器进行处理,得到响应结果。The target request is sent to the preset server for processing, and a response result is obtained.
本申请的第三方面提供一种计算机可读存储介质,所述计算机可读存储介质上存储 有至少一个计算机可读指令,所述至少一个计算机可读指令被处理器执行以实现以下步骤:A third aspect of the present application provides a computer-readable storage medium having at least one computer-readable instruction stored thereon, the at least one computer-readable instruction being executed by a processor to implement the following steps:
当接收到触发请求时,确定所述触发请求的触发终端及触发用户;When receiving the trigger request, determine the trigger terminal and trigger user of the trigger request;
从所述触发终端中获取请求日志,并根据所述触发用户从所述请求日志中提取目标日志信息;Obtain a request log from the trigger terminal, and extract target log information from the request log according to the trigger user;
分析所述目标日志信息确定所述触发请求所属的请求类型,所述请求类型包括高频请求;Analyze the target log information to determine the request type to which the trigger request belongs, where the request type includes high-frequency requests;
当所述请求类型为所述高频请求时,根据所述目标日志信息创建请求堆栈,并将所述触发请求写入所述请求堆栈中;When the request type is the high-frequency request, create a request stack according to the target log information, and write the trigger request into the request stack;
当所述请求堆栈为满栈时,合并所述请求堆栈中所有元素请求,得到目标请求;When the request stack is full, merge all element requests in the request stack to obtain the target request;
发送所述目标请求至预设服务器进行处理,得到响应结果。The target request is sent to the preset server for processing, and a response result is obtained.
本申请的第四方面提供一种高频请求处理装置,所述高频请求处理包括:A fourth aspect of the present application provides a high-frequency request processing device, wherein the high-frequency request processing includes:
确定单元,用于当接收到触发请求时,确定所述触发请求的触发终端及触发用户;a determining unit, configured to determine a triggering terminal and a triggering user of the triggering request when a triggering request is received;
提取单元,用于从所述触发终端中获取请求日志,并根据所述触发用户从所述请求日志中提取目标日志信息;an extraction unit, configured to obtain a request log from the trigger terminal, and extract target log information from the request log according to the trigger user;
所述确定单元,还用于分析所述目标日志信息确定所述触发请求所属的请求类型,所述请求类型包括高频请求;The determining unit is further configured to analyze the target log information to determine the request type to which the trigger request belongs, and the request type includes a high-frequency request;
创建单元,用于当所述请求类型为所述高频请求时,根据所述目标日志信息创建请求堆栈,并将所述触发请求写入所述请求堆栈中;A creation unit, configured to create a request stack according to the target log information when the request type is the high-frequency request, and write the trigger request into the request stack;
合并单元,用于当所述请求堆栈为满栈时,合并所述请求堆栈中所有元素请求,得到目标请求;a merging unit for merging all element requests in the request stack to obtain a target request when the request stack is full;
发送单元,用于发送所述目标请求至预设服务器进行处理,得到响应结果。A sending unit, configured to send the target request to a preset server for processing, and obtain a response result.
由以上技术方案可以看出,本申请通过确定出的所述触发终端及所述触发用户,能够准确确定出记载所述触发用户的触发操作的日志信息,由于所述目标日志信息中存储了所述触发用户触发的所有请求,因此,通过分析所述目标日志信息能够准确确定出所述触发请求是否属于高频请求,通过将所述触发请求写入所述请求堆栈中,能够避免所述触发请求的丢失,进而确保请求数据的完整性,通过合并所述请求堆栈中所有元素请求,使生成的所述目标请求中包含多个请求,进而将多个请求一次性发送至所述预设服务器进行处理,能够避免线程产生阻塞。本申请在确定出所述触发请求属于高频请求时,将多个所述触发请求合并成所述目标请求,进而将合并成的所述目标请求发送至所述预设服务器中进行处理,避免多个所述触发请求对所述预设服务器进行重复触发,从而提高了所述预设服务器的性能,进而提高所述响应结果的回流效率,提高页面视图的流畅性,此外,由于所述触发用户产生的所有触发请求均参与到响应,因此,能够在页面视图流畅展示时,确保请求数据的完整性。It can be seen from the above technical solutions that the present application can accurately determine the log information recording the trigger operation of the trigger user through the determined trigger terminal and the trigger user, because all the target log information is stored in the target log information. Therefore, by analyzing the target log information, it can be accurately determined whether the trigger request is a high-frequency request, and by writing the trigger request into the request stack, the trigger can be avoided. The request is lost, thereby ensuring the integrity of the request data. By combining all element requests in the request stack, the generated target request contains multiple requests, and then multiple requests are sent to the preset server at one time. Process to avoid thread blocking. When it is determined that the trigger request belongs to a high-frequency request, the present application combines a plurality of the trigger requests into the target request, and then sends the combined target request to the preset server for processing, so as to avoid The multiple trigger requests repeatedly trigger the preset server, thereby improving the performance of the preset server, thereby improving the reflow efficiency of the response result, and improving the smoothness of the page view. In addition, due to the triggering All trigger requests generated by the user participate in the response, so the integrity of the requested data can be ensured when the page view is displayed smoothly.
附图说明Description of drawings
图1是本申请高频请求处理方法的较佳实施例的流程图。FIG. 1 is a flowchart of a preferred embodiment of the high-frequency request processing method of the present application.
图2是本申请确定触发终端及触发用户的一实施例的流程图。FIG. 2 is a flowchart of an embodiment of the present application for determining a trigger terminal and a trigger user.
图3是本申请确定所述触发请求所属的请求类型的一实施例的流程图。FIG. 3 is a flowchart of an embodiment of the present application for determining the request type to which the trigger request belongs.
图4是本申请创建请求堆栈的一实施例的流程图。FIG. 4 is a flowchart of an embodiment of the present application for creating a request stack.
图5是本申请高频请求处理装置的较佳实施例的功能模块图。FIG. 5 is a functional block diagram of a preferred embodiment of the high-frequency request processing device of the present application.
图6是本申请实现高频请求处理方法的较佳实施例的电子设备的结构示意图。FIG. 6 is a schematic structural diagram of an electronic device implementing a preferred embodiment of the high-frequency request processing method of the present application.
具体实施方式Detailed ways
为了使本申请的目的、技术方案和优点更加清楚,下面结合附图和具体实施例对本申请进行详细描述。In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be described in detail below with reference to the accompanying drawings and specific embodiments.
如图1所示,是本申请高频请求处理方法的较佳实施例的流程图。根据不同的需求,该 流程图中步骤的顺序可以改变,某些步骤可以省略。As shown in FIG. 1 , it is a flowchart of a preferred embodiment of the high-frequency request processing method of the present application. According to different requirements, the order of steps in this flowchart can be changed, and some steps can be omitted.
所述高频请求处理方法应用于一个或者多个电子设备中,所述电子设备是一种能够按照事先设定或存储的计算机可读指令,自动进行数值计算和/或信息处理的设备,其硬件包括但不限于微处理器、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程门阵列(Field-Programmable Gate Array,FPGA)、数字处理器(Digital Signal Processor,DSP)、嵌入式设备等。The high-frequency request processing method is applied to one or more electronic devices, and the electronic device is a device that can automatically perform numerical calculation and/or information processing according to pre-set or stored computer-readable instructions. Hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), programmable gate arrays (Field-Programmable Gate Arrays, FPGAs), digital processors (Digital Signal Processors, DSPs), embedded devices, etc. .
所述电子设备可以是任何一种可与用户进行人机交互的电子产品,例如,个人计算机、平板电脑、智能手机、个人数字助理(Personal Digital Assistant,PDA)、游戏机、交互式网络电视(Internet Protocol Television,IPTV)、智能穿戴式设备等。The electronic device can be any electronic product that can interact with the user, such as a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), a game console, an interactive network television ( Internet Protocol Television, IPTV), smart wearable devices, etc.
所述电子设备可以包括网络设备和/或用户设备。其中,所述网络设备包括,但不限于单个网络电子设备、多个网络电子设备组成的电子设备组或基于云计算(Cloud Computing)的由大量主机或网络电子设备构成的云。The electronic equipment may include network equipment and/or user equipment. Wherein, the network device includes, but is not limited to, a single network electronic device, an electronic device group composed of multiple network electronic devices, or a cloud composed of a large number of hosts or network electronic devices based on cloud computing (Cloud Computing).
所述电子设备所处的网络包括,但不限于:互联网、广域网、城域网、局域网、虚拟专用网络(Virtual Private Network,VPN)等。The network where the electronic device is located includes, but is not limited to, the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (Virtual Private Network, VPN), and the like.
S10,当接收到触发请求时,确定所述触发请求的触发终端及触发用户。S10, when a trigger request is received, determine a trigger terminal and a trigger user of the trigger request.
在本申请的至少一个实施例中,所述触发请求对应的场景可以是任意场景,例如,所述触发请求可以是显示用户拖拽元素的轨迹。进一步地,所述触发请求可以由任意用户触发生成。In at least one embodiment of the present application, the scene corresponding to the trigger request may be any scene, for example, the trigger request may be displaying a track of a user dragging an element. Further, the trigger request may be triggered and generated by any user.
所述触发终端是指所述触发请求的生成终端,所述触发终端可以是手机、电脑、平板等。The trigger terminal refers to the generation terminal of the trigger request, and the trigger terminal may be a mobile phone, a computer, a tablet, or the like.
所述触发用户是指触发所述触发请求生成的用户。The triggering user refers to a user who triggers the generation of the triggering request.
参见图2,图2是本申请确定触发终端及触发用户的一实施例的流程图。在本申请的至少一个实施例中,所述电子设备确定所述触发请求的触发终端及触发用户包括:Referring to FIG. 2, FIG. 2 is a flowchart of an embodiment of the present application for determining a trigger terminal and a trigger user. In at least one embodiment of the present application, determining, by the electronic device, a triggering terminal and a triggering user of the triggering request include:
S100,解析所述触发请求,得到所述触发请求携带的数据信息。S100, parse the trigger request to obtain data information carried by the trigger request.
其中,所述数据信息包括触发地址、用户识别码。Wherein, the data information includes a trigger address and a user identification code.
S101,从配置标签库中获取第一预设标签及第二预设标签,所述第一预设标签用于指示地址,所述第二预设标签用于指示用户。S101. Acquire a first preset tag and a second preset tag from a configuration tag library, where the first preset tag is used to indicate an address, and the second preset tag is used to indicate a user.
其中,所述配置标签库中存储多个预先定义好的标签。Wherein, a plurality of pre-defined tags are stored in the configuration tag library.
S102,从所述数据信息中获取与所述第一预设标签对应的信息作为触发地址,并从所述数据信息中获取与所述第二预设标签对应的信息作为用户识别码。S102: Acquire information corresponding to the first preset tag from the data information as a trigger address, and acquire information corresponding to the second preset tag from the data information as a user identification code.
S103,确定与所述触发地址对应的终端作为所述触发终端,并确定与所述用户识别码对应的用户作为所述触发用户。S103: Determine the terminal corresponding to the trigger address as the trigger terminal, and determine the user corresponding to the user identification code as the trigger user.
通过所述第一预设标签能够准确确定出所述触发地址,进而能够准确确定出所述触发终端,同时,通过所述第二预设标签能够准确确定出所述用户识别码,进而能够准确确定出所述触发用户。The triggering address and then the triggering terminal can be accurately determined through the first preset label. Meanwhile, the user identification code can be accurately determined through the second preset label, and then the user identification code can be accurately determined through the second preset label. The triggering user is determined.
S11,从所述触发终端中获取请求日志,并根据所述触发用户从所述请求日志中提取目标日志信息。S11: Acquire a request log from the triggering terminal, and extract target log information from the request log according to the triggering user.
在本申请的至少一个实施例中,所述请求日志是指在所述触发终端上记载的操作日志,所述请求日志记载所述触发终端上的所有操作。In at least one embodiment of the present application, the request log refers to an operation log recorded on the trigger terminal, and the request log records all operations on the trigger terminal.
所述目标日志信息是指所述触发用户在所述触发终端上的所有操作。The target log information refers to all operations of the triggering user on the triggering terminal.
在本申请的至少一个实施例中,所述电子设备从所述触发终端中获取请求日志,并根据所述触发用户从所述请求日志中提取目标日志信息包括:In at least one embodiment of the present application, the electronic device acquiring the request log from the triggering terminal, and extracting target log information from the request log according to the triggering user includes:
获取所述触发终端的日志存储路径;Obtain the log storage path of the trigger terminal;
从所述日志存储路径获取所述触发终端的所述请求日志;Obtain the request log of the trigger terminal from the log storage path;
从所述请求日志中选取与所述用户识别码对应的日志信息作为所述目标日志信息。The log information corresponding to the user identification code is selected from the request log as the target log information.
通过所述日志存储路径能够快速获取到所述请求日志,进而通过所述用户识别码能够准确确定出所述目标日志信息。The request log can be quickly acquired through the log storage path, and the target log information can be accurately determined through the user identification code.
S12,分析所述目标日志信息确定所述触发请求所属的请求类型,所述请求类型包括高频请求。S12: Analyze the target log information to determine a request type to which the trigger request belongs, where the request type includes a high-frequency request.
在本申请的至少一个实施例中,所述请求类型还包括低频请求。In at least one embodiment of the present application, the request type further includes a low frequency request.
参见图3,图3是本申请确定所述触发请求所属的请求类型的一实施例的流程图。在本申请的至少一个实施例中,所述电子设备分析所述目标日志信息确定所述触发请求所属的请求类型包括:Referring to FIG. 3, FIG. 3 is a flowchart of an embodiment of the present application for determining the request type to which the trigger request belongs. In at least one embodiment of the present application, the electronic device analyzing the target log information to determine the request type to which the trigger request belongs includes:
S120,获取所述目标日志信息中所有历史请求的响应时间,并从所述目标日志信息中获取所述触发请求的生成时间。S120: Acquire the response time of all historical requests in the target log information, and acquire the generation time of the trigger request from the target log information.
所述响应时间是指每个历史请求完成响应时的时间,所述生成时间是指所述触发请求被触发生成时的时间。The response time refers to the time when each historical request completes the response, and the generation time refers to the time when the trigger request is triggered to be generated.
S121,计算每个响应时间与所述生成时间的第一时间差,并将所述第一时间差小于第一预设值的响应时间确定为目标时间。S121: Calculate a first time difference between each response time and the generation time, and determine a response time when the first time difference is less than a first preset value as a target time.
S122,对所述目标时间及所述生成时间按照从小到大的顺序进行排序,得到时间队列。S122: Sort the target time and the generation time in ascending order to obtain a time queue.
S123,计算所述时间队列中任意相邻时间的第二时间差,并计算所述第二时间差小于第二预设值的数量,其中,所述第二预设值小于所述第一预设值。S123: Calculate a second time difference between any adjacent times in the time queue, and calculate the number of times that the second time difference is smaller than a second preset value, where the second preset value is smaller than the first preset value .
所述任意相邻时间是指在所述时间队列上的位置处于相邻的任意两个时间。The arbitrary adjacent times refers to any two times that are adjacent to the position on the time queue.
S124,当所述数量大于或者等于配置值时,确定所述触发请求所属的请求类型为所述高频请求。S124, when the number is greater than or equal to a configuration value, determine that the request type to which the trigger request belongs is the high-frequency request.
其中,所述配置值的取值可以根据应用场景自由配置,本申请对所述配置值的取值不作限制。The value of the configuration value may be freely configured according to the application scenario, and the present application does not limit the value of the configuration value.
S125,当所述数量小于所述配置值时,确定所述触发请求所属的请求类型为低频请求。S125, when the number is less than the configured value, determine that the request type to which the trigger request belongs is a low frequency request.
通过将每个响应时间与所述生成时间比较,能够剔除掉过早的历史请求,避免过早的历史请求影响所述请求类型的确定,通过所述时间队列中任意相邻时间的比较,以及任意相邻时间的时间差小于所述第二预设值的数量的确定,能够准确确定出所述触发请求所属的请求类型。By comparing each response time with the generation time, premature historical requests can be eliminated, preventing premature historical requests from affecting the determination of the request type, through the comparison of any adjacent time in the time queue, and any The determination of the number of times that the time difference between adjacent times is less than the second preset value can accurately determine the request type to which the trigger request belongs.
S13,当所述请求类型为所述高频请求时,根据所述目标日志信息创建请求堆栈,并将所述触发请求写入所述请求堆栈中。S13, when the request type is the high-frequency request, create a request stack according to the target log information, and write the trigger request into the request stack.
在本申请的至少一个实施例中,所述请求堆栈是由多个存储区构成的。In at least one embodiment of the present application, the request stack is composed of multiple storage areas.
参见图4,图4是本申请创建请求堆栈的一实施例的流程图。在本申请的至少一个实施例中,所述电子设备根据所述目标日志信息创建请求堆栈包括:Referring to FIG. 4, FIG. 4 is a flowchart of an embodiment of the present application for creating a request stack. In at least one embodiment of the present application, the electronic device creating a request stack according to the target log information includes:
S130,将所述第二时间差小于所述第二预设值的时间确定为分析时间,并确定所述分析时间中的最早时间及最晚时间。S130: Determine the time when the second time difference is smaller than the second preset value as the analysis time, and determine the earliest time and the latest time in the analysis time.
S131,计算所述最晚时间与所述最早时间的时间差作为时间间隔,并将所述时间间隔除以所述数量,得到请求访问频率。S131: Calculate the time difference between the latest time and the earliest time as a time interval, and divide the time interval by the number to obtain the requested access frequency.
所述请求访问频率是指响应时间处于所述最早时间至所述最晚时间的请求的访问频率。The requested access frequency refers to the access frequency of requests whose response time ranges from the earliest time to the latest time.
S132,从所述目标日志信息中获取所述所有历史请求的触发时间,并计算每个触发时间与每个响应时间的时间差作为回应时间。S132: Acquire trigger times of all historical requests from the target log information, and calculate a time difference between each trigger time and each response time as a response time.
S133,计算所述回应时间的时间总和,并计算所述所有历史请求的请求数量。S133: Calculate the time sum of the response time, and calculate the request quantity of all the historical requests.
S134,将所述时间总和除以所述请求数量,得到平均时间,并将所述请求访问频率乘以所述平均时间,得到存储区数量。S134: Divide the total time by the number of requests to obtain an average time, and multiply the request access frequency by the average time to obtain the number of storage areas.
S135,依据所述存储区数量创建所述请求堆栈。S135. Create the request stack according to the number of storage areas.
所述请求堆栈中的存储区的数量为所述存储区数量。The number of storage areas in the request stack is the number of storage areas.
通过所述分析时间的确定,以及任意相邻时间的时间差小于所述第二预设值的数量的确定,能够准确确定出所述触发用户的请求访问频率,进而根据历史请求确定出平均时间,从而以所述请求访问频率及所述平均时间确定出所述存储区数量,由于所述请求访问频率及所述平均时间都是通过历史请求确定出的,因此,上述实施方式确定出的所述存储区数量是以 实际应用场景为依据的,从而提高了本申请的实用性。Through the determination of the analysis time and the determination of the number of times that the time difference between any adjacent time is less than the second preset value, it is possible to accurately determine the request access frequency of the triggering user, and then determine the average time according to historical requests, Therefore, the number of storage areas is determined based on the requested access frequency and the average time. Since both the requested access frequency and the average time are determined through historical requests, the The number of storage areas is based on actual application scenarios, thereby improving the practicability of the present application.
在本申请的至少一个实施例中,所述电子设备将所述触发请求写入所述请求堆栈中包括:In at least one embodiment of the present application, the electronic device writing the trigger request into the request stack includes:
确定所述请求堆栈中堆栈指针所处的存储区位置;determining the location of the storage area where the stack pointer is located in the request stack;
将所述存储区位置的下一个空存储区确定为目标存储区;Determining the next empty storage area at the storage area position as the target storage area;
将所述触发请求写入所述目标存储区。Write the trigger request to the target storage area.
通过上述实施方式,由于所述目标存储区是指所述堆栈指针所处的下一个空存储区,因此,能够避免所述目标存储区中包含其他请求,从而确保写入所述目标存储区的所述触发请求的独立性。Through the above-mentioned implementation manner, since the target storage area refers to the next empty storage area where the stack pointer is located, it is possible to prevent the target storage area from including other requests, thereby ensuring that the target storage area can be written into the target storage area. Independence of the trigger request.
在本申请的至少一个实施例中,通过将所述触发请求写入所述请求堆栈中,能够避免所述触发请求的丢失,进而确保请求数据的完整性。In at least one embodiment of the present application, by writing the trigger request into the request stack, the loss of the trigger request can be avoided, thereby ensuring the integrity of the request data.
S14,当所述请求堆栈为满栈时,合并所述请求堆栈中所有元素请求,得到目标请求。S14, when the request stack is full, merge all element requests in the request stack to obtain a target request.
在本申请的至少一个实施例中,所述请求堆栈为满栈指示所述请求堆栈中不存在空的存储区。In at least one embodiment of the present application, the fact that the request stack is full indicates that there is no empty storage area in the request stack.
所述目标请求中携带有所述所有元素请求中的所有报文内容。The target request carries all the packet contents in the all element requests.
在本申请的至少一个实施例中,所述电子设备合并所述请求堆栈中所有元素请求,得到目标请求包括:In at least one embodiment of the present application, the electronic device combines all element requests in the request stack to obtain the target request including:
提取每个元素请求中的请求参数,并封装所述请求参数,得到方法体;Extract the request parameters in each element request, and encapsulate the request parameters to obtain the method body;
提取任一元素请求的报文头作为目标报文头;Extract the header of any element request as the target header;
封装所述方法体及所述目标报文头,得到所述目标请求。The method body and the target header are encapsulated to obtain the target request.
通过直接提取任一元素请求的报文头作为所述目标请求的目标报文头,能够提高所述目标请求的合并效率。By directly extracting the header of any element request as the target header of the target request, the merging efficiency of the target request can be improved.
在本申请的至少一个实施例中,通过合并所述请求堆栈中所有元素请求,使生成的所述目标请求中包含多个请求,进而将多个请求一次性发送至所述预设服务器进行处理,能够避免线程产生阻塞。In at least one embodiment of the present application, by combining all element requests in the request stack, the generated target request includes multiple requests, and then the multiple requests are sent to the preset server at one time for processing , to avoid thread blocking.
S15,发送所述目标请求至预设服务器进行处理,得到响应结果。S15: Send the target request to a preset server for processing, and obtain a response result.
需要强调的是,为进一步保证上述响应结果的私密和安全性,上述响应结果还可以存储于一区块链的节点中。It should be emphasized that, in order to further ensure the privacy and security of the above response results, the above response results can also be stored in a node of a blockchain.
在本申请的至少一个实施例中,所述预设服务器是指与所述目标请求的目的地址对应的服务器。In at least one embodiment of the present application, the preset server refers to a server corresponding to the destination address of the target request.
所述响应结果包括用户触发的多个请求的响应。The response results include responses to multiple requests triggered by the user.
在本申请的至少一个实施例中,在得到响应结果后,所述方法还包括:In at least one embodiment of the present application, after obtaining the response result, the method further includes:
获取每个元素请求的请求编号;Get the request number of each element request;
根据所述请求编号及所述响应结果生成提示信息;generating prompt information according to the request number and the response result;
采用对称加密算法加密所述提示信息,得到目标密文;Encrypt the prompt information with a symmetric encryption algorithm to obtain the target ciphertext;
将所述目标密文发送至所述触发终端。Send the target ciphertext to the trigger terminal.
通过每个元素请求的请求编号生成所述提示信息,便于所述触发用户掌握所述响应结果的响应对象,通过对称加密算法加密所述提示信息,不仅能够提高加密效率,还能够避免所述提示信息被篡改,提高了所述提示信息的安全性。The prompt information is generated based on the request number requested by each element, so that the triggering user can grasp the response object of the response result. Encrypting the prompt information through a symmetric encryption algorithm can not only improve the encryption efficiency, but also avoid the prompt. The information is tampered with, which improves the security of the prompt information.
由以上技术方案可以看出,本申请通过确定出的所述触发终端及所述触发用户,能够准确确定出记载所述触发用户的触发操作的日志信息,由于所述目标日志信息中存储了所述触发用户触发的所有请求,因此,通过分析所述目标日志信息能够准确确定出所述触发请求是否属于高频请求,通过将所述触发请求写入所述请求堆栈中,能够避免所述触发请求的丢失,进而确保请求数据的完整性,通过合并所述请求堆栈中所有元素请求,使生成的所述目标请求中包含多个请求,进而将多个请求一次性发送至所述预设服务器进行处理,能够避免线程产生阻塞。本申请在确定出所述触发请求属于高频请求时,将多个所述触发请求合并成所述目标请求,进而将合并成的所述目标请求发送至所述预设服务器中进行处理,避免多个所述 触发请求对所述预设服务器进行重复触发,从而提高了所述预设服务器的性能,进而提高所述响应结果的回流效率,提高页面视图的流畅性,此外,由于所述触发用户产生的所有触发请求均参与到响应,因此,能够在页面视图流畅展示时,确保请求数据的完整性。It can be seen from the above technical solutions that the present application can accurately determine the log information recording the trigger operation of the trigger user through the determined trigger terminal and the trigger user, because all the target log information is stored in the target log information. Therefore, by analyzing the target log information, it can be accurately determined whether the trigger request is a high-frequency request, and by writing the trigger request into the request stack, the trigger can be avoided. The request is lost, thereby ensuring the integrity of the request data. By combining all element requests in the request stack, the generated target request contains multiple requests, and then multiple requests are sent to the preset server at one time. Process to avoid thread blocking. When it is determined that the trigger request belongs to a high-frequency request, the present application combines a plurality of the trigger requests into the target request, and then sends the combined target request to the preset server for processing, so as to avoid The multiple trigger requests repeatedly trigger the preset server, thereby improving the performance of the preset server, thereby improving the reflow efficiency of the response results, and improving the smoothness of the page view. In addition, due to the triggering All trigger requests generated by the user participate in the response, so the integrity of the requested data can be ensured when the page view is displayed smoothly.
如图5所示,是本申请高频请求处理装置的较佳实施例的功能模块图。所述高频请求处理装置11包括确定单元110、提取单元111、创建单元112、合并单元113、发送单元114、获取单元115、生成单元116及加密单元117。本申请所称的模块/单元是指一种能够被处理器13所获取,并且能够完成固定功能的一系列计算机可读指令段,其存储在存储器12中。在本实施例中,关于各模块/单元的功能将在后续的实施例中详述。As shown in FIG. 5 , it is a functional block diagram of a preferred embodiment of the high-frequency request processing device of the present application. The high-frequency request processing device 11 includes a determining unit 110 , an extracting unit 111 , a creating unit 112 , a merging unit 113 , a sending unit 114 , an obtaining unit 115 , a generating unit 116 and an encryption unit 117 . The module/unit referred to in this application refers to a series of computer-readable instruction segments that can be acquired by the processor 13 and can perform fixed functions, and are stored in the memory 12 . In this embodiment, the functions of each module/unit will be described in detail in subsequent embodiments.
当接收到触发请求时,确定单元110确定所述触发请求的触发终端及触发用户。When receiving the trigger request, the determining unit 110 determines the trigger terminal and trigger user of the trigger request.
在本申请的至少一个实施例中,所述触发请求对应的场景可以是任意场景,例如,所述触发请求可以是显示用户拖拽元素的轨迹。进一步地,所述触发请求可以由任意用户触发生成。In at least one embodiment of the present application, the scene corresponding to the trigger request may be any scene, for example, the trigger request may be displaying a track of a user dragging an element. Further, the trigger request may be triggered and generated by any user.
所述触发终端是指所述触发请求的生成终端,所述触发终端可以是手机、电脑、平板等。The trigger terminal refers to the generation terminal of the trigger request, and the trigger terminal may be a mobile phone, a computer, a tablet, or the like.
所述触发用户是指触发所述触发请求生成的用户。The triggering user refers to a user who triggers the generation of the triggering request.
在本申请的至少一个实施例中,所述确定单元110确定所述触发请求的触发终端及触发用户包括:In at least one embodiment of the present application, the determining unit 110 determines the triggering terminal and the triggering user of the triggering request include:
解析所述触发请求,得到所述触发请求携带的数据信息。Parse the trigger request to obtain data information carried by the trigger request.
其中,所述数据信息包括触发地址、用户识别码。Wherein, the data information includes a trigger address and a user identification code.
从配置标签库中获取第一预设标签及第二预设标签,所述第一预设标签用于指示地址,所述第二预设标签用于指示用户。A first preset tag and a second preset tag are obtained from a configuration tag library, where the first preset tag is used to indicate an address, and the second preset tag is used to indicate a user.
其中,所述配置标签库中存储多个预先定义好的标签。Wherein, a plurality of pre-defined tags are stored in the configuration tag library.
从所述数据信息中获取与所述第一预设标签对应的信息作为触发地址,并从所述数据信息中获取与所述第二预设标签对应的信息作为用户识别码。The information corresponding to the first preset tag is acquired from the data information as a trigger address, and the information corresponding to the second preset tag is acquired from the data information as a user identification code.
确定与所述触发地址对应的终端作为所述触发终端,并确定与所述用户识别码对应的用户作为所述触发用户。A terminal corresponding to the trigger address is determined as the trigger terminal, and a user corresponding to the user identification code is determined as the trigger user.
通过所述第一预设标签能够准确确定出所述触发地址,进而能够准确确定出所述触发终端,同时,通过所述第二预设标签能够准确确定出所述用户识别码,进而能够准确确定出所述触发用户。The triggering address and then the triggering terminal can be accurately determined through the first preset label. Meanwhile, the user identification code can be accurately determined through the second preset label, and then the user identification code can be accurately determined through the second preset label. The triggering user is determined.
提取单元111从所述触发终端中获取请求日志,并根据所述触发用户从所述请求日志中提取目标日志信息。The extracting unit 111 acquires the request log from the trigger terminal, and extracts target log information from the request log according to the trigger user.
在本申请的至少一个实施例中,所述请求日志是指在所述触发终端上记载的操作日志,所述请求日志记载所述触发终端上的所有操作。In at least one embodiment of the present application, the request log refers to an operation log recorded on the trigger terminal, and the request log records all operations on the trigger terminal.
所述目标日志信息是指所述触发用户在所述触发终端上的所有操作。The target log information refers to all operations of the triggering user on the triggering terminal.
在本申请的至少一个实施例中,所述提取单元111从所述触发终端中获取请求日志,并根据所述触发用户从所述请求日志中提取目标日志信息包括:In at least one embodiment of the present application, the extracting unit 111 acquires the request log from the trigger terminal, and extracts target log information from the request log according to the trigger user, including:
获取所述触发终端的日志存储路径;Obtain the log storage path of the trigger terminal;
从所述日志存储路径获取所述触发终端的所述请求日志;Obtain the request log of the trigger terminal from the log storage path;
从所述请求日志中选取与所述用户识别码对应的日志信息作为所述目标日志信息。The log information corresponding to the user identification code is selected from the request log as the target log information.
通过所述日志存储路径能够快速获取到所述请求日志,进而通过所述用户识别码能够准确确定出所述目标日志信息。The request log can be quickly acquired through the log storage path, and the target log information can be accurately determined through the user identification code.
所述确定单元110分析所述目标日志信息确定所述触发请求所属的请求类型,所述请求类型包括高频请求。The determining unit 110 analyzes the target log information to determine a request type to which the trigger request belongs, where the request type includes a high-frequency request.
在本申请的至少一个实施例中,所述请求类型还包括低频请求。In at least one embodiment of the present application, the request type further includes a low frequency request.
在本申请的至少一个实施例中,所述确定单元110分析所述目标日志信息确定所述触发请求所属的请求类型包括:In at least one embodiment of the present application, the determining unit 110 analyzes the target log information to determine the request type to which the trigger request belongs:
获取所述目标日志信息中所有历史请求的响应时间,并从所述目标日志信息中获取所述 触发请求的生成时间。Acquire the response time of all historical requests in the target log information, and obtain the generation time of the trigger request from the target log information.
所述响应时间是指每个历史请求完成响应时的时间,所述生成时间是指所述触发请求被触发生成时的时间。The response time refers to the time when each historical request completes the response, and the generation time refers to the time when the trigger request is triggered to be generated.
计算每个响应时间与所述生成时间的第一时间差,并将所述第一时间差小于第一预设值的响应时间确定为目标时间。A first time difference between each response time and the generation time is calculated, and a response time when the first time difference is less than a first preset value is determined as a target time.
对所述目标时间及所述生成时间按照从小到大的顺序进行排序,得到时间队列。Sort the target time and the generation time in ascending order to obtain a time queue.
计算所述时间队列中任意相邻时间的第二时间差,并计算所述第二时间差小于第二预设值的数量,其中,所述第二预设值小于所述第一预设值。Calculate a second time difference between any adjacent times in the time queue, and calculate the number of times that the second time difference is smaller than a second preset value, where the second preset value is smaller than the first preset value.
所述任意相邻时间是指在所述时间队列上的位置处于相邻的任意两个时间。The arbitrary adjacent times refers to any two times that are adjacent to the position on the time queue.
当所述数量大于或者等于配置值时,确定所述触发请求所属的请求类型为所述高频请求。When the number is greater than or equal to the configuration value, it is determined that the request type to which the trigger request belongs is the high-frequency request.
其中,所述配置值的取值可以根据应用场景自由配置,本申请对所述配置值的取值不作限制。The value of the configuration value may be freely configured according to the application scenario, and the present application does not limit the value of the configuration value.
当所述数量小于所述配置值时,确定所述触发请求所属的请求类型为低频请求。When the number is less than the configured value, it is determined that the request type to which the trigger request belongs is a low frequency request.
通过将每个响应时间与所述生成时间比较,能够剔除掉过早的历史请求,避免过早的历史请求影响所述请求类型的确定,通过所述时间队列中任意相邻时间的比较,以及任意相邻时间的时间差小于所述第二预设值的数量的确定,能够准确确定出所述触发请求所属的请求类型。By comparing each response time with the generation time, premature historical requests can be eliminated, preventing premature historical requests from affecting the determination of the request type, through the comparison of any adjacent time in the time queue, and any The determination of the number of times that the time difference between adjacent times is less than the second preset value can accurately determine the request type to which the trigger request belongs.
当所述请求类型为所述高频请求时,创建单元112根据所述目标日志信息创建请求堆栈,并将所述触发请求写入所述请求堆栈中。When the request type is the high-frequency request, the creating unit 112 creates a request stack according to the target log information, and writes the trigger request into the request stack.
在本申请的至少一个实施例中,所述请求堆栈是由多个存储区构成的。In at least one embodiment of the present application, the request stack is composed of multiple storage areas.
在本申请的至少一个实施例中,所述创建单元112根据所述目标日志信息创建请求堆栈包括:In at least one embodiment of the present application, the creating unit 112 creating a request stack according to the target log information includes:
将所述第二时间差小于所述第二预设值的时间确定为分析时间,并确定所述分析时间中的最早时间及最晚时间。The time when the second time difference is smaller than the second preset value is determined as the analysis time, and the earliest time and the latest time in the analysis time are determined.
计算所述最晚时间与所述最早时间的时间差作为时间间隔,并将所述时间间隔除以所述数量,得到请求访问频率。The time difference between the latest time and the earliest time is calculated as a time interval, and the time interval is divided by the quantity to obtain the requested access frequency.
所述请求访问频率是指响应时间处于所述最早时间至所述最晚时间的请求的访问频率。The requested access frequency refers to the access frequency of requests whose response time ranges from the earliest time to the latest time.
从所述目标日志信息中获取所述所有历史请求的触发时间,并计算每个触发时间与每个响应时间的时间差作为回应时间。The trigger times of all historical requests are obtained from the target log information, and the time difference between each trigger time and each response time is calculated as the response time.
计算所述回应时间的时间总和,并计算所述所有历史请求的请求数量。Calculate the time sum of the response times, and calculate the number of requests for all historical requests.
将所述时间总和除以所述请求数量,得到平均时间,并将所述请求访问频率乘以所述平均时间,得到存储区数量。The average time is obtained by dividing the sum of the times by the number of requests, and the number of storage areas is obtained by multiplying the request access frequency by the average time.
依据所述存储区数量创建所述请求堆栈。The request stack is created according to the number of storage areas.
所述请求堆栈中的存储区的数量为所述存储区数量。The number of storage areas in the request stack is the number of storage areas.
通过所述分析时间的确定,以及任意相邻时间的时间差小于所述第二预设值的数量的确定,能够准确确定出所述触发用户的请求访问频率,进而根据历史请求确定出平均时间,从而以所述请求访问频率及所述平均时间确定出所述存储区数量,由于所述请求访问频率及所述平均时间都是通过历史请求确定出的,因此,上述实施方式确定出的所述存储区数量是以实际应用场景为依据的,从而提高了本申请的实用性。Through the determination of the analysis time and the determination of the number of times that the time difference between any adjacent time is less than the second preset value, it is possible to accurately determine the request access frequency of the triggering user, and then determine the average time according to historical requests, Therefore, the number of storage areas is determined based on the requested access frequency and the average time. Since both the requested access frequency and the average time are determined through historical requests, the The number of storage areas is based on actual application scenarios, thereby improving the practicability of the present application.
在本申请的至少一个实施例中,所述创建单元112将所述触发请求写入所述请求堆栈中包括:In at least one embodiment of the present application, the creation unit 112 writing the trigger request into the request stack includes:
确定所述请求堆栈中堆栈指针所处的存储区位置;determining the location of the storage area where the stack pointer is located in the request stack;
将所述存储区位置的下一个空存储区确定为目标存储区;Determining the next empty storage area at the storage area position as the target storage area;
将所述触发请求写入所述目标存储区。Write the trigger request to the target storage area.
通过上述实施方式,由于所述目标存储区是指所述堆栈指针所处的下一个空存储区,因此,能够避免所述目标存储区中包含其他请求,从而确保写入所述目标存储区的所述触发请 求的独立性。Through the above-mentioned implementation manner, since the target storage area refers to the next empty storage area where the stack pointer is located, it is possible to prevent the target storage area from including other requests, thereby ensuring that the target storage area can be written into the target storage area. Independence of the trigger request.
在本申请的至少一个实施例中,通过将所述触发请求写入所述请求堆栈中,能够避免所述触发请求的丢失,进而确保请求数据的完整性。In at least one embodiment of the present application, by writing the trigger request into the request stack, the loss of the trigger request can be avoided, thereby ensuring the integrity of the request data.
当所述请求堆栈为满栈时,合并单元113合并所述请求堆栈中所有元素请求,得到目标请求。When the request stack is full, the merging unit 113 merges all element requests in the request stack to obtain the target request.
在本申请的至少一个实施例中,所述请求堆栈为满栈指示所述请求堆栈中不存在空的存储区。In at least one embodiment of the present application, the fact that the request stack is full indicates that there is no empty storage area in the request stack.
所述目标请求中携带有所述所有元素请求中的所有报文内容。The target request carries all the packet contents in the all element requests.
在本申请的至少一个实施例中,所述合并单元113合并所述请求堆栈中所有元素请求,得到目标请求包括:In at least one embodiment of the present application, the merging unit 113 merges all element requests in the request stack to obtain the target request including:
提取每个元素请求中的请求参数,并封装所述请求参数,得到方法体;Extract the request parameters in each element request, and encapsulate the request parameters to obtain the method body;
提取任一元素请求的报文头作为目标报文头;Extract the header of any element request as the target header;
封装所述方法体及所述目标报文头,得到所述目标请求。The method body and the target header are encapsulated to obtain the target request.
通过直接提取任一元素请求的报文头作为所述目标请求的目标报文头,能够提高所述目标请求的合并效率。By directly extracting the header of any element request as the target header of the target request, the merging efficiency of the target request can be improved.
在本申请的至少一个实施例中,通过合并所述请求堆栈中所有元素请求,使生成的所述目标请求中包含多个请求,进而将多个请求一次性发送至所述预设服务器进行处理,能够避免线程产生阻塞。In at least one embodiment of the present application, by combining all element requests in the request stack, the generated target request includes multiple requests, and then the multiple requests are sent to the preset server at one time for processing , to avoid thread blocking.
发送单元114发送所述目标请求至预设服务器进行处理,得到响应结果。The sending unit 114 sends the target request to the preset server for processing, and obtains a response result.
需要强调的是,为进一步保证上述响应结果的私密和安全性,上述响应结果还可以存储于一区块链的节点中。It should be emphasized that, in order to further ensure the privacy and security of the above response results, the above response results can also be stored in a node of a blockchain.
在本申请的至少一个实施例中,所述预设服务器是指与所述目标请求的目的地址对应的服务器。In at least one embodiment of the present application, the preset server refers to a server corresponding to the destination address of the target request.
所述响应结果包括用户触发的多个请求的响应。The response results include responses to multiple requests triggered by the user.
在本申请的至少一个实施例中,在得到响应结果后,获取单元115获取每个元素请求的请求编号;In at least one embodiment of the present application, after obtaining the response result, the obtaining unit 115 obtains the request number of each element request;
生成单元116根据所述请求编号及所述响应结果生成提示信息;The generating unit 116 generates prompt information according to the request number and the response result;
加密单元117采用对称加密算法加密所述提示信息,得到目标密文;The encryption unit 117 uses a symmetric encryption algorithm to encrypt the prompt information to obtain the target ciphertext;
所述发送单元114将所述目标密文发送至所述触发终端。The sending unit 114 sends the target ciphertext to the trigger terminal.
通过每个元素请求的请求编号生成所述提示信息,便于所述触发用户掌握所述响应结果的响应对象,通过对称加密算法加密所述提示信息,不仅能够提高加密效率,还能够避免所述提示信息被篡改,提高了所述提示信息的安全性。The prompt information is generated based on the request number requested by each element, so that the triggering user can grasp the response object of the response result. Encrypting the prompt information through a symmetric encryption algorithm can not only improve the encryption efficiency, but also avoid the prompt. The information is tampered with, which improves the security of the prompt information.
由以上技术方案可以看出,本申请通过确定出的所述触发终端及所述触发用户,能够准确确定出记载所述触发用户的触发操作的日志信息,由于所述目标日志信息中存储了所述触发用户触发的所有请求,因此,通过分析所述目标日志信息能够准确确定出所述触发请求是否属于高频请求,通过将所述触发请求写入所述请求堆栈中,能够避免所述触发请求的丢失,进而确保请求数据的完整性,通过合并所述请求堆栈中所有元素请求,使生成的所述目标请求中包含多个请求,进而将多个请求一次性发送至所述预设服务器进行处理,能够避免线程产生阻塞。本申请在确定出所述触发请求属于高频请求时,将多个所述触发请求合并成所述目标请求,进而将合并成的所述目标请求发送至所述预设服务器中进行处理,避免多个所述触发请求对所述预设服务器进行重复触发,从而提高了所述预设服务器的性能,进而提高所述响应结果的回流效率,提高页面视图的流畅性,此外,由于所述触发用户产生的所有触发请求均参与到响应,因此,能够在页面视图流畅展示时,确保请求数据的完整性。It can be seen from the above technical solutions that the present application can accurately determine the log information recording the trigger operation of the trigger user through the determined trigger terminal and the trigger user, because all the target log information is stored in the target log information. Therefore, by analyzing the target log information, it can be accurately determined whether the trigger request is a high-frequency request, and by writing the trigger request into the request stack, the trigger can be avoided. The request is lost, thereby ensuring the integrity of the request data. By combining all element requests in the request stack, the generated target request contains multiple requests, and then multiple requests are sent to the preset server at one time. Process to avoid thread blocking. When it is determined that the trigger request belongs to a high-frequency request, the present application combines a plurality of the trigger requests into the target request, and then sends the combined target request to the preset server for processing, so as to avoid The multiple trigger requests repeatedly trigger the preset server, thereby improving the performance of the preset server, thereby improving the reflow efficiency of the response result, and improving the smoothness of the page view. In addition, due to the triggering All trigger requests generated by the user participate in the response, so the integrity of the requested data can be ensured when the page view is displayed smoothly.
如图6所示,是本申请实现高频请求处理方法的较佳实施例的电子设备的结构示意图。As shown in FIG. 6 , it is a schematic structural diagram of an electronic device implementing a preferred embodiment of the high-frequency request processing method of the present application.
在本申请的一个实施例中,所述电子设备1包括,但不限于,存储器12、处理器13,以及存储在所述存储器12中并可在所述处理器13上运行的计算机可读指令,例如高频请求处 理程序。In one embodiment of the present application, the electronic device 1 includes, but is not limited to, a memory 12 , a processor 13 , and computer-readable instructions stored in the memory 12 and executable on the processor 13 , such as high-frequency request handlers.
本领域技术人员可以理解,所述示意图仅仅是电子设备1的示例,并不构成对电子设备1的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述电子设备1还可以包括输入输出设备、网络接入设备、总线等。Those skilled in the art can understand that the schematic diagram is only an example of the electronic device 1, and does not constitute a limitation on the electronic device 1, and may include more or less components than the one shown, or combine some components, or different Components, for example, the electronic device 1 may also include input and output devices, network access devices, buses, and the like.
所述处理器13可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等,所述处理器13是所述电子设备1的运算核心和控制中心,利用各种接口和线路连接整个电子设备1的各个部分,及执行所述电子设备1的操作系统以及安装的各类应用程序、程序代码等。The processor 13 may be a central processing unit (Central Processing Unit, CPU), or other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (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, etc. The processor 13 is the computing core and control center of the electronic device 1, and uses various interfaces and lines to connect the entire electronic device. 1, and the operating system that executes the electronic device 1, as well as various installed applications, program codes, and the like.
示例性的,所述计算机可读指令可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器12中,并由所述处理器13执行,以完成本申请。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机可读指令段,该计算机可读指令段用于描述所述计算机可读指令在所述电子设备1中的执行过程。例如,所述计算机可读指令可以被分割成确定单元110、提取单元111、创建单元112、合并单元113、发送单元114、获取单元115、生成单元116及加密单元117。Exemplarily, the computer-readable instructions may be divided into one or more modules/units, and the one or more modules/units are stored in the memory 12 and executed by the processor 13 to Complete this application. The one or more modules/units may be a series of computer-readable instruction segments capable of accomplishing specific functions, and the computer-readable instruction segments are used to describe the execution process of the computer-readable instructions in the electronic device 1 . For example, the computer readable instructions may be divided into a determination unit 110 , an extraction unit 111 , a creation unit 112 , a merge unit 113 , a transmission unit 114 , an acquisition unit 115 , a generation unit 116 , and an encryption unit 117 .
所述存储器12可用于存储所述计算机可读指令和/或模块,所述处理器13通过运行或执行存储在所述存储器12内的计算机可读指令和/或模块,以及调用存储在存储器12内的数据,实现所述电子设备1的各种功能。所述存储器12可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据电子设备的使用所创建的数据等。存储器12可以包括非易失性和易失性存储器,例如:硬盘、内存、插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)、至少一个磁盘存储器件、闪存器件、或其他存储器件。The memory 12 can be used to store the computer-readable instructions and/or modules, and the processor 13 executes or executes the computer-readable instructions and/or modules stored in the memory 12 and invokes the computer-readable instructions and/or modules stored in the memory 12. The data in the electronic device 1 realizes various functions of the electronic device 1 . The memory 12 may mainly include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), and the like; the storage data area may Data and the like created according to the use of the electronic device are stored. The memory 12 may include non-volatile and volatile memory such as: hard disk, internal memory, plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, Flash memory card (Flash Card), at least one disk storage device, flash memory device, or other storage device.
所述存储器12可以是电子设备1的外部存储器和/或内部存储器。进一步地,所述存储器12可以是具有实物形式的存储器,如内存条、TF卡(Trans-flash Card)等等。The memory 12 may be an external memory and/or an internal memory of the electronic device 1 . Further, the storage 12 may be a storage in physical form, such as a memory stick, a TF card (Trans-flash Card) and the like.
所述电子设备1集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中,所述计算机可读存储介质可以是非易失性,也可以是易失性。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,也可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一计算机可读存储介质中,该计算机可读指令在被处理器执行时,可实现上述各个方法实施例的步骤。If the modules/units integrated in the electronic device 1 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium, and the computer-readable storage medium may be a non-volatile storage medium. Volatile, can also be volatile. Based on this understanding, the present application can implement all or part of the processes in the methods of the above embodiments, and can also be completed by instructing relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. The computer-readable instructions, when executed by the processor, can implement the steps of the above-mentioned method embodiments.
其中,所述计算机可读指令包括计算机可读指令代码,所述计算机可读指令代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机可读指令代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)。Wherein, the computer-readable instructions include computer-readable instruction codes, and the computer-readable instruction codes may be in source code form, object code form, executable file, or some intermediate form, and the like. The computer-readable medium may include: any entity or device capable of carrying the computer-readable instruction code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM, Read-Only). Memory), random access memory (RAM, Random Access Memory).
本申请所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。The blockchain referred to in this application is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain, essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information to verify its Validity of information (anti-counterfeiting) and generation of the next block. The blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
结合图1,所述电子设备1中的所述存储器12存储计算机可读指令实现一种高频请求处理方法,所述处理器13可执行所述计算机可读指令从而实现:1 , the memory 12 in the electronic device 1 stores computer-readable instructions to implement a high-frequency request processing method, and the processor 13 can execute the computer-readable instructions to implement:
当接收到触发请求时,确定所述触发请求的触发终端及触发用户;When receiving the trigger request, determine the trigger terminal and trigger user of the trigger request;
从所述触发终端中获取请求日志,并根据所述触发用户从所述请求日志中提取目标日志信息;Obtain a request log from the trigger terminal, and extract target log information from the request log according to the trigger user;
分析所述目标日志信息确定所述触发请求所属的请求类型,所述请求类型包括高频请求;Analyze the target log information to determine the request type to which the trigger request belongs, where the request type includes high-frequency requests;
当所述请求类型为所述高频请求时,根据所述目标日志信息创建请求堆栈,并将所述触发请求写入所述请求堆栈中;When the request type is the high-frequency request, create a request stack according to the target log information, and write the trigger request into the request stack;
当所述请求堆栈为满栈时,合并所述请求堆栈中所有元素请求,得到目标请求;When the request stack is full, merge all element requests in the request stack to obtain the target request;
发送所述目标请求至预设服务器进行处理,得到响应结果。The target request is sent to the preset server for processing, and a response result is obtained.
具体地,所述处理器13对上述计算机可读指令的具体实现方法可参考图1对应实施例中相关步骤的描述,在此不赘述。Specifically, for the specific implementation method of the computer-readable instruction by the processor 13, reference may be made to the description of the relevant steps in the embodiment corresponding to FIG. 1 , which is not repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。In the several embodiments provided in this application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are only illustrative. For example, the division of the modules is only a logical function division, and there may be other division manners in actual implementation.
所述计算机可读存储介质上存储有计算机可读指令,其中,所述计算机可读指令被处理器13执行时用以实现以下步骤:The computer-readable storage medium stores computer-readable instructions, wherein the computer-readable instructions are used to implement the following steps when executed by the processor 13:
当接收到触发请求时,确定所述触发请求的触发终端及触发用户;When receiving the trigger request, determine the trigger terminal and trigger user of the trigger request;
从所述触发终端中获取请求日志,并根据所述触发用户从所述请求日志中提取目标日志信息;Obtain a request log from the trigger terminal, and extract target log information from the request log according to the trigger user;
分析所述目标日志信息确定所述触发请求所属的请求类型,所述请求类型包括高频请求;Analyze the target log information to determine the request type to which the trigger request belongs, where the request type includes high-frequency requests;
当所述请求类型为所述高频请求时,根据所述目标日志信息创建请求堆栈,并将所述触发请求写入所述请求堆栈中;When the request type is the high-frequency request, create a request stack according to the target log information, and write the trigger request into the request stack;
当所述请求堆栈为满栈时,合并所述请求堆栈中所有元素请求,得到目标请求;When the request stack is full, merge all element requests in the request stack to obtain the target request;
发送所述目标请求至预设服务器进行处理,得到响应结果。The target request is sent to the preset server for processing, and a response result is obtained.
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。The modules described as separate components may or may not be physically separated, and components shown as modules 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 modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
另外,在本申请各个实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。In addition, each functional module 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 can be implemented in the form of hardware, or can be implemented in the form of hardware plus software function modules.
因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本申请的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本申请内。不应将权利要求中的任何附关联图标记视为限制所涉及的权利要求。Accordingly, the embodiments are to be regarded in all respects as illustrative and not restrictive, and the scope of the application is to be defined by the appended claims rather than the foregoing description, which is therefore intended to fall within the scope of the claims. All changes within the meaning and scope of the equivalents of , are included in this application. Any reference signs in the claims shall not be construed as limiting the involved claim.
此外,显然“包括”一词不排除其他单元或步骤,单数不排除复数。所述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第一、第二等词语用来表示名称,而并不表示任何特定的顺序。Furthermore, it is clear that the word "comprising" does not exclude other units or steps and the singular does not exclude the plural. The multiple units or devices described may also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to denote names and do not denote any particular order.
最后应说明的是,以上实施例仅用以说明本申请的技术方案而非限制,尽管参照较佳实施例对本申请进行了详细说明,本领域的普通技术人员应当理解,可以对本申请的技术方案进行修改或等同替换,而不脱离本申请技术方案的精神和范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application rather than limitations. Although the present application has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present application can be Modifications or equivalent substitutions can be made without departing from the spirit and scope of the technical solutions of the present application.

Claims (20)

  1. 一种高频请求处理方法,其中,所述高频请求处理方法包括:A high-frequency request processing method, wherein the high-frequency request processing method includes:
    当接收到触发请求时,确定所述触发请求的触发终端及触发用户;When receiving the trigger request, determine the trigger terminal and trigger user of the trigger request;
    从所述触发终端中获取请求日志,并根据所述触发用户从所述请求日志中提取目标日志信息;Obtain a request log from the trigger terminal, and extract target log information from the request log according to the trigger user;
    分析所述目标日志信息确定所述触发请求所属的请求类型,所述请求类型包括高频请求;Analyze the target log information to determine the request type to which the trigger request belongs, where the request type includes high-frequency requests;
    当所述请求类型为所述高频请求时,根据所述目标日志信息创建请求堆栈,并将所述触发请求写入所述请求堆栈中;When the request type is the high-frequency request, create a request stack according to the target log information, and write the trigger request into the request stack;
    当所述请求堆栈为满栈时,合并所述请求堆栈中所有元素请求,得到目标请求;When the request stack is full, merge all element requests in the request stack to obtain the target request;
    发送所述目标请求至预设服务器进行处理,得到响应结果。The target request is sent to the preset server for processing, and a response result is obtained.
  2. 根据权利要求1所述的高频请求处理方法,其中,所述确定所述触发请求的触发终端及触发用户包括:The high-frequency request processing method according to claim 1, wherein the determining the triggering terminal and triggering user of the triggering request comprises:
    解析所述触发请求,得到所述触发请求携带的数据信息;Parsing the trigger request to obtain data information carried by the trigger request;
    从配置标签库中获取第一预设标签及第二预设标签,所述第一预设标签用于指示地址,所述第二预设标签用于指示用户;Obtain a first preset tag and a second preset tag from a configuration tag library, where the first preset tag is used to indicate an address, and the second preset tag is used to indicate a user;
    从所述数据信息中获取与所述第一预设标签对应的信息作为触发地址,并从所述数据信息中获取与所述第二预设标签对应的信息作为用户识别码;Obtain information corresponding to the first preset tag from the data information as a trigger address, and obtain information corresponding to the second preset tag from the data information as a user identification code;
    确定与所述触发地址对应的终端作为所述触发终端,并确定与所述用户识别码对应的用户作为所述触发用户。A terminal corresponding to the trigger address is determined as the trigger terminal, and a user corresponding to the user identification code is determined as the trigger user.
  3. 根据权利要求2所述的高频请求处理方法,其中,所述从所述触发终端中获取请求日志,并根据所述触发用户从所述请求日志中提取目标日志信息包括:The high-frequency request processing method according to claim 2, wherein the obtaining the request log from the triggering terminal, and extracting target log information from the request log according to the triggering user comprises:
    获取所述触发终端的日志存储路径;Obtain the log storage path of the trigger terminal;
    从所述日志存储路径获取所述触发终端的所述请求日志;Obtain the request log of the trigger terminal from the log storage path;
    从所述请求日志中选取与所述用户识别码对应的日志信息作为所述目标日志信息。The log information corresponding to the user identification code is selected from the request log as the target log information.
  4. 根据权利要求1所述的高频请求处理方法,其中,所述分析所述目标日志信息确定所述触发请求所属的请求类型包括:The high-frequency request processing method according to claim 1, wherein the analyzing the target log information to determine the request type to which the trigger request belongs comprises:
    获取所述目标日志信息中所有历史请求的响应时间,并从所述目标日志信息中获取所述触发请求的生成时间;Obtain the response time of all historical requests in the target log information, and obtain the generation time of the trigger request from the target log information;
    计算每个响应时间与所述生成时间的第一时间差,并将所述第一时间差小于第一预设值的响应时间确定为目标时间;Calculate the first time difference between each response time and the generation time, and determine the response time when the first time difference is less than the first preset value as the target time;
    对所述目标时间及所述生成时间按照从小到大的顺序进行排序,得到时间队列;Sorting the target time and the generation time in ascending order to obtain a time queue;
    计算所述时间队列中任意相邻时间的第二时间差,并计算所述第二时间差小于第二预设值的数量,其中,所述第二预设值小于所述第一预设值;Calculate the second time difference of any adjacent time in the time queue, and calculate the number of the second time difference less than a second preset value, wherein the second preset value is less than the first preset value;
    当所述数量大于或者等于配置值时,确定所述触发请求所属的请求类型为所述高频请求;或者When the number is greater than or equal to the configuration value, determine that the request type to which the trigger request belongs is the high-frequency request; or
    当所述数量小于所述配置值时,确定所述触发请求所属的请求类型为低频请求。When the number is less than the configured value, it is determined that the request type to which the trigger request belongs is a low frequency request.
  5. 根据权利要求4所述的高频请求处理方法,其中,所述根据所述目标日志信息创建请求堆栈包括:The high-frequency request processing method according to claim 4, wherein the creating a request stack according to the target log information comprises:
    将所述第二时间差小于所述第二预设值的时间确定为分析时间,并确定所述分析时间中的最早时间及最晚时间;determining the time when the second time difference is less than the second preset value as the analysis time, and determining the earliest time and the latest time in the analysis time;
    计算所述最晚时间与所述最早时间的时间差作为时间间隔,并将所述时间间隔除以所述数量,得到请求访问频率;Calculate the time difference between the latest time and the earliest time as a time interval, and divide the time interval by the number to obtain the requested access frequency;
    从所述目标日志信息中获取所述所有历史请求的触发时间,并计算每个触发时间与 每个响应时间的时间差作为回应时间;Obtain the trigger times of all historical requests from the target log information, and calculate the time difference between each trigger time and each response time as the response time;
    计算所述回应时间的时间总和,并计算所述所有历史请求的请求数量;Calculate the time sum of the response times, and calculate the number of requests for all historical requests;
    将所述时间总和除以所述请求数量,得到平均时间,并将所述请求访问频率乘以所述平均时间,得到存储区数量;Divide the sum of the time by the number of requests to obtain the average time, and multiply the request access frequency by the average time to obtain the number of storage areas;
    依据所述存储区数量创建所述请求堆栈。The request stack is created according to the number of storage areas.
  6. 根据权利要求1所述的高频请求处理方法,其中,所述将所述触发请求写入所述请求堆栈中包括:The high-frequency request processing method according to claim 1, wherein the writing the trigger request into the request stack comprises:
    确定所述请求堆栈中堆栈指针所处的存储区位置;determining the location of the storage area where the stack pointer is located in the request stack;
    将所述存储区位置的下一个空存储区确定为目标存储区;Determining the next empty storage area at the storage area position as the target storage area;
    将所述触发请求写入所述目标存储区。Write the trigger request to the target storage area.
  7. 根据权利要求1所述的高频请求处理方法,其中,所述合并所述请求堆栈中所有元素请求,得到目标请求包括:The high-frequency request processing method according to claim 1, wherein the combining all element requests in the request stack to obtain the target request comprises:
    提取每个元素请求中的请求参数,并封装所述请求参数,得到方法体;Extract the request parameters in each element request, and encapsulate the request parameters to obtain the method body;
    提取任一元素请求的报文头作为目标报文头;Extract the header of any element request as the target header;
    封装所述方法体及所述目标报文头,得到所述目标请求。The method body and the target header are encapsulated to obtain the target request.
  8. 一种高频请求处理装置,其中,所述高频请求处理装置包括:A high-frequency request processing device, wherein the high-frequency request processing device includes:
    确定单元,用于当接收到触发请求时,确定所述触发请求的触发终端及触发用户;a determining unit, configured to determine a triggering terminal and a triggering user of the triggering request when a triggering request is received;
    提取单元,用于从所述触发终端中获取请求日志,并根据所述触发用户从所述请求日志中提取目标日志信息;an extraction unit, configured to obtain a request log from the trigger terminal, and extract target log information from the request log according to the trigger user;
    所述确定单元,还用于分析所述目标日志信息确定所述触发请求所属的请求类型,所述请求类型包括高频请求;The determining unit is further configured to analyze the target log information to determine the request type to which the trigger request belongs, and the request type includes a high-frequency request;
    创建单元,用于当所述请求类型为所述高频请求时,根据所述目标日志信息创建请求堆栈,并将所述触发请求写入所述请求堆栈中;A creation unit, configured to create a request stack according to the target log information when the request type is the high-frequency request, and write the trigger request into the request stack;
    合并单元,用于当所述请求堆栈为满栈时,合并所述请求堆栈中所有元素请求,得到目标请求;a merging unit for merging all element requests in the request stack to obtain a target request when the request stack is full;
    发送单元,用于发送所述目标请求至预设服务器进行处理,得到响应结果。A sending unit, configured to send the target request to a preset server for processing, and obtain a response result.
  9. 一种电子设备,其中,所述电子设备包括处理器和存储器,所述处理器用于执行存储器中存储的至少一个计算机可读指令以实现以下步骤:An electronic device, wherein the electronic device includes a processor and a memory, and the processor is configured to execute at least one computer-readable instruction stored in the memory to implement the following steps:
    当接收到触发请求时,确定所述触发请求的触发终端及触发用户;When receiving the trigger request, determine the trigger terminal and trigger user of the trigger request;
    从所述触发终端中获取请求日志,并根据所述触发用户从所述请求日志中提取目标日志信息;Obtain a request log from the trigger terminal, and extract target log information from the request log according to the trigger user;
    分析所述目标日志信息确定所述触发请求所属的请求类型,所述请求类型包括高频请求;Analyze the target log information to determine the request type to which the trigger request belongs, where the request type includes high-frequency requests;
    当所述请求类型为所述高频请求时,根据所述目标日志信息创建请求堆栈,并将所述触发请求写入所述请求堆栈中;When the request type is the high-frequency request, create a request stack according to the target log information, and write the trigger request into the request stack;
    当所述请求堆栈为满栈时,合并所述请求堆栈中所有元素请求,得到目标请求;When the request stack is full, merge all element requests in the request stack to obtain the target request;
    发送所述目标请求至预设服务器进行处理,得到响应结果。The target request is sent to the preset server for processing, and a response result is obtained.
  10. 根据权利要求9所述的电子设备,其中,在所述确定所述触发请求的触发终端及触发用户时,所述处理器执行所述至少一个计算机可读指令以实现以下步骤:The electronic device according to claim 9, wherein, when the trigger terminal and trigger user of the trigger request are determined, the processor executes the at least one computer-readable instruction to implement the following steps:
    解析所述触发请求,得到所述触发请求携带的数据信息;Parsing the trigger request to obtain data information carried by the trigger request;
    从配置标签库中获取第一预设标签及第二预设标签,所述第一预设标签用于指示地址,所述第二预设标签用于指示用户;Obtain a first preset tag and a second preset tag from a configuration tag library, where the first preset tag is used to indicate an address, and the second preset tag is used to indicate a user;
    从所述数据信息中获取与所述第一预设标签对应的信息作为触发地址,并从所述数据信息中获取与所述第二预设标签对应的信息作为用户识别码;Obtain information corresponding to the first preset tag from the data information as a trigger address, and obtain information corresponding to the second preset tag from the data information as a user identification code;
    确定与所述触发地址对应的终端作为所述触发终端,并确定与所述用户识别码对应的用户作为所述触发用户。A terminal corresponding to the trigger address is determined as the trigger terminal, and a user corresponding to the user identification code is determined as the trigger user.
  11. 根据权利要求10所述的电子设备,其中,在所述从所述触发终端中获取请求日志,并根据所述触发用户从所述请求日志中提取目标日志信息时,所述处理器执行所述至少一个计算机可读指令以实现以下步骤:The electronic device according to claim 10, wherein when the request log is obtained from the trigger terminal, and the target log information is extracted from the request log according to the trigger user, the processor executes the At least one computer readable instruction to implement the following steps:
    获取所述触发终端的日志存储路径;Obtain the log storage path of the trigger terminal;
    从所述日志存储路径获取所述触发终端的所述请求日志;Obtain the request log of the trigger terminal from the log storage path;
    从所述请求日志中选取与所述用户识别码对应的日志信息作为所述目标日志信息。The log information corresponding to the user identification code is selected from the request log as the target log information.
  12. 根据权利要求9所述的电子设备,其中,在所述分析所述目标日志信息确定所述触发请求所属的请求类型时,所述处理器执行所述至少一个计算机可读指令以实现以下步骤:The electronic device according to claim 9, wherein, when the analysis of the target log information determines the request type to which the trigger request belongs, the processor executes the at least one computer-readable instruction to implement the following steps:
    获取所述目标日志信息中所有历史请求的响应时间,并从所述目标日志信息中获取所述触发请求的生成时间;Obtain the response time of all historical requests in the target log information, and obtain the generation time of the trigger request from the target log information;
    计算每个响应时间与所述生成时间的第一时间差,并将所述第一时间差小于第一预设值的响应时间确定为目标时间;Calculate the first time difference between each response time and the generation time, and determine the response time when the first time difference is less than the first preset value as the target time;
    对所述目标时间及所述生成时间按照从小到大的顺序进行排序,得到时间队列;Sorting the target time and the generation time in ascending order to obtain a time queue;
    计算所述时间队列中任意相邻时间的第二时间差,并计算所述第二时间差小于第二预设值的数量,其中,所述第二预设值小于所述第一预设值;Calculate the second time difference of any adjacent time in the time queue, and calculate the number of the second time difference less than a second preset value, wherein the second preset value is less than the first preset value;
    当所述数量大于或者等于配置值时,确定所述触发请求所属的请求类型为所述高频请求;或者When the number is greater than or equal to the configuration value, determine that the request type to which the trigger request belongs is the high-frequency request; or
    当所述数量小于所述配置值时,确定所述触发请求所属的请求类型为低频请求。When the number is less than the configured value, it is determined that the request type to which the trigger request belongs is a low frequency request.
  13. 根据权利要求12所述的电子设备,其中,在所述根据所述目标日志信息创建请求堆栈时,所述处理器执行所述至少一个计算机可读指令以实现以下步骤:The electronic device of claim 12, wherein, when the request stack is created according to the target log information, the processor executes the at least one computer-readable instruction to implement the following steps:
    将所述第二时间差小于所述第二预设值的时间确定为分析时间,并确定所述分析时间中的最早时间及最晚时间;determining the time when the second time difference is less than the second preset value as the analysis time, and determining the earliest time and the latest time in the analysis time;
    计算所述最晚时间与所述最早时间的时间差作为时间间隔,并将所述时间间隔除以所述数量,得到请求访问频率;Calculate the time difference between the latest time and the earliest time as a time interval, and divide the time interval by the number to obtain the requested access frequency;
    从所述目标日志信息中获取所述所有历史请求的触发时间,并计算每个触发时间与每个响应时间的时间差作为回应时间;Obtain the trigger times of all historical requests from the target log information, and calculate the time difference between each trigger time and each response time as the response time;
    计算所述回应时间的时间总和,并计算所述所有历史请求的请求数量;Calculate the time sum of the response times, and calculate the number of requests for all historical requests;
    将所述时间总和除以所述请求数量,得到平均时间,并将所述请求访问频率乘以所述平均时间,得到存储区数量;Divide the sum of the time by the number of requests to obtain the average time, and multiply the request access frequency by the average time to obtain the number of storage areas;
    依据所述存储区数量创建所述请求堆栈。The request stack is created according to the number of storage areas.
  14. 根据权利要求9所述的电子设备,其中,在所述将所述触发请求写入所述请求堆栈中时,所述处理器执行所述至少一个计算机可读指令以实现以下步骤:9. The electronic device of claim 9, wherein, upon writing the trigger request into the request stack, the processor executes the at least one computer-readable instruction to:
    确定所述请求堆栈中堆栈指针所处的存储区位置;determining the location of the storage area where the stack pointer is located in the request stack;
    将所述存储区位置的下一个空存储区确定为目标存储区;Determining the next empty storage area at the storage area position as the target storage area;
    将所述触发请求写入所述目标存储区。Write the trigger request to the target storage area.
  15. 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有至少一个计算机可读指令,所述至少一个计算机可读指令被处理器执行时实现以下步骤:A computer-readable storage medium, wherein the computer-readable storage medium stores at least one computer-readable instruction, and the at least one computer-readable instruction implements the following steps when executed by a processor:
    当接收到触发请求时,确定所述触发请求的触发终端及触发用户;When receiving the trigger request, determine the trigger terminal and trigger user of the trigger request;
    从所述触发终端中获取请求日志,并根据所述触发用户从所述请求日志中提取目标日志信息;Obtain a request log from the trigger terminal, and extract target log information from the request log according to the trigger user;
    分析所述目标日志信息确定所述触发请求所属的请求类型,所述请求类型包括高频请求;Analyze the target log information to determine the request type to which the trigger request belongs, where the request type includes high-frequency requests;
    当所述请求类型为所述高频请求时,根据所述目标日志信息创建请求堆栈,并将所述触发请求写入所述请求堆栈中;When the request type is the high-frequency request, create a request stack according to the target log information, and write the trigger request into the request stack;
    当所述请求堆栈为满栈时,合并所述请求堆栈中所有元素请求,得到目标请求;When the request stack is full, merge all element requests in the request stack to obtain the target request;
    发送所述目标请求至预设服务器进行处理,得到响应结果。The target request is sent to the preset server for processing, and a response result is obtained.
  16. 根据权利要求15所述的存储介质,其中,在所述确定所述触发请求的触发终端及触发用户时,所述至少一个计算机可读指令被处理器执行以实现以下步骤:The storage medium according to claim 15, wherein, when the triggering terminal and triggering user of the triggering request are determined, the at least one computer-readable instruction is executed by a processor to implement the following steps:
    解析所述触发请求,得到所述触发请求携带的数据信息;Parsing the trigger request to obtain data information carried by the trigger request;
    从配置标签库中获取第一预设标签及第二预设标签,所述第一预设标签用于指示地址,所述第二预设标签用于指示用户;Obtain a first preset tag and a second preset tag from a configuration tag library, where the first preset tag is used to indicate an address, and the second preset tag is used to indicate a user;
    从所述数据信息中获取与所述第一预设标签对应的信息作为触发地址,并从所述数据信息中获取与所述第二预设标签对应的信息作为用户识别码;Obtain information corresponding to the first preset tag from the data information as a trigger address, and obtain information corresponding to the second preset tag from the data information as a user identification code;
    确定与所述触发地址对应的终端作为所述触发终端,并确定与所述用户识别码对应的用户作为所述触发用户。A terminal corresponding to the trigger address is determined as the trigger terminal, and a user corresponding to the user identification code is determined as the trigger user.
  17. 根据权利要求16所述的存储介质,其中,在所述从所述触发终端中获取请求日志,并根据所述触发用户从所述请求日志中提取目标日志信息时,所述至少一个计算机可读指令被处理器执行以实现以下步骤:The storage medium according to claim 16, wherein when the request log is obtained from the trigger terminal, and the target log information is extracted from the request log according to the trigger user, the at least one computer is readable The instructions are executed by the processor to implement the following steps:
    获取所述触发终端的日志存储路径;Obtain the log storage path of the trigger terminal;
    从所述日志存储路径获取所述触发终端的所述请求日志;Obtain the request log of the trigger terminal from the log storage path;
    从所述请求日志中选取与所述用户识别码对应的日志信息作为所述目标日志信息。The log information corresponding to the user identification code is selected from the request log as the target log information.
  18. 根据权利要求15所述的存储介质,其中,在所述分析所述目标日志信息确定所述触发请求所属的请求类型时,所述至少一个计算机可读指令被处理器执行以实现以下步骤:The storage medium of claim 15, wherein, when the analyzing the target log information determines the request type to which the trigger request belongs, the at least one computer-readable instruction is executed by the processor to implement the following steps:
    获取所述目标日志信息中所有历史请求的响应时间,并从所述目标日志信息中获取所述触发请求的生成时间;Obtain the response time of all historical requests in the target log information, and obtain the generation time of the trigger request from the target log information;
    计算每个响应时间与所述生成时间的第一时间差,并将所述第一时间差小于第一预设值的响应时间确定为目标时间;Calculate the first time difference between each response time and the generation time, and determine the response time when the first time difference is less than the first preset value as the target time;
    对所述目标时间及所述生成时间按照从小到大的顺序进行排序,得到时间队列;Sorting the target time and the generation time in ascending order to obtain a time queue;
    计算所述时间队列中任意相邻时间的第二时间差,并计算所述第二时间差小于第二预设值的数量,其中,所述第二预设值小于所述第一预设值;Calculate the second time difference of any adjacent time in the time queue, and calculate the number of the second time difference less than a second preset value, wherein the second preset value is less than the first preset value;
    当所述数量大于或者等于配置值时,确定所述触发请求所属的请求类型为所述高频请求;或者When the number is greater than or equal to the configuration value, determine that the request type to which the trigger request belongs is the high-frequency request; or
    当所述数量小于所述配置值时,确定所述触发请求所属的请求类型为低频请求。When the number is less than the configured value, it is determined that the request type to which the trigger request belongs is a low frequency request.
  19. 根据权利要求18所述的存储介质,其中,在所述根据所述目标日志信息创建请求堆栈时,所述至少一个计算机可读指令被处理器执行时以实现以下步骤:The storage medium of claim 18, wherein, when the request stack is created according to the target log information, the at least one computer-readable instruction is executed by the processor to implement the following steps:
    将所述第二时间差小于所述第二预设值的时间确定为分析时间,并确定所述分析时间中的最早时间及最晚时间;determining the time when the second time difference is less than the second preset value as the analysis time, and determining the earliest time and the latest time in the analysis time;
    计算所述最晚时间与所述最早时间的时间差作为时间间隔,并将所述时间间隔除以所述数量,得到请求访问频率;Calculate the time difference between the latest time and the earliest time as a time interval, and divide the time interval by the number to obtain the requested access frequency;
    从所述目标日志信息中获取所述所有历史请求的触发时间,并计算每个触发时间与每个响应时间的时间差作为回应时间;Obtain the trigger times of all historical requests from the target log information, and calculate the time difference between each trigger time and each response time as the response time;
    计算所述回应时间的时间总和,并计算所述所有历史请求的请求数量;Calculate the time sum of the response times, and calculate the number of requests for all historical requests;
    将所述时间总和除以所述请求数量,得到平均时间,并将所述请求访问频率乘以所述平均时间,得到存储区数量;Divide the sum of the time by the number of requests to obtain the average time, and multiply the request access frequency by the average time to obtain the number of storage areas;
    依据所述存储区数量创建所述请求堆栈。The request stack is created according to the number of storage areas.
  20. 根据权利要求15所述的存储介质,其中,在所述将所述触发请求写入所述请求堆栈中时,所述至少一个计算机可读指令被处理器执行以实现以下步骤:16. The storage medium of claim 15, wherein, upon writing the trigger request into the request stack, the at least one computer-readable instruction is executed by a processor to:
    确定所述请求堆栈中堆栈指针所处的存储区位置;determining the location of the storage area where the stack pointer is located in the request stack;
    将所述存储区位置的下一个空存储区确定为目标存储区;Determining the next empty storage area at the storage area position as the target storage area;
    将所述触发请求写入所述目标存储区。Write the trigger request to the target storage area.
PCT/CN2021/090354 2020-11-17 2021-04-27 High-frequency request processing method and apparatus, electronic device and storage medium WO2022105116A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011290509.6 2020-11-17
CN202011290509.6A CN112416583B (en) 2020-11-17 High-frequency request processing method, high-frequency request processing device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2022105116A1 true WO2022105116A1 (en) 2022-05-27

Family

ID=74831639

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/090354 WO2022105116A1 (en) 2020-11-17 2021-04-27 High-frequency request processing method and apparatus, electronic device and storage medium

Country Status (1)

Country Link
WO (1) WO2022105116A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115277599A (en) * 2022-06-16 2022-11-01 平安银行股份有限公司 Backflow method and device in current-limiting scene, computer equipment and storage medium
CN117827957A (en) * 2024-01-03 2024-04-05 广州安广电子科技股份有限公司 Big data-based information input visualization method, system, medium and equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140372426A1 (en) * 2013-06-12 2014-12-18 International Business Machines Corporation Filtering event log entries
CN107332804A (en) * 2016-04-29 2017-11-07 阿里巴巴集团控股有限公司 The detection method and device of webpage leak
CN109446461A (en) * 2018-10-29 2019-03-08 成都思维世纪科技有限责任公司 A kind of method of CDN and CACHE caching flame content auditing
CN110264329A (en) * 2019-06-25 2019-09-20 中国工商银行股份有限公司 High frequency hot spot data processing system and method
CN110389885A (en) * 2019-07-26 2019-10-29 中国工商银行股份有限公司 High frequency transaction monitoring method and device
CN111858067A (en) * 2020-07-31 2020-10-30 厦门网宿有限公司 Data processing method and device
CN112416583A (en) * 2020-11-17 2021-02-26 平安科技(深圳)有限公司 High-frequency request processing method and device, electronic equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140372426A1 (en) * 2013-06-12 2014-12-18 International Business Machines Corporation Filtering event log entries
CN107332804A (en) * 2016-04-29 2017-11-07 阿里巴巴集团控股有限公司 The detection method and device of webpage leak
CN109446461A (en) * 2018-10-29 2019-03-08 成都思维世纪科技有限责任公司 A kind of method of CDN and CACHE caching flame content auditing
CN110264329A (en) * 2019-06-25 2019-09-20 中国工商银行股份有限公司 High frequency hot spot data processing system and method
CN110389885A (en) * 2019-07-26 2019-10-29 中国工商银行股份有限公司 High frequency transaction monitoring method and device
CN111858067A (en) * 2020-07-31 2020-10-30 厦门网宿有限公司 Data processing method and device
CN112416583A (en) * 2020-11-17 2021-02-26 平安科技(深圳)有限公司 High-frequency request processing method and device, electronic equipment and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115277599A (en) * 2022-06-16 2022-11-01 平安银行股份有限公司 Backflow method and device in current-limiting scene, computer equipment and storage medium
CN115277599B (en) * 2022-06-16 2023-08-15 平安银行股份有限公司 Reflow method and device under current limiting scene, computer equipment and storage medium
CN117827957A (en) * 2024-01-03 2024-04-05 广州安广电子科技股份有限公司 Big data-based information input visualization method, system, medium and equipment
CN117827957B (en) * 2024-01-03 2024-06-11 广州安广电子科技股份有限公司 Big data-based information input visualization method, system, medium and equipment

Also Published As

Publication number Publication date
CN112416583A (en) 2021-02-26

Similar Documents

Publication Publication Date Title
CN111082966B (en) Positioning method and device based on batch alarm events, electronic equipment and medium
CN108139958B (en) System and method for processing events of an event stream
CN111901327B (en) Cloud network vulnerability mining method and device, electronic equipment and medium
WO2022105116A1 (en) High-frequency request processing method and apparatus, electronic device and storage medium
WO2021217863A1 (en) Order identifier generation method and apparatus, server, and storage medium
WO2021135530A1 (en) Data recovery method and apparatus, electronic device, and medium
WO2021051589A1 (en) Data storage method and apparatus, electronic device, and storage medium
KR20020041337A (en) Segmentation and processing of continuous data streams using transactional semantics
CN111797351A (en) Page data management method and device, electronic equipment and medium
CN112163412B (en) Data verification method and device, electronic equipment and storage medium
CN112632163B (en) Big data report export method and related equipment
WO2022041889A1 (en) Fund routing method and apparatus, electronic device, and storage medium
WO2022134418A1 (en) Video recognition method and related device
CN111813868B (en) Data synchronization method and device
CN112711398A (en) Method, device and equipment for generating buried point file and storage medium
US9420016B2 (en) Predicting viewing activity of a posting to an activity stream
CN111796936A (en) Request processing method and device, electronic equipment and medium
CN112434062A (en) Quasi-real-time data processing method, device, server and storage medium
WO2022151614A1 (en) Data migration method and apparatus, device, and storage medium
CN111814045A (en) Data query method and device, electronic equipment and storage medium
CN112416583B (en) High-frequency request processing method, high-frequency request processing device, electronic equipment and storage medium
CN112395319B (en) Cache sharing method and device, server and storage medium
CN112738175B (en) Request processing method and related equipment
CN112135199B (en) Video playing method based on multiple types of video sources and related equipment
CN111933241B (en) Medical data analysis method, device, electronic equipment and storage medium

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: 21893272

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: 21893272

Country of ref document: EP

Kind code of ref document: A1