CN113282854A - Data request response method and device, electronic equipment and storage medium - Google Patents
Data request response method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN113282854A CN113282854A CN202110607873.9A CN202110607873A CN113282854A CN 113282854 A CN113282854 A CN 113282854A CN 202110607873 A CN202110607873 A CN 202110607873A CN 113282854 A CN113282854 A CN 113282854A
- Authority
- CN
- China
- Prior art keywords
- request
- data request
- key value
- response
- data
- 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.)
- Pending
Links
- 230000004044 response Effects 0.000 title claims abstract description 240
- 238000000034 method Methods 0.000 title claims abstract description 38
- 230000006870 function Effects 0.000 claims description 15
- 238000012545 processing Methods 0.000 claims description 8
- 238000004458 analytical method Methods 0.000 claims description 7
- 238000004590 computer program Methods 0.000 claims description 7
- 230000011218 segmentation Effects 0.000 claims description 7
- 238000000605 extraction Methods 0.000 claims description 6
- 238000012163 sequencing technique Methods 0.000 claims description 6
- 238000000926 separation method Methods 0.000 claims description 3
- 238000005516 engineering process Methods 0.000 abstract description 4
- 238000012423 maintenance Methods 0.000 abstract description 3
- NJPPVKZQTLUDBO-UHFFFAOYSA-N novaluron Chemical compound C1=C(Cl)C(OC(F)(F)C(OC(F)(F)F)F)=CC=C1NC(=O)NC(=O)C1=C(F)C=CC=C1F NJPPVKZQTLUDBO-UHFFFAOYSA-N 0.000 abstract description 2
- 238000004891 communication Methods 0.000 description 7
- 238000007726 management method Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 230000005540 biological transmission Effects 0.000 description 2
- 238000001514 detection method Methods 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 238000012015 optical character recognition Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/957—Browsing optimisation, e.g. caching or content distillation
- G06F16/9574—Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/958—Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
-
- 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/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/548—Queue
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Software Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention relates to a pedestal operation and maintenance technology, and discloses a data request response method, which comprises the following steps: analyzing a request parameter in the data request, and generating a request key value according to the request parameter; searching in a preset response file queue according to the request key value to obtain a search key value; if the retrieval key value is different from the request key value, the data request is forwarded to the server, and a response file returned by the server to the data request is obtained; caching the response file to a response file queue by using a request key value, and responding the data request according to the sequence of the response file in the response file queue; and if the retrieval key value is the same as the request key value, responding the data request by utilizing a response file corresponding to the retrieval key value in the response file queue. In addition, the invention also relates to a block chain technology, and the resource data can be stored in the nodes of the block chain. The invention also provides a data request response device, equipment and a medium. The invention can solve the problem of low efficiency of the server for responding to the multi-data request.
Description
Technical Field
The present invention relates to the field of pedestal operation and maintenance technologies, and in particular, to a data request response method and apparatus, an electronic device, and a computer-readable storage medium.
Background
When people use the network to browse data in daily life, most of the data stored in the server at the back end is accessed by using the front-end data request to acquire the data, but the load is too large when the server responds to the data request due to the increasing number of network users, and then the situation of downtime occurs, so that the problem that how to reduce the load when the server responds to a large number of data requests is urgently solved is solved.
The existing methods for reducing server response load mostly construct concurrent servers to distribute a large amount of data requests and respectively respond the data requests, but in the method, a plurality of concurrent servers need to be added, the load of a single server is reduced, and meanwhile, the multiple servers need more computing resource support, the operation and maintenance cost of the multiple concurrent servers is high, and the problem that the response load is too high, and the response efficiency of the data requests is low cannot be fundamentally solved.
Disclosure of Invention
The invention provides a data request response method, a data request response device and a computer readable storage medium, and mainly aims to solve the problem that the response efficiency of a server to multiple data requests is low.
In order to achieve the above object, the present invention provides a data request response method, including:
acquiring a data request, analyzing a request parameter in the data request, and generating a request key value according to the request parameter;
searching in a preset response file queue according to the request key value to obtain a search key value;
if the retrieval key value is different from the request key value, the data request is forwarded to a server, and a response file returned by the server to the data request is obtained;
caching the response file to the response file queue by using the request key value, and responding to the data request according to the sequence of the response file in the response file queue;
and if the retrieval key value is the same as the request key value, responding to the data request by using a response file corresponding to the retrieval key value in the response file queue.
Optionally, the parsing the request parameter in the data request includes:
detecting whether the data request contains a message field;
when the data request contains a message field, performing deserialization processing on the data request to obtain a request parameter;
and when the data request does not contain a message field, carrying out character string segmentation on the data request to obtain a request parameter.
Optionally, the deserializing the data request to obtain a request parameter includes:
extracting the data content type in the data request;
selecting a decoder corresponding to the data content type to perform deserialization on the data request to obtain data content;
and performing parameter analysis on the data content to obtain a request parameter.
In this embodiment, the data content type in the data request may be extracted using a computer sentence having a data content type extraction function.
Optionally, the performing character string segmentation on the data request to obtain a request parameter includes:
dividing the data request according to a preset character string separation symbol, and numbering the divided character strings according to the positions of the divided character strings in the data request;
and analyzing the character string at the preset position in the data request to obtain a request parameter.
Optionally, the retrieving in a preset response file queue according to the request key value to obtain a retrieval key value includes:
according to the file names of all response files in a preset response file queue, constructing an index of the response file queue;
and retrieving in the response file queue according to the request key value and the index to obtain a retrieval key value.
Optionally, the forwarding the data request to a server includes:
extracting the IP address of the responder in the data request;
compiling a request forwarding instruction according to the IP address of the responder;
and forwarding the data request to a server corresponding to the IP address of the responder by using the request forwarding instruction.
Optionally, the caching the response file to the response file queue by using the request key value includes:
when a response file returned by the server to the data request is acquired, recording the acquisition time of the response file by using a preset clock program, and naming the response file by using the request key value;
and sequencing the response files according to the sequence of the acquisition time from front to back, and writing the corresponding files into the response file queue according to the sequencing sequence.
In order to solve the above problem, the present invention also provides a data request response apparatus, including:
the request analysis module is used for acquiring a data request, analyzing request parameters in the data request and generating a request key value according to the request parameters;
the file retrieval module is used for retrieving in a preset response file queue according to the request key value to obtain a retrieval key value;
a response file obtaining module, configured to forward the data request to a server if the retrieval key value is different from the request key value, and obtain a response file returned by the server to the data request;
the first response module is used for caching the response file to the response file queue by using the request key value and responding the data request according to the sequence of the response file in the response file queue;
and the second response module is used for responding to the data request by using a response file corresponding to the retrieval key value in the response file queue if the retrieval key value is the same as the request key value.
In order to solve the above problem, the present invention also provides an electronic device, including:
a memory storing at least one instruction; and
and the processor executes the instructions stored in the memory to realize the data request response method.
In order to solve the above problem, the present invention further provides a computer-readable storage medium, which stores at least one instruction, where the at least one instruction is executed by a processor in an electronic device to implement the data request response method described above.
According to the embodiment of the invention, the obtained data request is judged, when the response file corresponding to the data request exists in the response file queue, the response file is utilized to respond to the data request, and when the response file corresponding to the data request does not exist in the response file queue, the response file of the server to the request is obtained and stored in the file cache queue, so that the data request is responded according to the sequence of the response files in the file response queue, the server is prevented from responding to a large number of data requests at the same time, the load of the server in response is reduced, and the response efficiency of the server to the data request is improved. Therefore, the data request response method, the data request response device, the electronic equipment and the computer readable storage medium provided by the invention can solve the problem of low efficiency of the server in responding to multiple data requests.
Drawings
Fig. 1 is a schematic flowchart of a data request response method according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of deserialization processing according to an embodiment of the present invention;
fig. 3 is a schematic flow chart of forwarding a data request according to an embodiment of the present invention;
FIG. 4 is a functional block diagram of a data request response apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device implementing the data request response method according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the application provides a data request response method. The execution subject of the data request response method includes, but is not limited to, at least one of electronic devices such as a server and a terminal that can be configured to execute the method provided by the embodiments of the present application. In other words, the data request response method may be performed by software or hardware installed in the terminal device or the server device, and the software may be a block chain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
Fig. 1 is a schematic flow chart of a data request response method according to an embodiment of the present invention. In this embodiment, the data request response method includes:
s1, acquiring the data request, analyzing the request parameter in the data request, and generating a request key value according to the request parameter.
In the embodiment of the present invention, the data request is a request for accessing data to a server, for example, a request sent by a user to the server for accessing data stored in the server, or in a distributed scenario, to implement a service function, a request sent by an application to the server for accessing data stored in the server.
In one practical application scenario of the present invention, because the types of the data request can be divided into two types (Get request and Post request), and the processing manners required by different types of data requests are different, the embodiment of the present invention can determine the type of the data request by performing type identification on the data request, and analyze the data request according to different types, which is beneficial to improving the accuracy of analyzing and obtaining the request parameters in the data request.
In the embodiment of the invention, the Get request is transmitted through the address bar, and the Post request is transmitted through the message, so that whether the data request contains a message field or not can be judged, if the data request contains the message field, the data request is determined to be the Post request, and if the data request does not contain the message field, the data request is determined to be the Get request.
In an embodiment of the present invention, the analyzing the request parameter in the data request includes:
detecting whether the data request contains a message field;
when the data request contains a message field, performing deserialization processing on the data request to obtain a request parameter;
and when the data request does not contain a message field, carrying out character string segmentation on the data request to obtain a request parameter.
In detail, the request parameters include, but are not limited to, request data type, requester IP address, responder IP address, response data type, response interface name, etc.,
specifically, whether the data request contains a message field can be detected through a computer sentence (java sentence and python sentence) with a message field detection function;
or, performing message field extraction on the data request by using a computation statement with a field extraction function, if the message field cannot be extracted from the data request, determining that the data request does not contain the message field, and if the message field can be extracted from the data request, determining that the data request contains the message field.
For example, a computation statement with a field extraction function is used to extract a message field from the data request, if the return value is NULL (e.g., NULL), it is determined that the message field cannot be extracted from the data request, and it is determined that the message field is not included in the data request, and if the return value is not NULL (e.g., a character string), it is determined that the message field can be extracted from the data request, and it is determined that the message field is included in the data request.
In the embodiment of the present invention, as shown in fig. 2, the deserializing the data request to obtain the request parameter includes:
s21, extracting the data content type in the data request;
s21, selecting a decoder corresponding to the data content type to perform deserialization on the data request to obtain data content;
and S21, performing parameter analysis on the data content to obtain request parameters.
In this embodiment, the data content type in the data request may be extracted using a computer sentence having a data content type extraction function.
In detail, the data content type is a content-type of the data request, and the data content type is used for indicating a data type of data carried by a message field in the data request.
For example, when the data request is an image verification code requesting to log in a ticket purchasing website, the data type is an image; alternatively, the data type is text when the data request is an account and password requesting login to the payment website.
Specifically, when the Post request is used for data transmission, the transmitted data may be in the form of a binary byte stream in the message field of the Post request, so as to implement data access from the Post request to the server according to the message field, and therefore, a preset decoder may be used to perform deserialization on the data request including the message field in the form of the binary byte stream, so as to convert the data in the message field in the data request into an initial state.
In this embodiment, the decoder corresponding to the data content type is selected to deserialize the data request, so that the deserialization efficiency of the data request can be improved.
For example, when a user logs in a certain page, a user name and a user password form a message field of a Post request in a binary byte stream mode, so that when the Post request requests to log in the page, the page responds to the log-in according to the user name and the user password in the message field of the Post request; the data request can be deserialized using a decoder with deserialization of the text type data to convert the user name and user password in the form of a binary byte stream into data content in text form.
In this embodiment, after the data content is obtained, a preset model may be used to perform parameter analysis on the data content to obtain a request parameter.
For example, when the data content is a text type, the data content may be analyzed by using a NLP (neural-linear Programming) model to obtain a request parameter in the data content; when the data content is of an image type, analyzing the data content by utilizing an Optical Character Recognition (OCR) model to acquire a request parameter in the data content; when the data content is of an audio type, the data content may be analyzed by using an ASR (Automatic Speech Recognition) model to obtain a request parameter in the data content.
Further, when the data request does not include a message field, the embodiment of the present invention may obtain the request parameter by performing string segmentation on the data request.
In the embodiment of the present invention, the performing string segmentation on the data request to obtain a request parameter includes:
dividing the data request according to a preset character string separation symbol, and numbering the divided character strings according to the positions of the divided character strings in the data request;
and analyzing the character string at the preset position in the data request to obtain a request parameter.
In detail, the string separating symbol may be predefined by a user, and the string separating symbol is used to separate different strings in a data request.
For example, there is a data request dqw < dfqwf <4r3fcf < fwq, where "<" is the string break symbol, and thus the data request can be split by the string break symbol into: dqw, dfqwf, 4r3fcf, and fwq.
Because the data request is often generated according to a set standard protocol (HTTP protocol, RDP protocol, etc.), the meaning of the character string expression at different positions in the data request is relatively fixed, and the data request can be further divided and the character string at the preset position can be analyzed to obtain the request parameter.
For example, there is a data request dqw < dfqwf <4r3fcf < fwq, and numbering the partitioned strings according to their positions in the data request may result in: 1: dqw, 2: dfqwf: 3: 4r3fcf and 4: fwq, wherein the second character string and the fourth character string are character strings containing request parameters, so the parser can be used to parse the character string at the preset position in the data request to obtain the request parameters.
Further, in the embodiment of the present invention, a request key is generated according to the request parameter, and the request key may be used to mark a corresponding file returned by the server according to the data request. Therefore, when multiple data requests simultaneously request the server, the response to each data request is accurately realized.
In the embodiment of the invention, the request key value can be generated by splicing the request parameters.
For example, if there would be a request parameter a, a request parameter B, and a request parameter C, the request parameters may be concatenated as: and A-B-C, and using the spliced A-B-C as a request key value of the data request.
And S2, retrieving in a preset response file queue according to the request key value to obtain a retrieval key value.
In one practical application scenario of the present invention, when a server receives a large number of data requests in a short time, in order to reduce the load of the server, response files of the server for the data requests are cached in a pre-constructed response file queue, and the response files in the response file queue are gradually used for responding to the data requests, so as to prevent the server from being down due to an excessive load.
In detail, the response file queue includes a plurality of response files, and each response file is named by a request key value of a data request corresponding to the response file.
The embodiment of the invention can retrieve in the response file queue according to the request key value to obtain the retrieval key value returned by the retrieval, and the retrieval key value can be used for judging whether the response file queue contains the response file named by the request key value.
In the embodiment of the present invention, the retrieving in the preset response file queue according to the request key value to obtain a retrieval key value includes:
according to the file names of all response files in a preset response file queue, constructing an index of the response file queue;
and retrieving in the response file queue according to the request key value and the index to obtain a retrieval key value.
Illustratively, the INDEX of the response file queue may be built using the CREATE INDEX statement in the SQL library as follows:
CREATE INDEX index_name
ON table_name(column_name)
the index _ name is an index name, the table _ name is the name of the response file queue, and the column _ name is the name of the data column to be indexed in the response file queue.
For example, it is sufficient to construct an INDEX for the response file queue by using the above CREATE INDEX statement, and the name of each response file in the response file queue can be obtained as the INDEX, and then a search key value is obtained by using the request key value and the INDEX to perform a search in the response file queue.
And S3, judging whether the retrieval key value is the same as the request key value, if the retrieval key value is different from the request key value, executing S4, forwarding the data request to a server, and acquiring a response file returned by the server to the data request.
In the embodiment of the present invention, the search key value may be compared with the request key value, and if the search key value is different from the request key value, it indicates that the response file queue does not include a response file named by the request key value, that is, there is no response file in the response file queue that can respond to the data request corresponding to the request key value.
At this time, the embodiment of the present invention forwards the data request to the server, and obtains a response file generated by the server for the data request.
In this embodiment of the present invention, referring to fig. 3, the forwarding the data request to the server includes:
s31, extracting the IP address of the responder in the data request;
s31, compiling a request forwarding instruction according to the IP address of the responder;
and S31, forwarding the data request to a server corresponding to the IP address of the responder by using the request forwarding instruction.
In detail, the IP address of the requester is the IP address of the server that the data request wants to access, and the data request can be parsed to extract the IP address of the responder in the data request through the step of parsing the request parameters in the data request as in S1.
And after the IP address of the responder is obtained, the IP address of the responder can be compiled into a request forwarding instruction by using a preset compiler, the data request is forwarded to a server corresponding to the IP address of the responder by using the request forwarding instruction, and a response file generated by the server for the data request is obtained.
Specifically, the Compiler includes, but is not limited to, GNU Compiler Collection Compiler, Microsoft C Compiler, Turbo C Compiler.
S5, caching the response file to the response file queue by using the request key value, and responding the data request according to the sequence of the response file in the response file queue.
In the embodiment of the present invention, the corresponding files may be cached in the response file queue according to the time sequence of obtaining the response files generated by the server for the data request.
In this embodiment of the present invention, the caching the response file to the response file queue using the request key includes:
when a response file returned by the server to the data request is acquired, recording the acquisition time of the response file by using a preset clock program, and naming the response file by using the request key value;
and sequencing the response files according to the sequence of the acquisition time from front to back, and writing the corresponding files into the response file queue according to the sequencing sequence.
In detail, the clock program may be a computer program having a timestamp generation function, and may generate a timestamp by using a current system time when a response file is acquired, so as to record the acquisition time of the response file, and further write the response file into the response file queue according to the acquisition time.
For example, the obtained response file includes: the method comprises the following steps of responding to a file A, a file B, a file C and a file D, wherein the obtaining time of the file A is 8:00, the obtaining time of the file B is 9:00, the obtaining time of the file C is 7:00, and the obtaining time of the file D is 10:00, and then the response files can be obtained according to the obtaining time: and caching the response file C, the response file A, the response file B and the response file D to the response file queue in sequence.
When the response file is obtained, the request key value is used for naming the response file, so that the response file can correspond to the data request, and the accuracy of responding to the data request by using the response file is improved.
Further, in responding to data requests, the data requests may be responded to in the order of the response files in the response file queue.
For example, a response file a, a response file B and a response file C sequentially exist in a response file queue from front to back, when a data request is corresponding to a response file in the response file queue, the response file a is selected first, a data request having the same request key value as the response file a is queried according to the file name (request key value) of the response file a, the data request is responded by the response file a, and the data requests of the response file B and the response file C are sequentially responded according to the method.
And if the retrieval key value is the same as the request key value, executing S6, and responding to the data request by using a response file corresponding to the retrieval key value in the response file queue.
In the embodiment of the present invention, if the search key value is the same as the request key value, it indicates that the response file queue includes a response file named by the request key value, that is, a response file capable of responding to the data request corresponding to the request key value exists in the response file queue.
At this time, the embodiment of the present invention responds to the data request corresponding to the request key value by using the response file named by the request key value.
According to the embodiment of the invention, the obtained data request is judged, when the response file corresponding to the data request exists in the response file queue, the response file is utilized to respond to the data request, and when the response file corresponding to the data request does not exist in the response file queue, the response file of the server to the request is obtained and stored in the file cache queue, so that the data request is responded according to the sequence of the response files in the file response queue, the server is prevented from responding to a large number of data requests at the same time, the load of the server in response is reduced, and the response efficiency of the server to the data request is improved. Therefore, the data request response method provided by the invention can solve the problem of low efficiency of the server in responding to the multiple data requests.
Fig. 4 is a functional block diagram of a data request response apparatus according to an embodiment of the present invention.
The data request responding apparatus 100 according to the present invention may be installed in an electronic device. According to the implemented functions, the data request responding apparatus 100 may include a request parsing module 101, a file retrieving module 102, a response file obtaining module 103, a first responding module 104, and a second responding module 105. The module of the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the request analysis module 101 is configured to obtain a data request, analyze a request parameter in the data request, and generate a request key value according to the request parameter;
the file retrieval module 102 is configured to retrieve in a preset response file queue according to the request key value to obtain a retrieval key value;
the response file obtaining module 103 is configured to forward the data request to a server if the retrieval key value is different from the request key value, and obtain a response file returned by the server to the data request;
the first response module 104 is configured to cache the response file to the response file queue by using the request key value, and respond to the data request according to the sequence of the response files in the response file queue;
the second response module 105 is configured to, if the retrieval key value is the same as the request key value, respond to the data request by using a response file corresponding to the retrieval key value in the response file queue.
In detail, when the modules in the data request responding apparatus 100 according to the embodiment of the present invention are used, the same technical means as the data request responding method described in fig. 1 to fig. 3 are adopted, and the same technical effects can be produced, which is not described herein again.
Fig. 5 is a schematic structural diagram of an electronic device implementing a data request response method according to an embodiment of the present invention.
The electronic device may include a processor 10, a memory 11, a communication bus 12, and a communication interface 13, and may further include a computer program, such as a front-end monitoring program, stored in the memory 11 and executable on the processor 10.
In some embodiments, the processor 10 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same function or different functions, and includes one or more Central Processing Units (CPUs), a microprocessor, a digital Processing chip, a graphics processor, a combination of various control chips, and the like. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the electronic device by using various interfaces and lines, and executes various functions and processes data of the electronic device by running or executing programs or modules (e.g., executing a front end monitor program, etc.) stored in the memory 11 and calling data stored in the memory 11.
The memory 11 includes at least one type of readable storage medium including flash memory, removable hard disks, multimedia cards, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disks, optical disks, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device, for example a removable hard disk of the electronic device. The memory 11 may also be an external storage device of the electronic device in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device. The memory 11 may be used not only to store application software installed in the electronic device and various types of data, such as codes of a front-end monitoring program, but also to temporarily store data that has been output or will be output.
The communication bus 12 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is arranged to enable connection communication between the memory 11 and at least one processor 10 or the like.
The communication interface 13 is used for communication between the electronic device and other devices, and includes a network interface and a user interface. Optionally, the network interface may include a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), which are typically used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a Display (Display), an input unit such as a Keyboard (Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable, among other things, for displaying information processed in the electronic device and for displaying a visualized user interface.
Fig. 5 only shows an electronic device with components, and it will be understood by a person skilled in the art that the structure shown in fig. 5 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than shown, or a combination of certain components, or a different arrangement of components.
For example, although not shown, the electronic device may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so that functions of charge management, discharge management, power consumption management and the like are realized through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
It is to be understood that the described embodiments are for purposes of illustration only and that the scope of the appended claims is not limited to such structures.
The data request response program stored in the memory 11 of the electronic device 1 is a combination of a plurality of instructions, which when executed in the processor 10, can realize:
acquiring a data request, analyzing a request parameter in the data request, and generating a request key value according to the request parameter;
searching in a preset response file queue according to the request key value to obtain a search key value;
if the retrieval key value is different from the request key value, the data request is forwarded to a server, and a response file returned by the server to the data request is obtained;
caching the response file to the response file queue by using the request key value, and responding to the data request according to the sequence of the response file in the response file queue;
and if the retrieval key value is the same as the request key value, responding to the data request by using a response file corresponding to the retrieval key value in the response file queue.
Specifically, the specific implementation method of the processor 10 for the instruction may refer to the description of the relevant steps in the embodiment corresponding to fig. 1, which is not described herein again.
Further, the integrated modules/units of the electronic device 1, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. The computer readable storage medium may be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM).
The present invention also provides a computer-readable storage medium, storing a computer program which, when executed by a processor of an electronic device, may implement:
acquiring a data request, analyzing a request parameter in the data request, and generating a request key value according to the request parameter;
searching in a preset response file queue according to the request key value to obtain a search key value;
if the retrieval key value is different from the request key value, the data request is forwarded to a server, and a response file returned by the server to the data request is obtained;
caching the response file to the response file queue by using the request key value, and responding to the data request according to the sequence of the response file in the response file queue;
and if the retrieval key value is the same as the request key value, responding to the data request by using a response file corresponding to the retrieval key value in the response file queue.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims (10)
1. A data request response method, the method comprising:
acquiring a data request, analyzing a request parameter in the data request, and generating a request key value according to the request parameter;
searching in a preset response file queue according to the request key value to obtain a search key value;
if the retrieval key value is different from the request key value, the data request is forwarded to a server, and a response file returned by the server to the data request is obtained;
caching the response file to the response file queue by using the request key value, and responding to the data request according to the sequence of the response file in the response file queue;
and if the retrieval key value is the same as the request key value, responding to the data request by using a response file corresponding to the retrieval key value in the response file queue.
2. The data request response method of claim 1, wherein the parsing the request parameters in the data request comprises:
detecting whether the data request contains a message field;
when the data request contains a message field, performing deserialization processing on the data request to obtain a request parameter;
and when the data request does not contain a message field, carrying out character string segmentation on the data request to obtain a request parameter.
3. The data request response method of claim 2, wherein the deserializing the data request to obtain the request parameter comprises:
extracting the data content type in the data request;
selecting a decoder corresponding to the data content type to perform deserialization on the data request to obtain data content;
and performing parameter analysis on the data content to obtain a request parameter.
In this embodiment, the data content type in the data request may be extracted using a computer sentence having a data content type extraction function.
4. The data request response method of claim 2, wherein the performing string segmentation on the data request to obtain request parameters comprises:
dividing the data request according to a preset character string separation symbol, and numbering the divided character strings according to the positions of the divided character strings in the data request;
and analyzing the character string at the preset position in the data request to obtain a request parameter.
5. The data request response method of claim 1, wherein the retrieving in a preset response file queue according to the request key value to obtain a retrieval key value comprises:
according to the file names of all response files in a preset response file queue, constructing an index of the response file queue;
and retrieving in the response file queue according to the request key value and the index to obtain a retrieval key value.
6. The data request response method of any one of claims 1 to 5, wherein the forwarding the data request to a server comprises:
extracting the IP address of the responder in the data request;
compiling a request forwarding instruction according to the IP address of the responder;
and forwarding the data request to a server corresponding to the IP address of the responder by using the request forwarding instruction.
7. The data request response method of any one of claims 1 to 5, wherein the caching the response file to the response file queue using the request key value comprises:
when a response file returned by the server to the data request is acquired, recording the acquisition time of the response file by using a preset clock program, and naming the response file by using the request key value;
and sequencing the response files according to the sequence of the acquisition time from front to back, and writing the corresponding files into the response file queue according to the sequencing sequence.
8. A data request response apparatus, characterized in that the apparatus comprises:
the request analysis module is used for acquiring a data request, analyzing request parameters in the data request and generating a request key value according to the request parameters;
the file retrieval module is used for retrieving in a preset response file queue according to the request key value to obtain a retrieval key value;
a response file obtaining module, configured to forward the data request to a server if the retrieval key value is different from the request key value, and obtain a response file returned by the server to the data request;
the first response module is used for caching the response file to the response file queue by using the request key value and responding the data request according to the sequence of the response file in the response file queue;
and the second response module is used for responding to the data request by using a response file corresponding to the retrieval key value in the response file queue if the retrieval key value is the same as the request key value.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform a data request response method according to any one of claims 1 to 7.
10. A computer-readable storage medium, storing a computer program, wherein the computer program, when executed by a processor, implements a data request response method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110607873.9A CN113282854A (en) | 2021-06-01 | 2021-06-01 | Data request response method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110607873.9A CN113282854A (en) | 2021-06-01 | 2021-06-01 | Data request response method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113282854A true CN113282854A (en) | 2021-08-20 |
Family
ID=77283021
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110607873.9A Pending CN113282854A (en) | 2021-06-01 | 2021-06-01 | Data request response method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113282854A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114500320A (en) * | 2022-02-15 | 2022-05-13 | 平安证券股份有限公司 | Data monitoring method and device, electronic equipment and computer readable storage medium |
CN115774990A (en) * | 2023-02-10 | 2023-03-10 | 成都萌想科技有限责任公司 | RESTful API comparison method, system, equipment and storage medium based on configuration file |
CN117951084A (en) * | 2024-03-26 | 2024-04-30 | 苏州元脑智能科技有限公司 | Data writing method and device of file system, storage medium and electronic equipment |
Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102129469A (en) * | 2011-03-23 | 2011-07-20 | 华中科技大学 | Virtual experiment-oriented unstructured data accessing method |
US20130117227A1 (en) * | 2011-11-07 | 2013-05-09 | Empire Technology Development, Llc | Cache based key-value store mapping and replication |
CN103902577A (en) * | 2012-12-27 | 2014-07-02 | 中国移动通信集团四川有限公司 | Method and system for searching and locating resources |
CN104331497A (en) * | 2014-11-19 | 2015-02-04 | 中国科学院自动化研究所 | Method and device using vector instruction to process file index in parallel mode |
CN105138592A (en) * | 2015-07-31 | 2015-12-09 | 武汉虹信技术服务有限责任公司 | Distributed framework-based log data storing and retrieving method |
US20160335317A1 (en) * | 2015-05-14 | 2016-11-17 | Walleye Software, LLC | Computer data distribution architecture |
CN107729535A (en) * | 2017-11-17 | 2018-02-23 | 中国科学技术大学 | The collocation method of Bloom filter in a kind of key value database |
CN111083108A (en) * | 2019-11-14 | 2020-04-28 | 北京字节跳动网络技术有限公司 | Data processing method, device, medium and electronic equipment |
CN111399777A (en) * | 2020-03-16 | 2020-07-10 | 北京平凯星辰科技发展有限公司 | Differentiated key value data storage method based on data value classification |
CN111858496A (en) * | 2020-07-27 | 2020-10-30 | 北京大道云行科技有限公司 | Metadata retrieval method and device, storage medium and electronic equipment |
CN112653760A (en) * | 2020-12-22 | 2021-04-13 | 平安银行股份有限公司 | Cross-server file transmission method and device, electronic equipment and storage medium |
CN112702228A (en) * | 2020-12-18 | 2021-04-23 | 平安普惠企业管理有限公司 | Service current limiting response method and device, electronic equipment and readable storage medium |
-
2021
- 2021-06-01 CN CN202110607873.9A patent/CN113282854A/en active Pending
Patent Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102129469A (en) * | 2011-03-23 | 2011-07-20 | 华中科技大学 | Virtual experiment-oriented unstructured data accessing method |
US20130117227A1 (en) * | 2011-11-07 | 2013-05-09 | Empire Technology Development, Llc | Cache based key-value store mapping and replication |
CN103902577A (en) * | 2012-12-27 | 2014-07-02 | 中国移动通信集团四川有限公司 | Method and system for searching and locating resources |
CN104331497A (en) * | 2014-11-19 | 2015-02-04 | 中国科学院自动化研究所 | Method and device using vector instruction to process file index in parallel mode |
US20160335317A1 (en) * | 2015-05-14 | 2016-11-17 | Walleye Software, LLC | Computer data distribution architecture |
CN105138592A (en) * | 2015-07-31 | 2015-12-09 | 武汉虹信技术服务有限责任公司 | Distributed framework-based log data storing and retrieving method |
CN107729535A (en) * | 2017-11-17 | 2018-02-23 | 中国科学技术大学 | The collocation method of Bloom filter in a kind of key value database |
CN111083108A (en) * | 2019-11-14 | 2020-04-28 | 北京字节跳动网络技术有限公司 | Data processing method, device, medium and electronic equipment |
CN111399777A (en) * | 2020-03-16 | 2020-07-10 | 北京平凯星辰科技发展有限公司 | Differentiated key value data storage method based on data value classification |
CN111858496A (en) * | 2020-07-27 | 2020-10-30 | 北京大道云行科技有限公司 | Metadata retrieval method and device, storage medium and electronic equipment |
CN112702228A (en) * | 2020-12-18 | 2021-04-23 | 平安普惠企业管理有限公司 | Service current limiting response method and device, electronic equipment and readable storage medium |
CN112653760A (en) * | 2020-12-22 | 2021-04-13 | 平安银行股份有限公司 | Cross-server file transmission method and device, electronic equipment and storage medium |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114500320A (en) * | 2022-02-15 | 2022-05-13 | 平安证券股份有限公司 | Data monitoring method and device, electronic equipment and computer readable storage medium |
CN115774990A (en) * | 2023-02-10 | 2023-03-10 | 成都萌想科技有限责任公司 | RESTful API comparison method, system, equipment and storage medium based on configuration file |
CN117951084A (en) * | 2024-03-26 | 2024-04-30 | 苏州元脑智能科技有限公司 | Data writing method and device of file system, storage medium and electronic equipment |
CN117951084B (en) * | 2024-03-26 | 2024-05-28 | 苏州元脑智能科技有限公司 | Data writing method and device of file system, storage medium and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113282854A (en) | Data request response method and device, electronic equipment and storage medium | |
CN112732567B (en) | Mock data testing method and device based on ip, electronic equipment and storage medium | |
CN112702228B (en) | Service flow limit response method, device, electronic equipment and readable storage medium | |
CN115964307B (en) | Automatic test method, device, equipment and medium for transaction data | |
CN112506931B (en) | Data query method, device, electronic equipment and storage medium | |
CN115048111B (en) | Code generation method, device, equipment and medium based on metadata | |
CN113806434A (en) | Big data processing method, device, equipment and medium | |
CN114398194A (en) | Data collection method and device, electronic equipment and readable storage medium | |
CN115129753A (en) | Data blood relationship analysis method and device, electronic equipment and storage medium | |
CN114169303A (en) | Method, device, equipment and medium for editing table based on vue.js | |
CN113051224A (en) | File transmission method and device, electronic equipment and computer readable storage medium | |
CN113806492A (en) | Record generation method, device and equipment based on semantic recognition and storage medium | |
CN111538768A (en) | Data query method and device based on N-element model, electronic equipment and medium | |
CN115409041A (en) | Unstructured data extraction method, device, equipment and storage medium | |
CN114911479A (en) | Interface generation method, device, equipment and storage medium based on configuration | |
CN114780688A (en) | Text quality inspection method, device and equipment based on rule matching and storage medium | |
CN114518993A (en) | System performance monitoring method, device, equipment and medium based on business characteristics | |
CN111738005A (en) | Named entity alignment method and device, electronic equipment and readable storage medium | |
CN113672483B (en) | Device log storage method and device, electronic device and medium | |
CN113360505B (en) | Time sequence data-based data processing method and device, electronic equipment and readable storage medium | |
CN113326421B (en) | Data identification method and device for record carrier, electronic equipment and storage medium | |
CN112328960B (en) | Optimization method and device for data operation, electronic equipment and storage medium | |
CN114491007A (en) | Data exposure method, device, equipment and storage medium | |
CN114969099A (en) | SQL script generation method, device, equipment and storage medium based on Java language | |
CN113657076A (en) | Page operation record table generation method and device, electronic equipment and storage medium |
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 | ||
TA01 | Transfer of patent application right | ||
TA01 | Transfer of patent application right |
Effective date of registration: 20211018 Address after: 518000 Room 201, building A, No. 1, Qian Wan Road, Qianhai Shenzhen Hong Kong cooperation zone, Shenzhen, Guangdong (Shenzhen Qianhai business secretary Co., Ltd.) Applicant after: Shenzhen saiante Technology Service Co.,Ltd. Address before: 1-34 / F, Qianhai free trade building, 3048 Xinghai Avenue, Mawan, Qianhai Shenzhen Hong Kong cooperation zone, Shenzhen, Guangdong 518000 Applicant before: Ping An International Smart City Technology Co.,Ltd. |