Request processing method, device, electronic device and computer readable storage medium

By filtering and distributing requests, combined with load balancing policies and distributed caching systems, the problem of excessive server load under high concurrent requests is solved, and processing efficiency and security are improved.

CN114520808BActive Publication Date: 2024-11-15NANJING YAXIN SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011307698.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-19
Publication Date
2024-11-15
Estimated Expiration
2040-11-19

AI Technical Summary

Technical Problem

Under high concurrent requests, the server is overloaded and it is difficult to respond quickly and process data, resulting in inefficient system and difficult to effectively reduce load.

Method used

By receiving batch requests, filtering requests that meet the preset request source, setting request thresholds, filtering the appropriate number of requests, and distributing them to the server cluster for processing, using load balancing strategies, using distributed caching systems and script rules to match and identify requests Source, automatically block malicious requests.

Benefits of technology

It improves the efficiency of server processing high concurrent requests, ensures the security and processing capabilities of requests, reduces the pressure on a single server, avoids the pressure on the backend by malicious requests, and realizes load balancing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114520808B_ABST
    Figure CN114520808B_ABST
Patent Text Reader

Abstract

The present application provides a request processing method, device, electronic device and computer-readable storage medium, and relates to the field of Internet application software technology. The method includes: receiving batch requests; based on the request source of the batch request and the preset request source list, screening the first batch request that meets the preset request source list; if the number of the first batch request is not less than the first preset request threshold in the cache, screening the second batch request that is not greater than the first preset request threshold based on the request timestamp of the first batch request; distributing the second batch request to the server cluster so that the server cluster processes the second batch request. The present application improves the processing efficiency of high-concurrency requests.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of Internet application software. Specifically, the present application relates to a request processing method, device, electronic device and computer-readable storage medium. Background Art

[0002] With the rapid development of the Internet, people's way of surfing the Internet has become very convenient, and the demand for network access has also increased, which has caused great pressure on website servers. These network accesses usually require real-time processing of data and subsequent processing and analysis. Faced with high concurrent access from multiple devices and multiple users, how to reduce the server load, quickly respond to client requests, and process and save data in real time has become a difficult problem. Therefore, how to provide an effective load balancing architecture is crucial. Summary of the invention

[0003] The present application provides a request processing method, device, electronic device and computer-readable storage medium, which can solve the problem of processing high-concurrency requests. The technical solution is as follows:

[0004] In a first aspect, a method for request processing is provided, the method comprising:

[0005] Receive batch requests;

[0006] According to the request source of the batch request, based on the preset request source list, the first batch request that meets the preset request source list is screened;

[0007] If the number of the first batch requests is not less than the first preset request threshold in the cache, filter out the second batch requests whose number is not greater than the first preset request threshold based on the request timestamps of the first batch requests;

[0008] The second batch of requests is distributed to the server cluster so that the server cluster processes the second batch of requests.

[0009] In a second aspect, a device for request processing is provided, the device comprising:

[0010] A receiving module, used for receiving batch requests;

[0011] A first screening module, configured to screen first batch requests that meet a preset request source list based on a preset request source list according to a request source of the batch request;

[0012] A second screening module is used for screening out second batch requests whose number is not greater than the preset request threshold based on the request timestamps of the first batch requests if the number of the first batch requests is not less than the preset request threshold;

[0013] The processing module is used to distribute the second batch requests to the server cluster so that the server cluster processes the second batch requests.

[0014] In a third aspect, an electronic device is provided, the electronic device comprising:

[0015] one or more processors;

[0016] Memory;

[0017] One or more applications, wherein one or more applications are stored in a memory and configured to be executed by one or more processors, and the one or more programs are configured to: perform operations corresponding to the method for request processing shown in the first aspect of the present application.

[0018] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the request processing method shown in the first aspect of the present application is implemented.

[0019] The beneficial effects of the technical solution provided by this application are:

