CN110650173B - Request processing method and device - Google Patents
Request processing method and device Download PDFInfo
- Publication number
- CN110650173B CN110650173B CN201810681213.3A CN201810681213A CN110650173B CN 110650173 B CN110650173 B CN 110650173B CN 201810681213 A CN201810681213 A CN 201810681213A CN 110650173 B CN110650173 B CN 110650173B
- Authority
- CN
- China
- Prior art keywords
- service requests
- equipment
- service
- request
- processing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1001—Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer And Data Communications (AREA)
Abstract
The method and the device for processing the request provided by the invention monitor the number of the service requests currently processed by the second equipment in real time, and send the unprocessed service requests to the second equipment under the condition that the number of the service requests currently processed by the second equipment reaches a first preset number based on the number of the service requests currently processed by the second equipment, wherein the number of the sent unprocessed service requests is determined according to the service request processing capacity of the second equipment, so that the service requests currently processed by the second equipment are continuously maintained at the current processing capacity of the second equipment, the second equipment reaches the maximum utilization rate, the second equipment cannot crash due to overlarge pressure, the computing resources of the second equipment are reasonably applied, and meanwhile, the processing time for processing the same task amount by the second equipment is reduced.
Description
Technical Field
The present invention relates to the field of computer processing technologies, and in particular, to a request processing method and apparatus.
Background
At present, when sending a batch service request to a server, in order to prevent the server from being overloaded, a general processing mode is to send a batch of service requests to the server in batch, and send the next batch when waiting for all the service requests to be processed. In this processing mode, when a service request is just received, the processing state of the server is in a peak state, and the processing capacity of the server is not higher than the maximum value of the processing capacity of the server; when all the requests are processed, the processing state of the server is in the trough state, so that the processing state of the server fluctuates up and down like a sine function, and the processing state of the server is in the trough state, so that the computing resources of the server cannot be reasonably applied, and the processing time of the server for processing the same task amount is increased.
Disclosure of Invention
In view of the above problems, the present invention is proposed to provide a request processing method and apparatus for overcoming the above problems or at least partially solving the above problems, so that the processing state of the server is always in a peak state to realize reasonable application of the computing resources of the server, thereby reducing the processing time for the server to process the same task amount.
The specific technical scheme is as follows:
a request processing method applied to a first device which is in communication connection with a second device capable of processing a service request, the method comprising:
monitoring the number of service requests currently processed by the second device;
and sending unprocessed service requests to the second equipment under the condition that the number of the service requests processed by the second equipment currently reaches a first preset number based on the number of the service requests processed by the second equipment currently, wherein the sent unprocessed service requests are determined according to the service request processing capacity of the second equipment.
Optionally, the monitoring the number of service requests currently processed by the second device includes:
recording the service requests sent to the second equipment by using a first list, and deleting the service requests corresponding to the processing completion response in the service requests recorded in the first list after receiving the processing completion response returned by the second equipment;
and monitoring the number of the service requests currently recorded in the first list as the number of the service requests currently processed by the second device.
Optionally, the monitoring the number of service requests currently processed by the second device includes:
recording the service requests sent to the second equipment by using a first list, wherein each service request in the first list corresponds to a request state, and an initial request state corresponding to each service request is in processing;
after receiving a processing completion response returned by the second device, modifying a request state corresponding to a service request corresponding to the processing completion response in the service requests recorded in the first list into: finishing the treatment;
and monitoring the number of service requests with request states being processed in the service requests currently recorded in the first list as the number of service requests currently processed by the second device.
Optionally, the sending an unprocessed service request to the second device when it is determined that the number of service requests currently processed by the second device reaches a first preset number based on the number of service requests currently processed by the second device includes:
determining the difference between the number of service requests currently processed by the second device and the second preset number as the number N of service requests currently processed by the second device, wherein the second preset number is predetermined according to the service request processing capability of the second device;
and sending N unprocessed service requests to the second equipment, so that the number of the service requests currently processed by the second equipment is maintained at the second preset number.
Optionally, the method further includes:
recording a service request to be sent to the second device using a second list;
and deleting the service requests which are recorded in the second list and sent to the second equipment after the service requests in the second list are sent to the second equipment.
Optionally, before the step of monitoring the number of service requests currently processed by the second device, the method further includes:
and sending the preset number of service requests to the second equipment.
A request processing apparatus comprising:
the first processing unit is used for monitoring the number of service requests currently processed by the second equipment;
and a second processing unit, configured to send an unprocessed service request to the second device when it is determined that the number of service requests currently processed by the second device reaches a first preset number based on the number of service requests currently processed by the second device, where the number of sent unprocessed service requests is determined according to a service request processing capability of the second device.
Optionally, the first processing unit includes:
a deleting unit, configured to record, using a first list, the service request that has been sent to the second device, and delete, after receiving a processing completion response returned by the second device, a service request corresponding to the processing completion response in the service requests recorded in the first list;
and the monitoring unit is used for monitoring the number of the service requests currently recorded in the first list as the number of the service requests currently processed by the second equipment.
A storage medium including a stored program,
and controlling the equipment where the storage medium is located to execute the request processing method when the program runs.
A processor for running a program,
wherein, the program executes the request processing method when running.
With the above technical solution, the present invention provides a request processing method and apparatus, which are applied to a first device, where the first device is in communication connection with a second device capable of processing a service request, and the method includes: monitoring the number of service requests currently processed by the second device; and sending unprocessed service requests to the second equipment under the condition that the number of the service requests currently processed by the second equipment reaches a first preset number according to the number of the service requests currently processed by the second equipment, wherein the sent unprocessed service requests are determined according to the service request processing capacity of the second equipment, so that the number of the service requests currently processed by the second equipment is continuously maintained at the first preset number. The invention monitors the number of service requests currently processed by the second device in real time, and sends unprocessed service requests to the second device under the condition that the number of service requests currently processed by the second device is determined to reach a first preset number, so that the number of service requests currently processed by the second device is continuously maintained at the first preset number, namely: after a certain number of service requests are processed, the second device is ensured to send the same number of unprocessed service requests to the second device, so that the service requests currently processed by the second device are continuously maintained at the first preset number, the second device reaches the maximum utilization rate, further the second device is prevented from collapsing due to overlarge pressure, the computing resources of the second device are reasonably applied, and meanwhile, the processing time of the second device for processing the same task amount is reduced.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a schematic flow chart illustrating a request processing method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart illustrating a specific implementation manner of step S101 according to an embodiment of the present invention;
fig. 3 is a schematic flow chart illustrating another specific implementation of step S101 according to an embodiment of the present invention;
fig. 4 is a flowchart illustrating a specific implementation manner of step S102 according to an embodiment of the present invention;
FIG. 5 is a flow chart of another request processing method provided by the embodiment of the invention;
fig. 6 is a schematic structural diagram illustrating a request processing apparatus according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Referring to fig. 1, the first embodiment discloses a request processing method applied to a first device, where the first device is in communication connection with a second device capable of processing a service request, and the method specifically includes the following steps:
s101, monitoring the number of service requests currently processed by the second equipment.
The first device may be a client, or may be an intermediate device in which the first device and the second device are communicatively connected, and the second device may be a server, that is, the method shown in fig. 1 may be applied to the client, or may be applied to the intermediate device in which the client and the server are communicatively connected.
In the embodiment of the present invention, it should be noted that a request pool is created in advance in the first device, and the request pool is used for recording the service request to be sent to the second device, and meanwhile, recording the service request that has been sent to the second device. The first device receives a service request sent by a user, records a server request to be sent to the second device in a request pool, records the service request sent to the second device in the request pool, and keeps the maximum utilization rate of the second device by monitoring the number of service requests currently processed by the second device.
As shown in fig. 2, a specific implementation manner of step S101 provided in the embodiment of the present invention is as follows:
specifically, the step of monitoring the number of service requests currently processed by the second device may specifically include the following steps:
s201, the first list is used for recording the service requests sent to the second equipment, and after a processing completion response returned by the second equipment is received, the service requests corresponding to the processing completion response in the service requests recorded in the first list are deleted.
S202, monitoring the number of the service requests currently recorded in the first list as the number of the service requests currently processed by the second device.
In the embodiment of the invention, a first list is created in the request pool, the first list is used for recording the service request sent to the second equipment, after the service request is sent to the second equipment, the second equipment feeds back the corresponding response result, and after the returned response result is the processing completion, the service request corresponding to the processing completion response in the service request recorded in the first list is deleted. Then, the number of service requests currently recorded in the first list is monitored as the number of service requests currently processed by the second device.
It should be noted that, of the service requests recorded in the first list, the service request corresponding to the processing completion response may be set to be deleted, or may be set not to be deleted, and in the case of not being deleted, a thread for managing the service request needs to be separately provided.
As shown in fig. 3, another specific implementation manner of step S101 provided in the embodiment of the present invention is as follows:
specifically, the step of monitoring the number of service requests currently processed by the second device may specifically include the following steps:
s301, recording service requests sent to the second equipment by using a first list, wherein each service request in the first list corresponds to a request state, and an initial request state corresponding to each service request is in processing;
s302, after receiving the processing completion response returned by the second device, modifying a request state corresponding to a service request corresponding to the processing completion response in the service requests recorded in the first list to: finishing the treatment;
and S303, monitoring the number of service requests with request states being processed in the service requests currently recorded in the first list as the number of service requests currently processed by the second equipment.
In the embodiment of the invention, a first list is created in the request pool, the first list is used for recording the service requests sent to the second equipment, each service request in the first list corresponds to a request state, the initial request state corresponding to each service request is in processing,
s102, sending unprocessed service requests to the second equipment under the condition that the number of the service requests processed by the second equipment currently reaches a first preset number according to the number of the service requests processed by the second equipment currently, wherein the sent unprocessed service requests are determined according to the service request processing capacity of the second equipment.
It should be noted that the first preset number mentioned above is related to the service request processing capability of the second device, and specifically, the first preset number may be a number determined according to the service request processing capability of the second device, or may be a number of maximum processing service requests of the second device, or may be a preset range based on the maximum processing capability.
Assuming that the processing capability of the second device is five service requests, and the preset number is set to five service requests, the five service requests sent to the second device are recorded in the request pool according to the processing capability of the second device, and when the service requests sent to the second device and recorded in the request pool meet the condition of five server requests, the request status of the server request is monitored, and specifically, the request status may include: in-process, process complete, process, etc.
On the basis of fig. 1, fig. 2 and fig. 3, as shown in fig. 4, a specific implementation of step S102 provided by the embodiment of the present invention is as follows:
specifically, the step of sending the unprocessed service requests to the second device when it is determined that the number of service requests currently processed by the second device reaches the first preset number based on the number of service requests currently processed by the second device may specifically include the following steps:
s401, determining the difference between the number of the service requests currently processed by the second device and a second preset number as the number N of the service requests currently processed by the second device.
Wherein the second preset number is predetermined according to a service request processing capability of the second device.
S402, sending N unprocessed service requests to the second equipment, and keeping the number of the service requests currently processed by the second equipment at a second preset number.
In the embodiment of the present invention, the difference between the number of service requests currently processed by the second device and the preset number is determined as the number N of service requests currently processed by the second device, for example: the preset number is determined to be 5 according to the processing capability of the second device, if the number of the service requests currently processed by the second device is 2, the number of the service requests currently processed by the second device is determined to be 3, and then 3 unprocessed service requests are sent to the second device again, so that the number of the service requests currently processed by the second device is continuously maintained at 5.
Referring to fig. 5, as a preferred implementation manner of this embodiment, before monitoring the number of service requests currently processed by the second device in step S101, the method further includes:
and S100, sending a preset number of service requests to the second equipment.
The user may send a preset number of service requests to the second device according to the service request processing capability of the second device. That is, assuming that the processing capability of the second device is five service requests, it is initially necessary to successively send five service requests to the second device.
The request processing method provided by the embodiment of the invention is applied to first equipment, the first equipment is in communication connection with second equipment capable of processing a service request, and the method comprises the following steps: monitoring the number of service requests currently processed by the second device; when the number of service requests currently processed by the second device is determined to be N, the N unprocessed service requests are sent to the second device, so that the number of service requests currently processed by the second device is continuously maintained at a preset number, wherein the preset number is related to the service request processing capacity of the second device, and N is a natural number and is not greater than the preset number. The embodiment of the invention monitors the number of service requests currently processed by the second device in real time, and when the second device is determined to complete N service requests currently processed, N unprocessed service requests are sent to the second device, so that the number of the service requests currently processed by the second device is continuously maintained at the preset number, namely: after the second device processes the N service requests, the second device is ensured to send N unprocessed service requests to the second device, so that the service requests currently processed by the second device are continuously maintained at the current processing capacity of the second device, the second device reaches the maximum utilization rate, further the second device is prevented from being crashed due to overlarge pressure, the computing resources of the second device are reasonably applied, and meanwhile, the processing time of the second device for processing the same task amount is reduced.
Referring to fig. 6, based on the request processing method disclosed in the foregoing embodiment, the present embodiment correspondingly discloses a request processing apparatus, which specifically includes: a first processing unit 601 and a second processing unit 602, wherein:
a first processing unit 601, configured to monitor the number of service requests currently processed by the second device;
a second processing unit 602, configured to send an unprocessed service request to the second device when it is determined that the number of service requests currently processed by the second device reaches a first preset number based on the number of service requests currently processed by the second device, where the number of sent unprocessed service requests is determined according to a service request processing capability of the second device.
Specifically, the first processing unit 601 may include:
the deleting unit is used for recording the service request sent to the second equipment by using the first list, and deleting the service request corresponding to the processing completion response in the service requests recorded in the first list after receiving the processing completion response returned by the second equipment;
and the monitoring unit is used for monitoring the number of the service requests currently recorded in the first list as the number of the service requests currently processed by the second equipment.
In the request processing apparatus provided in the embodiment of the present invention, the first processing unit monitors, in real time, the number of service requests currently processed by the second device, and when it is determined that the number of service requests currently processed by the second device reaches a first preset number, the second processing unit sends an unprocessed service request to the second device, where the sent unprocessed service request number is determined according to the service request processing capability of the second device, so that the number of service requests currently processed by the second device is continuously maintained at the first preset number, that is: after a certain number of service requests are processed, the second device is ensured to send the same number of unprocessed service requests to the second device, so that the service requests currently processed by the second device are continuously maintained at the first preset number, the second device reaches the maximum utilization rate, further the second device is prevented from collapsing due to overlarge pressure, the computing resources of the second device are reasonably applied, and meanwhile, the processing time of the second device for processing the same task amount is reduced.
The browser-based data processing device comprises a processor and a memory, wherein the first processing unit, the second processing unit and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more than one, and the processing state of the server is always in a wave crest state by adjusting kernel parameters, so that the computing resources of the server are reasonably applied, and the processing time of the server for processing the same task amount is reduced.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
An embodiment of the present invention provides a storage medium on which a program is stored, the program implementing the request processing method when executed by a processor.
The embodiment of the invention provides a processor, which is used for running a program, wherein the request processing method is executed when the program runs.
The embodiment of the invention provides equipment, which comprises a processor, a memory and a program which is stored on the memory and can run on the processor, wherein the processor executes the program and realizes the following steps:
monitoring the number of service requests currently processed by the second device;
and sending unprocessed service requests to the second equipment under the condition that the number of the service requests processed by the second equipment currently reaches a first preset number based on the number of the service requests processed by the second equipment currently, wherein the sent unprocessed service requests are determined according to the service request processing capacity of the second equipment.
Optionally, the monitoring the number of service requests currently processed by the second device includes:
recording the service requests sent to the second equipment by using a first list, and deleting the service requests corresponding to the processing completion response in the service requests recorded in the first list after receiving the processing completion response returned by the second equipment;
and monitoring the number of the service requests currently recorded in the first list as the number of the service requests currently processed by the second device.
Optionally, the monitoring the number of service requests currently processed by the second device includes:
recording the service requests sent to the second equipment by using a first list, wherein each service request in the first list corresponds to a request state, and an initial request state corresponding to each service request is in processing;
after receiving a processing completion response returned by the second device, modifying a request state corresponding to a service request corresponding to the processing completion response in the service requests recorded in the first list into: finishing the treatment;
and monitoring the number of service requests with request states being processed in the service requests currently recorded in the first list as the number of service requests currently processed by the second device.
Optionally, the sending an unprocessed service request to the second device when it is determined that the number of service requests currently processed by the second device reaches a first preset number based on the number of service requests currently processed by the second device includes:
determining the difference between the number of service requests currently processed by the second device and a second preset number as the number N of service requests currently processed by the second device, wherein the second preset number is predetermined according to the service request processing capability of the second device;
and sending N unprocessed service requests to the second equipment, so that the number of the service requests currently processed by the second equipment is maintained at the second preset number.
Optionally, the method further includes:
recording a service request to be sent to the second device using a second list;
and deleting the service requests which are recorded in the second list and sent to the second equipment after the service requests in the second list are sent to the second equipment.
Optionally, before the step of monitoring the number of service requests currently processed by the second device, the method further includes:
and sending a first preset number of service requests to the second equipment.
The device herein may be a server, a PC, a PAD, a mobile phone, etc.
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device:
monitoring the number of service requests currently processed by the second device;
and sending unprocessed service requests to the second equipment under the condition that the number of the service requests processed by the second equipment currently reaches a first preset number based on the number of the service requests processed by the second equipment currently, wherein the sent unprocessed service requests are determined according to the service request processing capacity of the second equipment.
Optionally, the monitoring the number of service requests currently processed by the second device includes:
recording the service requests sent to the second equipment by using a first list, and deleting the service requests corresponding to the processing completion response in the service requests recorded in the first list after receiving the processing completion response returned by the second equipment;
and monitoring the number of the service requests currently recorded in the first list as the number of the service requests currently processed by the second device.
Optionally, the monitoring the number of service requests currently processed by the second device includes:
recording the service requests sent to the second equipment by using a first list, wherein each service request in the first list corresponds to a request state, and an initial request state corresponding to each service request is in processing;
after receiving a processing completion response returned by the second device, modifying a request state corresponding to a service request corresponding to the processing completion response in the service requests recorded in the first list into: finishing the treatment;
and monitoring the number of service requests with request states being processed in the service requests currently recorded in the first list as the number of service requests currently processed by the second device.
Optionally, the sending an unprocessed service request to the second device when it is determined that the number of service requests currently processed by the second device reaches a first preset number based on the number of service requests currently processed by the second device includes:
determining the difference between the number of service requests currently processed by the second device and a second preset number as the number N of service requests currently processed by the second device, wherein the second preset number is predetermined according to the service request processing capability of the second device;
and sending N unprocessed service requests to the second equipment, so that the number of the service requests currently processed by the second equipment is maintained at the second preset number.
Optionally, the method further includes:
recording a service request to be sent to the second device using a second list;
and deleting the service requests which are recorded in the second list and sent to the second equipment after the service requests in the second list are sent to the second equipment.
Optionally, before the step of monitoring the number of service requests currently processed by the second device, the method further includes:
and sending a first preset number of service requests to the second equipment.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims (10)
1. A request processing method applied to a first device, the first device being communicatively connected to a second device capable of processing a service request, the method comprising:
monitoring the number of service requests currently processed by the second device;
and sending unprocessed service requests to the second equipment under the condition that the number of the service requests processed by the second equipment currently reaches a first preset number based on the number of the service requests processed by the second equipment currently, wherein the sent unprocessed service requests are determined according to the service request processing capacity of the second equipment.
2. The method of claim 1, wherein the monitoring the number of service requests currently processed by the second device comprises:
recording the service requests sent to the second equipment by using a first list, and deleting the service requests corresponding to the processing completion response in the service requests recorded in the first list after receiving the processing completion response returned by the second equipment;
and monitoring the number of the service requests currently recorded in the first list as the number of the service requests currently processed by the second device.
3. The method of claim 1, wherein the monitoring the number of service requests currently processed by the second device comprises:
recording the service requests sent to the second equipment by using a first list, wherein each service request in the first list corresponds to a request state, and an initial request state corresponding to each service request is in processing;
after receiving a processing completion response returned by the second device, modifying a request state corresponding to a service request corresponding to the processing completion response in the service requests recorded in the first list into: finishing the treatment;
and monitoring the number of service requests with request states being processed in the service requests currently recorded in the first list as the number of service requests currently processed by the second device.
4. The method according to any one of claims 1 to 3, wherein in a case where it is determined that the number of service requests currently processed by the second device reaches a first preset number based on the number of service requests currently processed by the second device, sending unprocessed service requests to the second device comprises:
determining the difference between the number of service requests currently processed by the second device and a second preset number as the number N of service requests currently processed by the second device, wherein the second preset number is predetermined according to the service request processing capability of the second device;
and sending N unprocessed service requests to the second equipment, so that the number of the service requests currently processed by the second equipment is maintained at the second preset number.
5. The method of any of claims 1 to 4, further comprising:
recording a service request to be sent to the second device using a second list;
and deleting the service requests which are recorded in the second list and sent to the second equipment after the service requests in the second list are sent to the second equipment.
6. The method of claim 1, further comprising, prior to the step of monitoring the number of service requests currently being processed by the second device:
and sending the preset number of service requests to the second equipment.
7. A request processing apparatus, comprising:
the first processing unit is used for monitoring the number of service requests currently processed by the second equipment;
and a second processing unit, configured to send an unprocessed service request to the second device when it is determined that the number of service requests currently processed by the second device reaches a first preset number based on the number of service requests currently processed by the second device, where the number of sent unprocessed service requests is determined according to a service request processing capability of the second device.
8. The apparatus of claim 7, wherein the first processing unit comprises:
a deleting unit, configured to record, using a first list, the service request that has been sent to the second device, and delete, after receiving a processing completion response returned by the second device, a service request corresponding to the processing completion response in the service requests recorded in the first list;
and the monitoring unit is used for monitoring the number of the service requests currently recorded in the first list as the number of the service requests currently processed by the second equipment.
9. A storage medium characterized in that the storage medium includes a stored program,
wherein the program, when running, controls a device on which the storage medium is located to execute the request processing method according to any one of claims 1 to 6.
10. A processor, for running a program,
wherein the program when running performs the request processing method of any one of claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810681213.3A CN110650173B (en) | 2018-06-27 | 2018-06-27 | Request processing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810681213.3A CN110650173B (en) | 2018-06-27 | 2018-06-27 | Request processing method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110650173A CN110650173A (en) | 2020-01-03 |
CN110650173B true CN110650173B (en) | 2022-02-18 |
Family
ID=68988786
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810681213.3A Active CN110650173B (en) | 2018-06-27 | 2018-06-27 | Request processing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110650173B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH03100852A (en) * | 1989-09-14 | 1991-04-25 | Fujitsu Ltd | Controlling method for execution of service process |
JP2006302249A (en) * | 2005-03-23 | 2006-11-02 | Hitachi Ltd | Method for controlling management computer and method for controlling server |
CN101377763A (en) * | 2007-08-31 | 2009-03-04 | 株式会社瑞萨科技 | Data processing system |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP4503934B2 (en) * | 2002-09-26 | 2010-07-14 | 株式会社東芝 | Server computer protection device, server computer protection method, server computer protection program, and server computer |
US20050193113A1 (en) * | 2003-04-14 | 2005-09-01 | Fujitsu Limited | Server allocation control method |
-
2018
- 2018-06-27 CN CN201810681213.3A patent/CN110650173B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH03100852A (en) * | 1989-09-14 | 1991-04-25 | Fujitsu Ltd | Controlling method for execution of service process |
JP2006302249A (en) * | 2005-03-23 | 2006-11-02 | Hitachi Ltd | Method for controlling management computer and method for controlling server |
CN101377763A (en) * | 2007-08-31 | 2009-03-04 | 株式会社瑞萨科技 | Data processing system |
Also Published As
Publication number | Publication date |
---|---|
CN110650173A (en) | 2020-01-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107483351B (en) | Current limiting method and device | |
EP3399692B1 (en) | Method and apparatus for upgrading distributed storage system | |
CN109561128B (en) | Data transmission method and device | |
CN111580769B (en) | Display control system, method, device, storage medium and processor | |
CN111147313B (en) | Message abnormity monitoring method and device, storage medium and electronic equipment | |
CN110764930B (en) | Request or response processing method and device based on message mode | |
CN113595773B (en) | Information processing method, device, electronic equipment and storage medium | |
CN109495397B (en) | Flow control method and device | |
CN107979843B (en) | WiFi hotspot connection processing method, device and medium for terminal | |
CN110650173B (en) | Request processing method and device | |
CN110012093B (en) | Method and device for adjusting connection timeout | |
CN116204277A (en) | Business container expansion and contraction capacity adjustment method and device, storage medium and electronic equipment | |
CN111327499A (en) | Method and device for sending message and automobile | |
CN111491021B (en) | License data processing method and device for distributed cluster | |
CN108304200B (en) | Method and device for upgrading driving program and electronic equipment | |
CN111435925B (en) | Snapshot data transmission method and device | |
CN108270744B (en) | Media data access method and device | |
JP2017523505A (en) | Data processing method and system | |
CN110868333A (en) | Data caching method and system for gateway | |
CN110618863A (en) | Operation scheduling method based on Raft algorithm | |
CN107784040B (en) | File issuing method and device | |
CN110554922A (en) | System resource allocation method and device | |
CN112583862A (en) | Data concurrent processing method and device, storage medium and equipment | |
CN116112299B (en) | Configuration method, device and medium for POE system hot restart scene | |
CN111314303B (en) | Live broadcast system, and data processing method and device of live broadcast system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |