CN109241066B - Request processing method and device - Google Patents
Request processing method and device Download PDFInfo
- Publication number
- CN109241066B CN109241066B CN201710537730.9A CN201710537730A CN109241066B CN 109241066 B CN109241066 B CN 109241066B CN 201710537730 A CN201710537730 A CN 201710537730A CN 109241066 B CN109241066 B CN 109241066B
- Authority
- CN
- China
- Prior art keywords
- data
- request
- storage device
- data storage
- unit
- 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
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/4881—Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/48—Indexing scheme relating to G06F9/48
- G06F2209/483—Multiproc
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a request processing method and a device, which can return a first response for informing first equipment that the first request is successfully processed to the first equipment after obtaining the first request sent by the first equipment, and then process the first request. After the technical scheme of the invention is adopted, the equipment sending the request can receive the response that the request is successfully processed in a short time after the request is sent, and waiting is not needed, so that the waiting time of the equipment sending the request is reduced.
Description
Technical Field
The present invention relates to the field of information processing technologies, and in particular, to a request processing method and apparatus.
Background
With the development of science and technology, internet technology has been widely and deeply applied.
In many areas, a device is often required to process a large number of requests sent by other devices and to return a "successfully processed" response to the device sending the request after the request has been successfully processed. However, for some reason, the device often cannot successfully process some requests in a short time, which results in the failure to timely return a "successfully processed" response to the device that sent the request. In this case, a device that has not received a "successfully processed" response after sending a request will be in a wait state for a long time.
How to reduce the waiting time of the device sending the request is still a technical problem to be solved by those skilled in the art.
Disclosure of Invention
In view of the above, the present invention is proposed to provide a request processing method and apparatus that overcomes or at least partially solves the above problems, and the scheme is as follows:
a request processing method, comprising:
obtaining a first request sent by first equipment;
returning a first response to the first device, wherein the first response is used for informing the first device that the first request is processed successfully;
and processing the first request.
Optionally, after obtaining the first request sent by the first device and before processing the first request, the method further includes:
placing the first request in a request queue.
Optionally, the processing the first request includes:
one thread is selected from a plurality of threads to process the first request.
Optionally, the method is applied to a second device, where the second device is in communication connection with the first device, the second device is in communication connection with at least one data storage device, and the first request carries a first device identifier of the data storage device and first data used for data update;
the processing the first request includes:
acquiring a data version and stored data of a data storage device corresponding to the first device identifier;
comparing the first data with the obtained data stored in the data storage device to obtain a comparison result;
obtaining a data version of the data storage device corresponding to the first device identifier at the current moment, determining whether the obtained data version is consistent with the data version obtained last time, if so, updating the first data to the data storage device corresponding to the first device identifier according to the comparison result, and setting a new data version for the data storage device corresponding to the first device identifier;
otherwise, returning to execute the step of obtaining the data version and the stored data of the data storage device corresponding to the first device identification.
Optionally, the updating the first data to the data storage device corresponding to the first device identifier according to the comparison result includes:
and when the comparison result is a first result, updating the first data to the data storage device corresponding to the first device identifier, and adding a first identifier to the first data in the data storage device corresponding to the first device identifier.
A request processing apparatus comprising: a request obtaining unit, a response returning unit and a request processing unit,
the request obtaining unit is used for obtaining a first request sent by first equipment;
the response returning unit is used for returning a first response to the first device, and the first response is used for informing the first device that the first request is successfully processed;
the request processing unit is used for processing the first request.
Optionally, the apparatus further comprises:
the request queuing unit is used for putting the first request into a request queue after the request obtaining unit obtains the first request sent by the first device and before the request processing unit processes the first request.
Optionally, the request processing unit is specifically configured to:
one thread is selected from a plurality of threads to process the first request.
Optionally, the apparatus is applied to a second device, where the second device is in communication connection with the first device, the second device is in communication connection with at least one data storage device, and the first request carries a first device identifier of the data storage device and first data used for data update;
the request processing unit includes: a data obtaining unit, a data comparing unit, a version obtaining unit, a version comparing unit and a data updating unit,
the data obtaining unit is used for obtaining a data version of the data storage device corresponding to the first device identifier and stored data;
the data comparison unit is used for comparing the first data with the obtained data stored in the data storage device to obtain a comparison result;
the version obtaining unit is configured to obtain a data version of the data storage device corresponding to the first device identifier at the current time;
the version comparison unit is used for determining whether the data version obtained this time is consistent with the data version obtained last time, and if so, the data updating unit is triggered; otherwise, triggering the data acquisition unit;
and the data updating unit is used for updating the first data to the data storage device corresponding to the first device identifier according to the comparison result, and setting a new data version for the data storage device corresponding to the first device identifier.
Optionally, the data updating unit is specifically configured to: and when the comparison result is a first result, updating the first data to the data storage device corresponding to the first equipment identifier, adding the first identifier to the first data in the data storage device corresponding to the first equipment identifier, and setting a new data version for the data storage device corresponding to the first equipment identifier.
By means of the above technical solution, the method and the device for processing a request provided by the present invention can return a first response notifying the first device that the first request has been successfully processed to the first device after obtaining the first request sent by the first device, and then process the first request. After the technical scheme of the invention is adopted, the equipment sending the request can receive the response that the request is successfully processed in a short time after the request is sent, and waiting is not needed, so that the waiting time of the equipment sending the request 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 flow chart illustrating another request processing method according to an embodiment of the present invention;
FIG. 3 is a flow chart illustrating another request processing method according to an embodiment of the present invention;
FIG. 4 is a communication diagram of a device provided by an embodiment of the invention;
fig. 5 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.
As shown in fig. 1, a request processing method provided in an embodiment of the present invention may include:
s100, obtaining a first request sent by first equipment;
the first request may be of various types, such as a data acquisition request, a data upload request, a data update request, and the like.
The first device may be a terminal device, such as a computer, a mobile phone, a tablet computer, and the like.
S200, returning a first response to the first device, wherein the first response is used for informing the first device that the first request is successfully processed;
step S200 may return a first response to the first device after obtaining the first request sent by the first device in step S100, and inform the first device that the first request has been successfully processed, so as to reduce the waiting time of the first device.
And S300, processing the first request.
The process of processing the first request in step S300 may be the same as or different from the prior art. The following embodiments of the present invention will describe in detail the process of processing the first request in step S300 in a manner different from the prior art. Optionally, step S300 of the present invention may specifically include: one thread is selected from a plurality of threads to process the first request.
The invention improves the concurrent processing capability of the requests by using the multithreading technology, and can select threads in the multithreading to process each request respectively when a plurality of requests are obtained.
In the request processing method provided by the embodiment of the present invention, after obtaining the first request sent by the first device, a first response for notifying the first device that the first request has been successfully processed is returned to the first device, and then the first request is processed. After the technical scheme of the invention is adopted, the equipment sending the request can receive the response that the request is successfully processed in a short time after the request is sent, and waiting is not needed, so that the waiting time of the equipment sending the request is reduced.
As shown in fig. 2, another request processing method provided in the embodiment of the present invention may include:
s100, obtaining a first request sent by first equipment;
s110, the first request is put into a request queue.
The request queue may be a first-in-first-out queue.
Wherein step S110 may be performed between step S100 and step S300, namely: step S110 is performed after step S100 and step S110 is performed before step S300. The execution sequence of step S110 and step S200 is not limited in the present invention. Step S110 may be executed before step S200, that is, after the first request is successfully put into the request queue, a first response is returned to the first device, and if step S110 does not successfully put the first request into the request queue, the present invention may execute step S110 again or return a second response to the first device, where the second response is used to notify the first device to send the first request again.
Optionally, after step S110 is executed multiple times (e.g., 3 times), if the first request is not successfully put into the request queue, the present invention may return a second response to the first device.
Of course, step S110 may also be performed after step S200, i.e.: and after the first request is obtained, returning a first response to the first equipment, and after the first response is returned, putting the first request into a request queue. According to the scheme, the user does not need to wait for the first request to be successfully put into the request queue, and the waiting time of the user is further reduced.
S200, returning a first response to the first equipment, wherein the first response is used for informing the first equipment that the first request is successfully processed;
s310, selecting one thread from multiple threads to process the first request in the request queue.
The invention can process each request in the request queue by using multiple threads, and can effectively improve the request processing speed by using the multiple threads.
Step S100 and step S200 have already been described in the embodiment shown in fig. 1, and are not repeated. Step S310 is an optional specific implementation of step S300.
In another embodiment of the present invention, as shown in fig. 4, the method shown in fig. 1 may be applied to a second device 002, where the second device 002 is communicatively connected to the first device 001, the second device 002 is communicatively connected to at least one data storage device 003, and the first request carries a first device identifier of the data storage device and first data used for data update. As shown in fig. 3, step S300 in the embodiment shown in fig. 1 may include:
s301, obtaining a data version and stored data of the data storage device 003 corresponding to the first device identifier;
the second device 002 may be a request processing device, such as a server. Each data storage device 003 can be a storage node, which together form a distributed storage system.
Alternatively, the first data may be answers to test questions, and each storage node may store answers to one test question from a plurality of examiners, for example: the first storage node stores answers of a plurality of examiners to the first test question; the second storage node stores answers of a plurality of examiners to the second test question; the third storage node stores the answers of a plurality of examiners to the third test question, and so on.
After acquiring the answer to a test question made by the examiner, the first device 001 may determine the device identifier of the data storage device 003 corresponding to the test question, and then generate a first request according to the determined device identifier and the acquired answer, and send the first request to the second device 002.
S302, comparing the first data with the obtained data stored in the data storage device 003 to obtain a comparison result;
optionally, the test questions may be test questions without standard answers, so that the comparison result of whether the answer in the first request is the most answer among the answers stored in the data storage device 003 can be obtained when the comparison is performed in step S302. When the answer in the first request is the most answer in the answers stored in the data storage device 003 as a result of the comparison, it may be determined that the answer in the first request is a valid answer; otherwise, the answer in the first request is determined to be an invalid answer.
S303, acquiring a data version of the data storage device 003 corresponding to the first device identifier at the current time;
s304, determining whether the data version obtained this time is consistent with the data version obtained last time, if so, executing the step S305; otherwise, the process returns to step S301.
And S305, updating the first data to the data storage device 003 corresponding to the first device identifier according to the comparison result, and setting a new data version for the data storage device 003 corresponding to the first device identifier.
Wherein, every time the data storage device 003 updates data, the present invention can set a new data version for it, so as to identify the data of the current version.
Wherein, step S305 may specifically include:
and when the comparison result is a first result, updating the first data to the data storage device 003 corresponding to the first device identifier and adding a first identifier to the first data in the data storage device 003 corresponding to the first device identifier.
The first result may be that the answer in the first request is the most answer among the answers stored in the data storage device 003. The first identification may be a valid answer identification.
Because different versions of data may cause different data updating results, the present invention needs to determine whether the version of the data during updating is consistent with the version of the data acquired before comparing the data, and when the versions of the data during updating are consistent, the present invention can update the data. For example: when the answer to the test question is compared, the result of comparing the answer in the first request with the answer to the test question of different data versions may be different. The invention needs to compare the answers before updating the data, so the data can be updated only when the data version of the answer to the test question used for comparing the answers is consistent with the data version of the answer to the test question used for updating. Therefore, the accuracy of the comparison result of the answer to the test question obtained by the invention is ensured, and the misjudgment of the answer in the first request is avoided.
As shown in fig. 5, a request processing apparatus according to an embodiment of the present invention may include: a request obtaining unit 100, a response returning unit 200 and a request processing unit 300,
the request obtaining unit 100 is configured to obtain a first request sent by a first device;
the first request may be of various types, such as a data acquisition request, a data upload request, a data update request, and the like.
The first device may be a terminal device, such as a computer, a mobile phone, a tablet computer, and the like.
The response returning unit 200 is configured to return a first response to the first device, where the first response is used to notify the first device that the first request has been successfully processed;
the request processing unit 300 is configured to process the first request.
The request processing unit may be specifically configured to:
one thread is selected from a plurality of threads to process the first request.
The invention improves the concurrent processing capability of the requests by using the multithreading technology, and can select threads in multithreading to process each request respectively when a plurality of requests are obtained.
The request processing apparatus provided in the embodiment of the present invention may return, to the first device, a first response for notifying the first device that the first request has been successfully processed after obtaining the first request sent by the first device, and then process the first request. After the technical scheme of the invention is adopted, the equipment sending the request can receive the response that the request is successfully processed in a short time after the request is sent, and waiting is not needed, so that the waiting time of the equipment sending the request is reduced.
Optionally, the apparatus shown in fig. 5 may further include:
a request enqueuing unit, configured to, after the request obtaining unit 100 obtains the first request sent by the first device, put the first request into a request queue before the request processing unit 300 processes the first request.
The request queue may be a first-in-first-out queue.
In other embodiments of the present invention, the apparatus shown in fig. 5 may be applied to the second device 002 shown in fig. 4, as shown in fig. 4, the second device 002 is communicatively connected to the first device 001, the second device 002 is communicatively connected to at least one data storage device 003, and the first request carries the first device identifier of the data storage device 003 and the first data for data update;
the request processing unit 300 may include: a data obtaining unit, a data comparing unit, a version obtaining unit, a version comparing unit and a data updating unit,
the data obtaining unit is configured to obtain a data version and stored data of the data storage device 003 corresponding to the first device identifier;
the second device 002 may be a request processing device, such as a server. Each data storage device 003 can be a storage node, which together form a distributed storage system.
Alternatively, the first data may be answers to test questions, and each storage node may store answers to one test question from a plurality of examiners, for example: the first storage node stores answers of a plurality of examiners to the first test question; the second storage node stores answers of a plurality of examiners to the second test question; the third storage node stores the answers of a plurality of examiners to the third test question, and so on.
After acquiring an answer to a test question made by an examiner, the first device 001 may determine the device identifier of the data storage device 003 corresponding to the test question, and then generate a first request according to the determined device identifier and the acquired answer and send the first request to the second device 002.
The data comparison unit is used for comparing the first data with the obtained data stored in the data storage device 003 to obtain a comparison result;
optionally, the test questions may be test questions without standard answers, so that the data comparison unit may obtain a comparison result of whether the answer in the first request is the most answer among the answers stored in the data storage device 003 when performing the comparison. When the answer in the first request is the most answer in the answers stored in the data storage device 003 as a result of the comparison, it may be determined that the answer in the first request is a valid answer; otherwise, the answer in the first request is determined to be an invalid answer.
The version obtaining unit is configured to obtain a data version of the data storage device 003 corresponding to the first device identifier at the current time;
the version comparison unit is used for determining whether the data version obtained this time is consistent with the data version obtained last time, and if so, the data updating unit is triggered; otherwise, triggering the data acquisition unit;
and the data updating unit is configured to update the first data to the data storage device 003 corresponding to the first device identifier according to the comparison result, and set a new data version for the data storage device 003 corresponding to the first device identifier.
Wherein, every time the data storage device 003 updates data, the present invention can set a new data version for it, so as to identify the data of the current version.
Optionally, the data updating unit may be specifically configured to: and when the comparison result is a first result, updating the first data to the data storage device 003 corresponding to the first device identifier, adding the first identifier to the first data in the data storage device 003 corresponding to the first device identifier, and setting a new data version for the data storage device 003 corresponding to the first device identifier.
The first result may be that the answer in the first request is the most answer among the answers stored in the data storage device 003. The first identification may be a valid answer identification.
Because different versions of data may cause different data updating results, the present invention needs to determine whether the version of the data during updating is consistent with the version of the data acquired before comparing the data, and when the versions of the data during updating are consistent, the present invention can update the data. For example: when the answer to the test question is compared, the result of the comparison between the answer in the first request and the answer to the test question of different data versions may be different. The invention needs to compare the answers before updating the data, so the data can be updated only when the data version of the answer to the test question used for comparing the answers is consistent with the data version of the answer to the test question used for updating. Therefore, the accuracy of the comparison result of the answer to the test question obtained by the invention is ensured, and the misjudgment of the answer in the first request is avoided.
The request processing device comprises a processor and a memory, wherein the request obtaining unit, the response returning unit, the request processing unit, the request listing 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 set one or more, and the request is processed by adjusting the kernel parameters.
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:
obtaining a first request sent by first equipment;
returning a first response to the first device, wherein the first response is used for informing the first device that the first request is processed successfully;
and processing the first request.
Optionally, after obtaining the first request sent by the first device and before processing the first request, the method further includes:
placing the first request in a request queue.
Optionally, the processing the first request includes:
one thread is selected from a plurality of threads to process the first request.
Optionally, the method is applied to a second device, where the second device is in communication connection with the first device, and the second device is in communication connection with at least one data storage device, and the first request carries a first device identifier of the data storage device and first data used for data update;
the processing the first request includes:
acquiring a data version and stored data of a data storage device corresponding to the first device identifier;
comparing the first data with the obtained data stored in the data storage device to obtain a comparison result;
obtaining a data version of the data storage device corresponding to the first device identifier at the current moment, determining whether the obtained data version is consistent with the data version obtained last time, if so, updating the first data to the data storage device corresponding to the first device identifier according to the comparison result, and setting a new data version for the data storage device corresponding to the first device identifier;
otherwise, returning to execute the step of obtaining the data version and the stored data of the data storage device corresponding to the first device identification.
Optionally, the updating the first data to the data storage device corresponding to the first device identifier according to the comparison result includes:
and when the comparison result is a first result, updating the first data to the data storage device corresponding to the first device identifier, and adding a first identifier to the first data in the data storage device corresponding to the first device identifier.
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:
obtaining a first request sent by first equipment;
returning a first response to the first device, wherein the first response is used for informing the first device that the first request is processed successfully;
and processing the first request.
Optionally, after obtaining the first request sent by the first device and before processing the first request, the method further includes:
placing the first request in a request queue.
Optionally, the processing the first request includes:
one thread is selected from a plurality of threads to process the first request.
Optionally, the method is applied to a second device, where the second device is in communication connection with the first device, the second device is in communication connection with at least one data storage device, and the first request carries a first device identifier of the data storage device and first data used for data update;
the processing the first request includes:
acquiring a data version and stored data of a data storage device corresponding to the first device identifier;
comparing the first data with the obtained data stored in the data storage device to obtain a comparison result;
obtaining a data version of the data storage device corresponding to the first device identifier at the current moment, determining whether the obtained data version is consistent with the data version obtained last time, if so, updating the first data to the data storage device corresponding to the first device identifier according to the comparison result, and setting a new data version for the data storage device corresponding to the first device identifier;
otherwise, returning to execute the step of obtaining the data version and the stored data of the data storage device corresponding to the first device identification.
Optionally, the updating the first data to the data storage device corresponding to the first device identifier according to the comparison result includes:
and when the comparison result is a first result, updating the first data to the data storage device corresponding to the first equipment identifier, and adding the first identifier to the first data in the data storage device corresponding to the first equipment identifier.
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 Disks (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which 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 so forth) 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 to which the present application pertains. 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 (6)
1. A method for processing a request, comprising:
obtaining a first request sent by first equipment;
returning a first response to the first device, wherein the first response is used for informing the first device that the first request is processed successfully;
processing the first request;
the method is applied to a second device, the second device is in communication connection with the first device, the second device is in communication connection with at least one data storage device, and the first request carries a first device identifier of the data storage device and first data for data updating;
the processing the first request includes:
acquiring a data version and stored data of a data storage device corresponding to the first device identifier;
comparing the first data with the obtained data stored in the data storage device to obtain a comparison result;
obtaining a data version of the data storage device corresponding to the first device identifier at the current moment, determining whether the obtained data version is consistent with the data version obtained last time, if so, updating the first data to the data storage device corresponding to the first device identifier according to the comparison result, and setting a new data version for the data storage device corresponding to the first device identifier;
otherwise, returning to the step of obtaining the data version of the data storage device corresponding to the first device identifier and the stored data;
the updating the first data to the data storage device corresponding to the first device identifier according to the comparison result includes:
and when the comparison result is a first result, updating the first data to the data storage device corresponding to the first equipment identifier, and adding the first identifier to the first data in the data storage device corresponding to the first equipment identifier.
2. The method of claim 1, wherein after obtaining the first request sent by the first device and before processing the first request, the method further comprises:
placing the first request in a request queue.
3. The method of claim 1 or 2, wherein the processing the first request comprises:
one thread is selected from a plurality of threads to process the first request.
4. A request processing apparatus, comprising: a request obtaining unit, a response returning unit and a request processing unit,
the request obtaining unit is used for obtaining a first request sent by first equipment;
the response returning unit is used for returning a first response to the first device, and the first response is used for informing the first device that the first request is successfully processed;
the request processing unit is used for processing the first request;
the device is applied to a second device, the second device is in communication connection with the first device, the second device is in communication connection with at least one data storage device, and the first request carries a first device identifier of the data storage device and first data for data updating;
the request processing unit includes: a data obtaining unit, a data comparing unit, a version obtaining unit, a version comparing unit and a data updating unit,
the data obtaining unit is used for obtaining a data version and stored data of the data storage device corresponding to the first device identifier;
the data comparison unit is used for comparing the first data with the obtained data stored in the data storage device to obtain a comparison result;
the version obtaining unit is configured to obtain a data version of the data storage device corresponding to the first device identifier at the current time;
the version comparison unit is used for determining whether the data version obtained this time is consistent with the data version obtained last time, and if so, the data updating unit is triggered; otherwise, triggering the data acquisition unit;
the data updating unit is used for updating the first data to the data storage device corresponding to the first equipment identifier according to the comparison result and setting a new data version for the data storage device corresponding to the first equipment identifier;
the data updating unit is specifically configured to: and when the comparison result is a first result, updating the first data to the data storage device corresponding to the first equipment identifier, adding the first identifier to the first data in the data storage device corresponding to the first equipment identifier, and setting a new data version for the data storage device corresponding to the first equipment identifier.
5. The apparatus of claim 4, further comprising:
the request queuing unit is used for putting the first request into a request queue after the request obtaining unit obtains the first request sent by the first device and before the request processing unit processes the first request.
6. The apparatus according to claim 4 or 5, wherein the request processing unit is specifically configured to:
one thread is selected from a plurality of threads to process the first request.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710537730.9A CN109241066B (en) | 2017-07-04 | 2017-07-04 | Request processing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710537730.9A CN109241066B (en) | 2017-07-04 | 2017-07-04 | Request processing method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109241066A CN109241066A (en) | 2019-01-18 |
CN109241066B true CN109241066B (en) | 2022-09-27 |
Family
ID=65083316
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710537730.9A Active CN109241066B (en) | 2017-07-04 | 2017-07-04 | Request processing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109241066B (en) |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101789009A (en) * | 2010-01-26 | 2010-07-28 | 恒生电子股份有限公司 | Method for processing business data, device and system |
CN104331306A (en) * | 2014-10-14 | 2015-02-04 | 北京齐尔布莱特科技有限公司 | Content updating method, equipment and system |
CN104572845A (en) * | 2014-12-12 | 2015-04-29 | 百度在线网络技术(北京)有限公司 | File distribution method and device, equipment and system |
CN104717260A (en) * | 2013-12-16 | 2015-06-17 | 中国移动通信集团公司 | Development resource updating and management method, device, system and related equipment |
CN104813685A (en) * | 2012-09-22 | 2015-07-29 | 谷歌公司 | Subscription-notification mechanisms for synchronization of distributed states |
CN104866290A (en) * | 2014-02-24 | 2015-08-26 | 国际商业机器公司 | Method and device for data transmission |
CN105812483A (en) * | 2016-04-20 | 2016-07-27 | 努比亚技术有限公司 | Method and server for updating application and mobile terminal |
CN105988949A (en) * | 2015-02-15 | 2016-10-05 | 阿里巴巴集团控股有限公司 | Terminal equipment and data interactive processing method and system |
US9563900B1 (en) * | 2013-09-27 | 2017-02-07 | Groupon, Inc. | Method, apparatus, and computer program product for consumer tracking |
Family Cites Families (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2007329617A (en) * | 2006-06-07 | 2007-12-20 | Nippon Telegr & Teleph Corp <Ntt> | Communication control process executing method and system, and program therefor |
CN102646072B (en) * | 2012-02-28 | 2014-10-29 | 信雅达系统工程股份有限公司 | Data management method |
CN103237060B (en) * | 2013-04-08 | 2016-01-20 | 小米科技有限责任公司 | A kind of data object acquisition, Apparatus and system |
KR101775569B1 (en) * | 2013-11-06 | 2017-09-19 | 인텔 코포레이션 | Virtual retry queue |
CN103617009A (en) * | 2013-12-10 | 2014-03-05 | 北京奇虎科技有限公司 | Method and device for writing data to disk through cache during starting up |
GB2527296A (en) * | 2014-06-16 | 2015-12-23 | Ibm | A method for restoring data in a HSM system |
CN105095489A (en) * | 2015-08-18 | 2015-11-25 | 浪潮(北京)电子信息产业有限公司 | Distributed file deletion method, device and system |
CN106210045A (en) * | 2016-07-11 | 2016-12-07 | 浪潮(北京)电子信息产业有限公司 | A kind of SCST and data processing method thereof |
-
2017
- 2017-07-04 CN CN201710537730.9A patent/CN109241066B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101789009A (en) * | 2010-01-26 | 2010-07-28 | 恒生电子股份有限公司 | Method for processing business data, device and system |
CN104813685A (en) * | 2012-09-22 | 2015-07-29 | 谷歌公司 | Subscription-notification mechanisms for synchronization of distributed states |
US9563900B1 (en) * | 2013-09-27 | 2017-02-07 | Groupon, Inc. | Method, apparatus, and computer program product for consumer tracking |
CN104717260A (en) * | 2013-12-16 | 2015-06-17 | 中国移动通信集团公司 | Development resource updating and management method, device, system and related equipment |
CN104866290A (en) * | 2014-02-24 | 2015-08-26 | 国际商业机器公司 | Method and device for data transmission |
CN104331306A (en) * | 2014-10-14 | 2015-02-04 | 北京齐尔布莱特科技有限公司 | Content updating method, equipment and system |
CN104572845A (en) * | 2014-12-12 | 2015-04-29 | 百度在线网络技术(北京)有限公司 | File distribution method and device, equipment and system |
CN105988949A (en) * | 2015-02-15 | 2016-10-05 | 阿里巴巴集团控股有限公司 | Terminal equipment and data interactive processing method and system |
CN105812483A (en) * | 2016-04-20 | 2016-07-27 | 努比亚技术有限公司 | Method and server for updating application and mobile terminal |
Also Published As
Publication number | Publication date |
---|---|
CN109241066A (en) | 2019-01-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10439937B2 (en) | Service addressing in distributed environment | |
CN108255620B (en) | Service logic processing method, device, service server and system | |
CN106844055B (en) | Task execution method and device | |
CN104572448A (en) | Method and device for realizing use condition of thread stack | |
CN111580769B (en) | Display control system, method, device, storage medium and processor | |
CN111831411B (en) | Task processing method and device, storage medium and electronic equipment | |
CN117035452A (en) | Root cause positioning method and system of business scene and electronic equipment | |
CN110764930B (en) | Request or response processing method and device based on message mode | |
CN109977317B (en) | Data query method and device | |
CN109388564B (en) | Test method and device and electronic equipment | |
CN110837446A (en) | Equipment management method and device applied to embedded system, medium and embedded equipment | |
CN108268369B (en) | Test data acquisition method and device | |
CN109558249B (en) | Control method and device for concurrent operation | |
CN109241066B (en) | Request processing method and device | |
CN109582396B (en) | Task state processing method, device and system and storage medium | |
CN111079390B (en) | Method and device for determining selection state of check box list | |
CN112907198B (en) | Service state circulation maintenance method and device and electronic equipment | |
CN111400245B (en) | Art resource migration method and device | |
CN109688578B (en) | Method and equipment for adapting SIM card and mobile terminal equipment | |
CN110955847B (en) | Information processing method, device, storage medium and processor | |
CN110149356A (en) | Method and device is uniformly processed in a kind of network request abnormality | |
CN110909071A (en) | Data synchronization method, device and system | |
CN112579189A (en) | Configuration file updating method and device | |
CN107678838B (en) | Method and device for tracking operation of virtual machine and virtual machine management platform | |
CN109428915B (en) | Data acquisition method and device |
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 | ||
CB02 | Change of applicant information |
Address after: 100080 No. 401, 4th Floor, Haitai Building, 229 North Fourth Ring Road, Haidian District, Beijing Applicant after: BEIJING GRIDSUM TECHNOLOGY Co.,Ltd. Address before: 100086 Cuigong Hotel, 76 Zhichun Road, Shuangyushu District, Haidian District, Beijing Applicant before: BEIJING GRIDSUM TECHNOLOGY Co.,Ltd. |
|
CB02 | Change of applicant information | ||
GR01 | Patent grant | ||
GR01 | Patent grant |