[0020] The present application automatically identifies the source of requests and automatically blocks malicious requests through script rule matching under a distributed cache system, thereby ensuring the security of requests. By setting a first preset threshold, the server can complete processing of requests within its processing capacity, and adopts a load balancing strategy to distribute batch requests to a server cluster so that the server cluster processes the batch requests, thereby solving the problem of the server processing high-concurrency requests and improving the efficiency of processing high-concurrency requests. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in describing the embodiments of the present application are briefly introduced below.

[0022] Figure 1 A flowchart of a request processing method provided in an embodiment of the present application;

[0023] Figure 2 A schematic diagram of a process for obtaining the effective load request amount of each server in a server cluster provided in an embodiment of the present application;

[0024] Figure 3 A flowchart of another request processing method provided in an embodiment of the present application;

[0025] Figure 4 A technical architecture diagram of a request method provided in an embodiment of the present application;

[0026] Figure 5A schematic diagram of the structure of a request processing device provided in an embodiment of the present application;

[0027] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0028] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be interpreted as limiting the present invention.

[0029] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.

[0030] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0031] The request processing method, device, electronic device and computer-readable storage medium provided in this application are intended to solve the above technical problems in the prior art.

[0032] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0033] The present application provides a method for request processing, which is applied to a server, such as Figure 1 As shown, the method includes:

[0034] Step S101: receiving a batch request.

[0035] Among them, the request processing method in the embodiment of the present application can be applied in a server, and the batch request in the present application can be a request sent to the server by a large number of users almost simultaneously in the same time period.

[0036] For example, in "flash sale" activities on the Internet, there are usually a large number of flash sale users, such as thousands or tens of thousands, and the platform server usually receives batch requests from a large number of users.

[0037] Step S102: According to the request source of the batch request, based on the preset request source list, the first batch request that meets the preset request source list is screened.

[0038] It is understandable that receiving batches of requests in the same time period is a huge challenge for the server. For batches of high-concurrency requests, the server front end can resist peaks by increasing the overall carrying capacity of the front-end pool through machine expansion, making static elements on the request page static and minimizing dynamic elements; it can limit the number of requests initiated per unit time for a certain IP; it can also randomly reject some requests when it is close to the upper limit of the front-end pool's carrying capacity.

[0039] In addition to the above processing methods, the server front end can also use the rule matching function of the Lua script to identify the source of batch requests. Lua is a lightweight, embeddable scripting language. Specifically, it can obtain the first batch of requests that meet the request source based on a preset request source list, such as the black and white list control of the requesting user, which prevents malicious requests and reduces the pressure on the back end.

[0040] Step S103: If the number of the first batch requests is not less than the first preset request threshold in the cache, filter out second batch requests whose number is not greater than the first preset request threshold based on the request timestamps of the first batch requests.

[0041] Among them, the first preset request threshold can be a preset total number of requests that the server needs to process. By setting the first preset request threshold and filtering out the second batch requests based on the request timestamps of the first batch requests, it can be understood that the number of second batch requests does not exceed the set first preset request threshold to ensure that the server can only process the set request processing volume, and filter the second batch requests based on the request timestamps to ensure the fairness of the screening.

[0042] For example, the first preset request threshold may be inventory data set in a flash sale activity, and the second batch requests are screened out through the inventory data to ensure that the flash sale activity does not have an overselling problem.

[0043] Step S104: Distribute the second batch requests to the server cluster so that the server cluster processes the second batch requests.

[0044] It is understandable that the server backend can reduce the pressure on a single server and improve the concurrent processing capability of the system by distributing the second batch of requests to different application servers in the server cluster by adopting the load balancing principle. Specifically, the Nginx server can be used. Nginx is a lightweight web server / reverse proxy server and email proxy server. Its concurrent capability performs well among the same type of web servers.

[0045] It should be noted that the main server and the application servers in the server cluster can communicate with each other. Specifically, the main server can determine whether the application server is currently working properly through heartbeat detection. If an application server fails, the main server automatically sends the request to other application servers. If it is detected that the failed application server has resumed working, it will be automatically added to the standby server for processing requests.

