A method and device for processing application request
By deciding whether the interface uses batch processing or asynchronous processing based on the priority of application requests and the number of operation requests, the problems of complex interface operation logic and slow response in the existing technology are solved, and processing efficiency and user experience are improved.
Patent Information
- Application Number
- CN201911031376.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-10-28
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2039-10-28
AI Technical Summary
In the existing technology, the core interface operation logic is complex and difficult to optimize, resulting in slow response, easy timeout, and poor user experience when performing operations in batches.
Based on the priority of application requests and the number of operation requests, choose whether to use batch processing or asynchronous processing, and prioritize operation requests through the interface to avoid slow response and timeout problems caused by a large number of operation requests.
It improves the interface's processing efficiency of operation requests, avoids slow response and timeout problems, and improves user experience.
Smart Images

Figure CN112732417B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a method and device for processing an application request. Background Art
[0002] With the development of mobile terminals such as laptops, tablets, Pads, and mobile phones, in order to overcome geographical and time restrictions, facilitate users to handle business anytime and anywhere, and improve processing efficiency, more and more systems have begun to support mobile terminal operations, and correspondingly developed a variety of mobile terminal APPs, allowing users to call interfaces through APPs to perform corresponding processing operations. Therefore, in order to ensure a good operation processing speed and improve user experience, especially when batch operation processing is involved, interface performance becomes the key.
[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art: the logic of operation processing of some core interfaces is complex, which makes optimization difficult and costly; when a large number of batch operations are executed, the response is slow and timeout is easy, resulting in poor user experience. Summary of the invention
[0004] In view of this, the present invention provides a method and device for processing application requests, which can select the interface's priority processing method for multiple operation requests based on the application priority, the number of the operation requests, etc. before calling the interface according to the application request. This not only ensures the interface's processing efficiency for the operation requests, but also avoids problems such as slow response and timeout caused by a large number of operation requests.
[0005] To achieve the above-mentioned purpose, according to one aspect of the present invention, a method for processing application requests is provided, comprising: receiving an application request, wherein the application request indicates one or more operation requests that are processed by calling an interface; and determining whether the interface adopts batch processing for the one or more operation requests based on one or more of the following: application priority, and the number of the operation requests.
[0006] Optionally, when the priority of the application is priority processing, the interface processes the operation requests in batches; when the processing priority is non-priority processing, the interface does not process the operation requests in batches.
[0007] Optionally, when the number of the one or more operation requests is not greater than a threshold number, it is determined that the interface does not adopt batch processing for the operation requests; when the number of the one or more operation requests is greater than a threshold number, it is determined that the interface adopts batch processing for the operation requests.
[0008] Optionally, it also includes: before determining whether the interface adopts batch processing for the one or more operation requests, determining whether the interface adopts asynchronous processing for the one or more operation requests according to the types of the one or more operation requests; or after determining whether the interface adopts batch processing for the one or more operation requests, determining whether the interface adopts asynchronous processing for the one or more operation requests according to the types of the one or more operation requests.
[0009] To achieve the above-mentioned purpose, according to another aspect of the present invention, there is provided a device for processing application requests, comprising: an application request receiving module and an application request processing module; wherein the application request receiving module is used to receive an application request, wherein the application request indicates one or more operation requests for calling an interface for processing; and the application request processing module is used to determine whether the interface adopts batch processing for the one or more operation requests based on one or more of the following: application priority, the number of the operation requests.
[0010] Optionally, the application request processing module is further used to, when the priority of the application is priority processing, the interface batch processes the operation requests; when the processing priority is non-priority processing, the interface does not batch process the operation requests.
[0011] Optionally, the application request processing module is further used to, when the number of the one or more operation requests is not greater than a threshold number, determine that the interface processes the operation requests synchronously; and when the number of the one or more operation requests is greater than a threshold number, determine that the interface processes the operation requests in batches.
[0012] Optionally, the application request processing module is further used to, before determining whether the interface adopts batch processing for the one or more operation requests, determine whether the interface adopts asynchronous processing for the one or more operation requests based on the types of the one or more operation requests; or after determining whether the interface adopts batch processing for the one or more operation requests, determine whether the interface adopts asynchronous processing for the one or more operation requests based on the types of the one or more operation requests.
[0013] To achieve the above-mentioned purpose, according to another aspect of the present invention, a server for processing application requests of users is provided, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement any of the methods for processing application requests described above.
[0014] To achieve the above objective, according to another aspect of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, any of the methods for processing an application request described above is implemented.
[0015] The above invention has the following advantages or beneficial effects: before the application requests to call the interface, the interface is selected to process multiple operation requests in batches according to the priority of the application, the number of the operation requests, etc.; at the same time, based on the type of operation request, such as the different timeliness requirements of the client such as the APP end for the feedback of different types of operation request processing results, it is further determined whether the interface can adopt an asynchronous processing method for the operation request. Not only does it ensure the processing efficiency of the interface for the operation request, but it also avoids the problems of slow response and timeout caused by the large number of operation requests.
[0016] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0018] Figure 1 is a schematic diagram of the main process of the method for processing an application request according to an embodiment of the present invention;
[0019] Figure 2 is a schematic diagram of the main process of another method for processing an application request according to an embodiment of the present invention;
[0020] Figure 3 is a schematic diagram of main modules of an apparatus for processing application requests according to an embodiment of the present invention;
[0021] Figure 4 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0022] Figure 5 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0023] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0024] Figure 1FIG. 1 is a schematic diagram of a main flow chart of a method for processing an application request according to an embodiment of the present invention. Figure 1 As shown, the method may specifically include the following steps:
[0025] Step S101: receiving an application request, wherein the application request indicates one or more operation requests for invoking an interface for processing.
[0026] An application request refers to an application request generated by an application APP on a mobile terminal such as a laptop, tablet computer, Pad, or mobile phone based on a user request and processed by calling a background interface. Accordingly, in order to implement user requests, the corresponding application request that calls the interface often contains one or more operation requests that call the interface for processing, especially in some special scenarios that require a large number of operation requests, such as batch dispatching, batch appointments, etc. On the other hand, since the background interface called by the APP has limited ability to process operation requests in batches and consumes a lot of resources, under the premise of ensuring that all operation processing can be processed normally, the background interface can determine a more reasonable and effective way to process the operation request, such as whether to process it asynchronously or synchronously, based on the priority of the application APP itself, the number of operation requests contained in the application request, etc.
[0027] Step S102, determining whether the interface adopts batch processing for the one or more operation requests according to one or more of the following: application priority, the number of the operation requests.
[0028] Whether batch processing is adopted refers to the number of threads opened by the interface to process one or more operation requests. Specifically, taking an application request containing 20 operation requests as an example, if the interface adopts batch processing for the 20 operation requests, 20 threads will be opened at one time to process different operation requests respectively. Although this occupies a large number of processor resources, it can greatly speed up the processing efficiency of the operation requests; if the interface does not adopt batch processing for the 20 operation requests, only one thread will be opened at one time to process the 20 operation requests in sequence respectively. In this way, although the processing efficiency is slow, it occupies less processor resources, and the processor can also process other application requests at the same time.
[0029] In an optional implementation, when the priority of the application is priority processing, the interface processes the operation requests in batches; when the processing priority is non-priority processing, the interface does not process the operation requests in batches.
[0030] It is understandable that different application APPs have different permissions and different priorities at the background interface. For example, to ensure normal communication, the permissions of communication APPs are usually higher than those of entertainment APPs. In this way, after receiving application requests sent by different application platforms, it is possible to prioritize the priority of the application to determine whether the background interface needs to prioritize one or more operation requests in the application request. If necessary, batch processing can be used to speed up the processing efficiency of the operation request to improve the user experience. If not, the operation request can be processed normally without batch processing, while ensuring the interface's ability to process other application requests.
[0031] In an optional embodiment, when the number of the one or more operation requests is not greater than a threshold number, it is determined that the interface does not adopt batch processing for the operation requests; when the number of the one or more operation requests is greater than a threshold number, it is determined that the interface adopts batch processing for the operation requests.
[0032] It is understandable that, in addition to the priority of the application, since the number of operation requests indicated by the application request is uncertain, it may be 1, 2, 50, hundreds, etc., the background interface adopts batch processing for different numbers of operation requests, and the processing efficiency is improved to different extents: for example, when the operation request is 1, regardless of whether the background interface adopts batch processing, the number of threads opened is 1, and there is no obvious difference; when the operation request is 5, the efficiency of opening 5 threads for batch processing is higher than that of non-batch processing, but due to the small number of operation requests, the difference between batch processing and non-batch processing is not large. Only when the number of operation requests is quite large, there is a significant difference in efficiency between batch processing and non-batch processing. Therefore, it is necessary to determine whether to adopt batch processing according to the number of operation requests. Specifically, taking the threshold number of 30 as an example, when the number of operation requests indicated in the application request is less than 30, the calling interface does not batch process the operation requests; when the number of operation requests indicated in the application request is greater than 30, in order to improve the processing efficiency of the operation requests, the calling interface batches the operation requests.
[0033] In an optional embodiment, it also includes: before determining whether the interface adopts batch processing for the one or more operation requests, determining whether the interface adopts asynchronous processing for the one or more operation requests according to the types of the one or more operation requests; or after determining whether the interface adopts batch processing for the one or more operation requests, determining whether the interface adopts asynchronous processing for the one or more operation requests according to the types of the one or more operation requests.
[0034] Whether or not to use asynchronous processing refers to the different ways of feeding back messages such as the processing results of operation requests to the APP and other clients. When asynchronous processing is used, the processing of operation requests and the feedback of processing results can be decoupled through message middleware, that is, the processing results are not fed back to the APP and other clients immediately after the operation request is processed, and there is no need to wait for the processing results to be fed back to the client before starting to process one or more other operation requests; when asynchronous processing is not used, the processing results must be fed back to the APP and other clients immediately, and the processing of one or more other operation requests must be started after the processing results are fed back to the client. Therefore, different types of operation requests have different timeliness requirements for feeding back processing results to the APP and other clients. Therefore, the interface can be determined whether to use asynchronous processing for this type of operation request based on the processing method preset at the calling interface according to the type of operation request.
[0035] Based on the method for processing application requests provided in the above embodiment, before the application request calls the interface, the interface is selected to process multiple operation requests in batches according to the priority of the application, the number of the operation requests, etc. At the same time, based on the type of operation request, that is, the different timeliness requirements of the APP end for the processing results of the feedback operation request, it is further determined whether the interface can adopt an asynchronous processing method for the operation request. This not only ensures the processing efficiency of the interface for the operation request, but also avoids problems such as slow response and timeout caused by a large number of operation requests.
[0036] See also Figure 2 Based on the above embodiment, the embodiment of the present invention provides another method for processing an application request, which specifically includes the following steps:
[0037] Step S201: receiving an application request, wherein the application request indicates one or more operation requests for invoking an interface for processing.
[0038] Step S202: Determine, according to the type of the one or more operation requests, whether the interface adopts asynchronous processing for the one or more operation requests.
[0039] Step S203: determining whether the interface adopts batch processing for the one or more operation requests based on one or more of the following: application priority, the number of the operation requests.
[0040] It can be understood that when determining the processing method adopted by the interface for one or more operation requests based on one or more of the priority of the application, the number of the operation requests, and the type of the operation requests, such as batch processing, asynchronous batch processing, synchronous batch processing, etc., the judgment conditions and the judgment order can be arbitrarily combined according to the actual situation, such as first judging whether batch processing is required based on the priority of the application, and then judging based on the number of operation requests; or first judging based on the number of operation requests, and then judging based on the priority of the application; or first judging based on the type of the operation request, and then judging based on the priority of the application and the number of the operation requests, etc.
[0041] See also Figure 3 Based on the above embodiments, an embodiment of the present invention provides a device 300 for processing application requests, including: an application request receiving module 301 and an application request processing module 302; wherein the application request receiving module 301 is used to receive an application request, and the application request indicates one or more operation requests for calling an interface for processing; the application request processing module 302 is used to determine whether the interface adopts batch processing for the one or more operation requests according to one or more of the following: application priority, the number of the operation requests.
[0042] In an optional embodiment, the application request processing module 302 is also used to, when the priority of the application is priority processing, the interface batch processes the operation requests; when the processing priority is non-priority processing, the interface does not batch process the operation requests.
[0043] In an optional embodiment, the application request processing module 302 is also used to determine that the interface synchronously processes the operation requests when the number of the one or more operation requests is not greater than a threshold number; and to determine that the interface batch processes the operation requests when the number of the one or more operation requests is greater than a threshold number.
[0044] In an optional embodiment, the application request processing module 302 is further used to determine, based on the types of the one or more operation requests, whether the interface adopts asynchronous processing for the one or more operation requests before determining whether the interface adopts batch processing for the one or more operation requests; or to determine, based on the types of the one or more operation requests, whether the interface adopts asynchronous processing for the one or more operation requests after determining whether the interface adopts batch processing for the one or more operation requests.
[0045] Figure 4An exemplary system architecture 400 is shown to which the method for processing an application request or an apparatus for processing an application request according to an embodiment of the present invention can be applied.
[0046] like Figure 4 As shown, system architecture 400 may include terminal devices 401, 402, 403, network 404 and server 405. Network 404 is used to provide a medium for communication links between terminal devices 401, 402, 403 and server 405. Network 404 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0047] Users can use terminal devices 401, 402, 403 to interact with server 405 through network 404 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 401, 402, 403, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0048] The terminal devices 401 , 402 , and 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0049] Server 405 may be a server that provides various services, such as a backend management server that provides support for shopping websites browsed by users using terminal devices 401, 402, and 403. The backend management server may analyze and process received data such as product information query requests, and feed back the processing results to the terminal device.
[0050] It should be noted that the method for processing application requests provided in the embodiment of the present invention is generally executed by the server 405 , and accordingly, the device for processing application requests is generally set in the server 405 .
[0051] It should be understood that Figure 4 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0052] Reference below Figure 5 , which shows a schematic diagram of the structure of a computer system 500 of a terminal device suitable for implementing an embodiment of the present invention. Figure 5 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0053] like Figure 5As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0054] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.
[0055] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the system of the present invention are executed.
[0056] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0057] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0058] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor. For example, they may be described as follows: a processor includes an application request receiving module and an application request processing module. The names of these modules do not, in some cases, constitute limitations on the modules themselves. For example, the application request receiving module may also be described as a "module for receiving application requests."
[0059] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: receiving an application request, the application request indicating one or more operation requests for invoking an interface for processing; determining whether the interface adopts batch processing for the one or more operation requests according to one or more of the following: the priority of the application, the number of the operation requests.
[0060] According to the technical solution of the embodiment of the present invention, before the application requests to call the interface, the interface is selected based on the priority of the application, the number of the operation requests, etc., whether to process multiple operation requests in batches; at the same time, based on the type of the operation request, it is further determined whether the interface can adopt an asynchronous processing method for the operation request. This not only ensures the processing efficiency of the interface for the operation request, but also avoids the problems of slow response and timeout caused by a large number of operation requests.
[0061] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for processing an application request, characterized in that: include: receiving an application request, the application request indicating one or more operation requests for invoking an interface for processing; Determining whether the interface adopts batch processing for the one or more operation requests according to one or more of the following: a priority of the application, a number of the operation requests; In the case where the priority of the application is priority processing, the interface processes the operation requests in batches; When the priority of the application is non-priority processing, the interface does not process the operation request in batches; When the number of one or more of the operation requests is not greater than a threshold number, determining that the interface does not adopt batch processing for the operation requests; When the number of one or more of the operation requests is greater than a threshold number, it is determined that the interface adopts batch processing for the operation requests.
2. The method for processing an application request according to claim 1, characterized in that: Also includes: Before determining whether the interface adopts batch processing for the one or more operation requests, determining whether the interface adopts asynchronous processing for the one or more operation requests according to the type of the one or more operation requests; Or after determining whether the interface adopts batch processing for the one or more operation requests, determine whether the interface adopts asynchronous processing for the one or more operation requests according to the types of the one or more operation requests.
3. A device for processing an application request, characterized in that: include: Application request receiving module, application request processing module; wherein, The application request receiving module is used to receive an application request, wherein the application request indicates one or more operation requests for invoking an interface for processing; The application request processing module is used to determine whether the interface adopts batch processing for the one or more operation requests based on one or more of the following: the priority of the application and the number of the operation requests; when the priority of the application is priority processing, the interface processes the operation requests in batches; when the priority of the application is non-priority processing, the interface does not process the operation requests in batches; when the number of one or more of the operation requests is not greater than a threshold number, it is determined that the interface does not adopt batch processing for the operation requests; when the number of one or more of the operation requests is greater than a threshold number, it is determined that the interface adopts batch processing for the operation requests.
4. The device for processing application requests according to claim 3, characterized in that: The application request processing module is further used to: Before determining whether the interface adopts batch processing for the one or more operation requests, determining whether the interface adopts asynchronous processing for the one or more operation requests according to the type of the one or more operation requests; Or after determining whether the interface adopts batch processing for the one or more operation requests, determine whether the interface adopts asynchronous processing for the one or more operation requests according to the types of the one or more operation requests.
5. A server for processing application requests by users, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1-2.
6. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 2 is implemented.