[0046] In addition, you can also deploy Nginx dual centers at the same time, build Nginx server backup machines, run high-availability monitoring programs on both the main server and the backup machine, and monitor each other's operating status by sending information such as "I am alive". When the backup machine cannot receive such information within a certain period of time, it means that the main server has a certain failure. At this time, the backup server can take over the service IP of the main server and continue to provide load balancing services; when the backup machine receives information such as "I am alive" from the main server, it releases the service IP address, and the main server begins to provide load balancing services again. Avoid the situation where one of the Nginx servers goes down and the backend web service cannot provide services.

[0047] The present application automatically identifies the source of requests and automatically blocks malicious requests through script rule matching under a distributed cache system, thereby ensuring the security of requests. By setting a first preset threshold, the server can complete processing of requests within its processing capacity, and adopts a load balancing strategy to distribute batch requests to a server cluster so that the server cluster processes the batch requests, thereby solving the problem of the server processing high-concurrency requests and improving the efficiency of processing high-concurrency requests.

[0048] In one embodiment of the present application, if the number of the first batch requests is not less than a first preset request threshold in the cache, the request processing method includes:

[0049] Step S103a: Filter out third batch requests whose number is greater than a first preset request threshold based on the request timestamps of the first batch requests.

[0050] Step S103b: Send the first processing result to the terminal to which the third batch request belongs, where the first processing result includes request failure information.

[0051] It can be understood that if the number of the first batch requests is not less than the first preset request threshold in the cache, that is, the number of the first batch requests has exceeded the request processing capacity set by the server, for batch requests that exceed the request data volume, the server will send request failure information to the terminals to which these batch requests belong, in order to notify the user in a friendly manner. Specifically, the third batch requests that need to send request failure information can be filtered out in the order of request timestamps, and filtering is performed by request timestamps to ensure the fairness of filtering.

[0052] For example, when the first preset request threshold is the inventory quantity in the flash sale activity, and when the quantity of the first batch request is not less than the inventory quantity, the server can send a flash sale failure message to the terminal to which the third batch request that exceeds the inventory quantity belongs according to the request timestamp, thereby solving the overselling problem in the flash sale activity and notifying the user in a friendly manner.

[0053] In one embodiment of the present application, if the number of the first batch requests is less than the first preset request threshold, the request processing method further includes:

[0054] According to the number of the first batch requests, the first preset request threshold in the cache is adjusted so that the adjusted first preset request threshold in the cache is the difference between the first preset request threshold in the cache before adjustment and the number of the first batch requests.

[0055] It is understandable that if the number of first batch requests is less than the first preset request threshold in the cache, that is, the number of first batch requests does not exceed the request processing volume set by the server, the server will adjust the first preset request threshold in the cache. Specifically, the first preset request threshold can be reduced, and the modified first request threshold is the difference between the original first request threshold and the number of first batch requests. By reducing the first request threshold, it is convenient to receive subsequent requests.

[0056] For example, when the first preset request threshold is the inventory quantity in the flash sale activity, when the number of first batch requests is less than the inventory quantity, the server can modify the first preset request threshold in the cache, that is, pre-reduce the inventory in the cache. More specifically, the server can pre-reduce the inventory in real time according to the number of requests received until the inventory is 0, and send a flash sale failure message to the terminal to which the request belongs after the inventory is 0.

[0057] In one embodiment of the present application, step S104: distributing the second batch request to the server cluster includes:

[0058] Step S104a: Obtain the effective load request amount of each server in the server cluster.

[0059] Step S104b: Distribute the second batch requests to corresponding servers in the server cluster according to the effective load request amount of each server.

[0060] Among them, when the main server distributes the second batch requests to the application servers in the server cluster, the load balancing principle can be adopted. Specifically, when each application server receives a request, if the application server is changed to a normal working state, the effective load request volume of the application server increases. At this time, the main server can distribute the second batch requests to each server according to the effective load request volume of each server in the server cluster, so as to maintain dynamic load balancing for the entire system.

[0061] In one embodiment of the present application, Figure 2 As shown, obtain the effective load request amount of each server in the server cluster, including:

[0062] Step S201: monitor the operating status of each server in the server cluster.

[0063] It is understandable that the main server and each application server in the server cluster can communicate with each other, and the main server can determine whether the application server is currently working normally by means of heartbeat detection.

[0064] Step S202: If the operating status of any server in the server cluster is normal, the load request amount of the server is determined as the effective load request amount of the server.

[0065] Step S203: If the operating status of any server in the server cluster is abnormal, clear the effective load request of the server and distribute the load request of the server to other servers in the server cluster.

[0066] Among them, when the main server determines that the operating status of any application server is normal, the current load request amount of the application server can be determined as the effective load request amount of the application server, and the main server can also continue to distribute requests to the application server based on the effective load request amount of the application server.

[0067] When the main server determines that the operating status of any application server is abnormal, that is, the application server has failed at this time, in order to ensure that the request can be processed in time, the main server clears the effective load of the application server and automatically distributes the load requests in the application server to other application servers, and no longer distributes requests to the application server.

[0068] It should be noted that when the primary server detects the fault of the application server that has failed, it can continue to distribute requests to the application server.

[0069] In one embodiment of the present application, if the received batch requests are of different types, distributing the second batch request to the server cluster so that the server cluster processes the second batch request includes:

[0070] The second batch requests are distributed to the server cluster, so that the server cluster determines different queues according to types of the second batch requests, and processes the second batch requests based on the order of requests in the queues.

[0071] It is understandable that when the second batch requests are requests of different types, for example, in a flash sale activity, the types of products targeted in the flash sale activity can be diverse, or the same product includes different models and colors. At this time, the second batch requests can be further classified, and each request of the detailed classification has a queue. Each request of the detailed classification is placed in an asynchronous queue, and the application server processes the requests in each queue according to the first-in-first-out principle.

[0072] In one embodiment of the present application, the second batch request is distributed to the server cluster so that after the server cluster processes the second batch request, Figure 3 As shown, the request processing method also includes:

[0073] Step S301: receiving a second processing result for a second batch request sent by a server cluster.

[0074] Step S302: adjusting the second preset request threshold in the database according to the second processing result of the second batch request, wherein the number of the second preset request threshold in the database after adjustment is the same as the number of the first preset request threshold in the cache after adjustment.

[0075] Step S303: Send the second processing result to the terminal to which the second batch request belongs, where the second processing result includes request success information.

[0076] Among them, after receiving the request distributed by the main server, the application server in the server cluster will process the distributed request according to the first-in-first-out principle, obtain the second processing result, and return the second processing result to the main server. The main server then sends the second processing result to the terminal to which the second batch request belongs. It can be understood that the second processing result includes request success information.

[0077] For example, after the user applies for a flash sale request at the terminal, the main server distributes the flash sale request to the application server, and then the application server processes the request that is successfully dequeued to realize real business acceptance, thereby generating a flash sale success list as the second processing result. The main server sends the flash sale success list to the terminal corresponding to the flash sale request to complete the flash sale activity.

[0078] It should be noted that after receiving the second processing result for the second batch request, the main server can adjust the second preset request threshold in the database, wherein the second preset request threshold is also the total number of requests that the main server needs to process, and the second request threshold is stored in the database. When the main server receives the second processing result for the second batch request, it indicates that the second batch request has been processed. At this time, the second preset request threshold can be adjusted, that is, the number of processed requests is reduced. The adjusted second preset request threshold is the number of requests that the main service needs to process.

[0079] For example, in a flash sale activity, the second preset request threshold can be the actual inventory data set in the flash sale activity, and the actual inventory data is stored in the database. When the main server receives the flash sale success list of the flash sale request, the actual inventory data in the database is adjusted, and the second preset request threshold in the adjusted database is the same as the number of the first preset request threshold in the adjusted cache. This indicates that the actual inventory data is consistent with the pre-reduced inventory data, indicating that no user gave up the purchase after submitting the flash sale request, solving the problem of under-buying. The actual inventory data is consistent with the pre-reduced inventory data, which also indicates the correctness of the actual order data and the actual inventory data.

[0080] In one embodiment of the present application, the technical architecture diagram involved in the present application is as follows: Figure 4 As shown, when a high-concurrency request is sent to a high-performance server built using OpenResty, where OpenResty is a powerful web application server, web developers can use various C languages ​​and lua modules supported by Nginx to quickly construct an ultra-high-performance web application system capable of responding to more than 10,000 concurrent connections. The server can first use the lua script rule to verify and identify the request source, limit malicious requests, and then determine whether the number of requests received exceeds the requests allowed by the service capacity, and send request failure information to the request terminal for requests that exceed the background processing capacity to notify the requester in a friendly manner, and distribute the requests within the service capacity allowed by the server to the ADMQ (Active Distributed Message Queue, distributed message middleware) cluster, so that the application servers in the cluster can simultaneously process processing requests in different message queues to improve request processing efficiency.

[0081] The present application embodiment provides a request processing device, such as Figure 5 As shown, the request processing device 50 may include: a receiving module 501, a first screening module 502, a second screening module 503, and a processing module 504, wherein:

[0082] The receiving module 501 is used to receive batch requests.

[0083] Among them, the request processing method in the embodiment of the present application can be applied in a server, and the batch request in the present application can be a request sent to the server by a large number of users almost simultaneously in the same time period.

[0084] For example, in "flash sale" activities on the Internet, there are usually a large number of flash sale users, such as thousands or tens of thousands, and the platform server usually receives batch requests from a large number of users.

[0085] The first screening module 502 is used to screen the first batch requests that meet the preset request source list according to the request source of the batch requests and based on the preset request source list.

[0086] It is understandable that receiving batches of requests in the same time period is a huge challenge for the server. For batches of high-concurrency requests, the server front end can resist peaks by increasing the overall carrying capacity of the front-end pool through machine expansion, making static elements on the request page static and minimizing dynamic elements; it can limit the number of requests initiated per unit time for a certain IP; it can also randomly reject some requests when it is close to the upper limit of the front-end pool's carrying capacity.

[0087] In addition to the above processing methods, the server front end can also use the rule matching function of the Lua script to identify the source of batch requests. Lua is a lightweight, embeddable scripting language. Specifically, it can obtain the first batch of requests that meet the request source based on a preset request source list, such as the black and white list control of the requesting user, which prevents malicious requests and reduces the pressure on the back end.

[0088] The second screening module 503 is used to screen out second batch requests whose number is not greater than the first preset request threshold based on the request timestamps of the first batch requests if the number of the first batch requests is not less than the first preset request threshold in the cache.

[0089] Among them, the first preset request threshold can be a preset total number of requests that the server needs to process. By setting the first preset request threshold and filtering out the second batch requests based on the request timestamps of the first batch requests, it can be understood that the number of second batch requests does not exceed the set first preset request threshold to ensure that the server can only process the set request processing volume, and filter the second batch requests based on the request timestamps to ensure the fairness of the screening.

[0090] For example, the first preset request threshold may be inventory data set in a flash sale activity, and the second batch requests are screened out through the inventory data to ensure that the flash sale activity does not have an overselling problem.

[0091] The processing module 504 is used to distribute the second batch requests to the server cluster so that the server cluster processes the second batch requests.

[0092] It is understandable that the server backend can reduce the pressure on a single server and improve the concurrent processing capability of the system by distributing the second batch of requests to different application servers in the server cluster by adopting the load balancing principle. Specifically, the Nginx server can be used. Nginx is a lightweight web server / reverse proxy server and email proxy server. Its concurrent capability performs well among the same type of web servers.

[0093] It should be noted that the main server and the application servers in the server cluster can communicate with each other. Specifically, the main server can determine whether the application server is currently working properly through heartbeat detection. If an application server fails, the main server automatically sends the request to other application servers. If it is detected that the failed application server has resumed working, it will be automatically added to the standby server for processing requests.

[0094] In addition, you can also deploy Nginx dual centers at the same time, build Nginx server backup machines, run high-availability monitoring programs on both the main server and the backup machine, and monitor each other's operating status by sending information such as "I am alive". When the backup machine cannot receive such information within a certain period of time, it means that the main server has a certain failure. At this time, the backup server can take over the service IP of the main server and continue to provide load balancing services; when the backup machine receives information such as "I am alive" from the main server, it releases the service IP address, and the main server begins to provide load balancing services again. Avoid the situation where one of the Nginx servers goes down and the backend web service cannot provide services.

[0095] The present application automatically identifies the source of requests and automatically blocks malicious requests through script rule matching under a distributed cache system, thereby ensuring the security of requests. By setting a first preset threshold, the server can complete processing of requests within its processing capacity, and adopts a load balancing strategy to distribute batch requests to a server cluster so that the server cluster processes the batch requests, thereby solving the problem of the server processing high-concurrency requests and improving the efficiency of processing high-concurrency requests.

[0096] An electronic device is provided in an embodiment of the present application, and the electronic device includes: a memory and a processor; at least one program, stored in the memory, for being executed by the processor, which can achieve the following compared to the prior art: the present application automatically identifies the source of requests and automatically blocks malicious requests through script rule matching under a distributed cache system, thereby ensuring the security of requests, and by setting a first preset threshold, the server can complete processing of requests within its processing capacity, and adopts a load balancing strategy to distribute batch requests to a server cluster so that the server cluster processes the batch requests, thereby solving the problem of the server processing high-concurrency requests and improving the efficiency of processing high-concurrency requests.

[0097] In an alternative embodiment, an electronic device is provided, such as Figure 6 As shown, Figure 6 The electronic device 4000 shown includes: a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, such as through a bus 4002. Optionally, the electronic device 4000 may also include a transceiver 4004. It should be noted that in actual applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present application.

[0098] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0099] The bus 4002 may include a path to transmit information between the above components. The bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 4002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0100] The memory 4003 can be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to this.

[0101] The memory 4003 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 4001. The processor 4001 is used to execute the application code stored in the memory 4003 to implement the contents shown in the above method embodiment.

[0102] The embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and when it is run on a computer, the computer can execute the corresponding content of the aforementioned method embodiment. Compared with the prior art, the present application automatically identifies the source of requests and automatically shields malicious requests through script rule matching under a distributed cache system, thereby ensuring the security of requests, setting a first preset threshold, so that the server can complete the processing of requests within its processing capacity, and adopting a load balancing strategy to distribute batch requests to a server cluster so that the server cluster processes batch requests, solving the problem of the server processing high-concurrency requests and improving the efficiency of processing high-concurrency requests.

[0103] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0104] The above descriptions are only some embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A request processing method, applied to a server, characterized in that: include: Receive batch requests and identify the source of the batch requests based on the rule matching function of the Lua script; According to the request source of the batch request, based on a preset request source list, screening the first batch request that meets the preset request source list; If the number of the first batch requests is not less than a first preset request threshold in the cache, filter out second batch requests whose number is not greater than the first preset request threshold based on the request timestamps of the first batch requests; Distributing the second batch requests to a server cluster so that the server cluster processes the second batch requests; The method further comprises: For each request source, the target element on the request page corresponding to the request source is made static, and dynamic elements are reduced; The distributing the second batch requests to the server cluster specifically includes: Obtaining the effective load request amount of each server in the server cluster; Distributing the second batch requests to corresponding servers in the server cluster according to the effective load request amount of each server; The obtaining of the effective load request amount of each server in the server cluster specifically includes: Monitoring the operating status of each server in the server cluster by means of heartbeat detection; If the running state of any server in the server cluster is normal, the load request amount of the server is determined as the effective load request amount of the server; If the running state of any server in the server cluster is abnormal, clear the effective load request of the server and distribute the load request of the server to other servers in the server cluster; After distributing the second batch requests to the server cluster so that the server cluster processes the second batch requests, the method further includes: receiving a second processing result for the second batch request sent by the server cluster; According to the second processing result of the second batch request, adjusting the second preset request threshold in the database, wherein the number of the second preset request threshold in the database after adjustment is the same as the number of the first preset request threshold in the cache after adjustment; Sending the second processing result to the terminal to which the second batch request belongs, the second processing result including request success information; The second processing result is obtained by: The entry and exit order of each request in the second batch request is obtained, and each request is processed in sequence according to the first-in-first-out principle based on the entry and exit order to obtain the second processing result.

2. The method according to claim 1, characterized in that If the number of the first batch requests is not less than a first preset request threshold in the cache, the method includes: Filtering out third batch requests whose number is greater than the first preset request threshold according to the request timestamps of the first batch requests; A first processing result is sent to the terminal to which the third batch request belongs, wherein the first processing result includes request failure information.

3. The method according to claim 1, characterized in that If the number of the first batch requests is less than a first preset request threshold, the method further includes: According to the number of the first batch requests, the first preset request threshold in the cache is adjusted so that the adjusted first preset request threshold in the cache is the difference between the first preset request threshold in the cache before adjustment and the number of the first batch requests.

4. The method according to claim 1, characterized in that: If the received batch requests are of different types, distributing the second batch requests to a server cluster so that the server cluster processes the second batch requests includes: The second batch requests are distributed to a server cluster so that the server cluster determines different queues according to types of the second batch requests and processes the second batch requests based on a request order in the queues.

5. A request processing device, characterized in that: include: A receiving module, used for receiving batch requests and identifying the source of the batch requests based on the rule matching function of the Lua script; A first screening module, configured to screen first batch requests that match a preset request source list based on a preset request source list according to a request source of the batch requests; A second screening module is used for screening out second batch requests whose number is not greater than the preset request threshold based on the request timestamps of the first batch requests if the number of the first batch requests is not less than the preset request threshold; a processing module, configured to distribute the second batch requests to a server cluster so that the server cluster processes the second batch requests; An element processing module, for making, for each request source, a target element on a request page corresponding to the request source static and reducing dynamic elements; The processing module is specifically used for: Obtaining the effective load request amount of each server in the server cluster; Distributing the second batch requests to corresponding servers in the server cluster according to the effective load request amount of each server; The processing module is further configured to: Monitoring the operating status of each server in the server cluster by means of heartbeat detection; If the running state of any server in the server cluster is normal, the load request amount of the server is determined as the effective load request amount of the server; If the running state of any server in the server cluster is abnormal, clear the effective load request of the server and distribute the load request of the server to other servers in the server cluster; A processing result acquisition module, used for receiving a second processing result for the second batch request sent by the server cluster; According to the second processing result of the second batch request, adjusting the second preset request threshold in the database, wherein the number of the second preset request threshold in the database after adjustment is the same as the number of the first preset request threshold in the cache after adjustment; Sending the second processing result to the terminal to which the second batch request belongs, the second processing result including request success information; The second processing result is obtained by: The entry and exit order of each request in the second batch request is obtained, and each request is processed in sequence according to the first-in-first-out principle based on the entry and exit order to obtain the second processing result.

6. An electronic device, characterized in that: It includes: one or more processors; Memory; One or more application programs, wherein the one or more application programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs are configured to: execute the request processing method according to any one of claims 1 to 4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the request processing method described in any one of claims 1 to 4 is implemented.