Information extraction method and device, electronic device, and computer-readable storage medium

By using a pre-configured header interceptor in the request processing server to read and cache HTTP message header information, the problem of response delay caused by long HTTP header information processing time is solved, and the response speed of search engines and servers is improved.

CN114785878BActive Publication Date: 2024-09-03BEIJING EVERNOTE TECH CO LTD +2
View PDF 11 Cites 0 Cited by

Patent Information

Application Number
CN202210435665.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-24
Publication Date
2024-09-03
Estimated Expiration
2042-04-24

AI Technical Summary

Technical Problem

When searching through the Internet, the processing time of HTTP header information is longer, resulting in longer request response times and affecting user experience.

Method used

Introduce a pre-configured header interceptor in the request processing server, read and cache the header information in the message header, and cache it in memory so that the remote procedure call service can read directly from the memory, reducing the need for HTTP headers processing and analysis.

Benefits of technology

It reduces the processing time of request response, improves the response speed of the service, maintains the uniformity of header processing between services, and solves the problem of too long processing time of HTTP header information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114785878B
    Figure CN114785878B
Patent Text Reader

Abstract

The present invention discloses an information extraction method and device, an electronic device, and a computer-readable storage medium. The information extraction method includes: receiving a data call request, wherein the data call request carries at least a message header; using a pre-configured header interceptor to read the header information in the message header; caching the read header information into a memory, wherein the header information cached in the memory is read by a remote procedure call service request. The present invention solves the technical problem in the related art that when parsing a request data packet, the processing time for HTTP header information is long, which easily causes a long return time for the request response.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information processing technology, and in particular to an information extraction method and device, an electronic device, and a computer-readable storage medium. Background Art

[0002] In the related art, when searching through the Internet, a request is generally sent to a specified address through the Hypertext Transfer Protocol HTTP to obtain request data. After receiving the request, the server or processing terminal corresponding to the specified address needs to parse the request data packet to obtain HTTP header information. The processing time of HTTP header information is long, or the processing is inaccurate, which can easily cause a long return time for the request response, resulting in a return error or a long waiting time for the user, which reduces the customer's interest in use. The search engine or server providing search services needs to further improve the response speed.

[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0004] The embodiments of the present invention provide an information extraction method and device, an electronic device, and a computer-readable storage medium to at least solve the technical problem in the related art that when parsing a request data packet, the processing time for HTTP header information is long, which easily causes a long return time for the request response.

[0005] According to one aspect of an embodiment of the present invention, there is provided an information extraction method, which is applied to a request processing server, and includes: receiving a data call request, wherein the data call request carries at least a message header; using a pre-configured header interceptor to read header information in the message header; caching the read header information into a memory, wherein the header information cached in the memory is read by a remote procedure call service request.

[0006] Optionally, the step of using a preconfigured header interceptor to read the header information in the message header includes: obtaining multiple information identifiers of the message header; using the header interceptor to match the target information in the message header based on each of the information identifiers to obtain the header information.

[0007] Optionally, after using a pre-configured header interceptor to read the header information in the message header, it also includes: analyzing whether each information data in the header information conforms to a preset information format according to a preset information template; and confirming that the information verification has passed if the information data in the header information conforms to the preset information format.

[0008] Optionally, the header interceptor is arranged in a message processing chain of the request processing server.

[0009] Optionally, the type of the header interceptor is component.

[0010] Optionally, the information type contained in the header information includes at least one of the following: authentication information, domain address, client information and language type.

[0011] According to another aspect of an embodiment of the present invention, there is also provided an information extraction device, which is applied to a request processing server, and includes: a receiving unit, which is used to receive a data call request, wherein the data call request carries at least a message header; a reading unit, which is used to read the header information in the message header using a pre-configured header interceptor; and a cache unit, which is used to cache the read header information into a memory, wherein the header information cached in the memory is read by a remote procedure call service request.

[0012] Optionally, the reading unit includes: a first acquisition module, used to acquire multiple information identifiers of the message header; and a matching module, used to use the header interceptor to match the target information in the message header based on each of the information identifiers to obtain the header information.

[0013] Optionally, the information extraction device also includes: an analysis unit, which is used to analyze whether each information data in the header information conforms to a preset information format according to a preset information template after reading the header information in the message header using a pre-configured header interceptor; and a confirmation unit, which is used to confirm that the information verification has passed when the information data in the header information conforms to the preset information format.

[0014] Optionally, the header interceptor is arranged in a message processing chain of the request processing server.

[0015] Optionally, the type of the header interceptor is component.

[0016] Optionally, the information type contained in the header information includes at least one of the following: authentication information, domain address, client information and language type.

[0017] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any one of the above-mentioned information extraction methods by executing the executable instructions.

[0018] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is further provided, wherein the computer-readable storage medium includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the information extraction methods described above.

[0019] In an embodiment of the present invention, a data call request is received, wherein the data call request carries at least a message header, a pre-configured header interceptor is used to read the header information in the message header, and the read header information is cached in the memory, wherein the header information cached in the memory is read by the remote procedure call service request. In this embodiment, a header interceptor is added to the message processing chain of the request message, and the header information in the message header is read by the header interceptor. The subsequent remote procedure call request service can read the header information from the memory, which can save the processing and attention of the HTTP header, maintain the uniformity of the header processing between services, and reduce the processing time of the request response, thereby solving the technical problem in the related art that when parsing the request data packet, the processing time for the HTTP header information is long, which easily causes the return time of the request response to be long. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0021] Figure 1 is a flow chart of an optional information extraction method according to an embodiment of the present invention;

[0022] Figure 2 is a schematic diagram of an optional information extraction device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0023] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0025] To facilitate those skilled in the art to understand the present application, the technical terms and names involved in the embodiments of the present application are explained below:

[0026] Hyper Text Transfer Protocol, referred to as HTTP, is a request-response protocol that can run on TCP.

[0027] gRPC, or gRPC Remote Procedure Calls, is an open source remote procedure call system initiated by Google that can be transmitted based on the HTTP protocol.

[0028] Metadata: Metadata of gRPC.

[0029] ProtoBuf is a serial structured data format for data exchange. It is cross-platform, cross-language, and extensible. It is similar to the commonly used XML and JSON and is suitable for data storage and network data transmission.

[0030] Methodoptions, indicating the protocol processing method in the HTTP protocol.

[0031] The present application can be applied to various request processing systems or search processing systems. There is no limitation on the content of the request, which may include but is not limited to: web page requests, data transmission requests, video requests, image requests, and supports various remote procedure call processing requests. For example, it supports the general logic of processing Metadata from the HTTP header in gRPC. The HTTP header data received by gRPC will be placed in the Metadata structure (including Cookies, User-Agent, and all other data that can be written in the HTTP header), which can easily obtain authentication information, client information, and language information.

[0032] In this application, the application is schematically described by taking the support of gRPC request as an example (it can also be other requests, such as Restful request). This application can add a header filter by extending protobuf.MethodOptions. By converting the Header into metadata, the header information can be parsed, and the headers to be filtered can be customized and the contents of these headers can be processed. The application is described below in conjunction with various embodiments.

[0033] Embodiment 1

[0034] According to an embodiment of the present invention, an information extraction method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0035] The embodiment of the present invention provides an information extraction method, which is applied to a request processing server. In this embodiment, the header interceptor can be set in a message processing chain of the request processing server.

[0036] Optionally, in this embodiment, protobuf.MethodOptions may be extended to add a header filter identifier HeadersFilter to record the name of the header data to be filtered. Optionally, the type of the header interceptor is a component.

[0037] Figure 1 is a flowchart of an optional information extraction method according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:

[0038] Step S102, receiving a data call request, wherein the data call request carries at least a message header;

[0039] Step S104, using a pre-configured header interceptor to read header information in the message header;

[0040] Step S106, caching the read header information in the memory, wherein the header information cached in the memory is read by the remote procedure call service request.

[0041] Through the above steps, a data call request can be received, wherein the data call request carries at least a message header, and a pre-configured header interceptor is used to read the header information in the message header, and the read header information is cached in the memory, wherein the header information cached in the memory is read by the remote procedure call service request. In this embodiment, a header interceptor is added to the message processing chain of the request message, and the header information in the message header is read by the header interceptor. The subsequent remote procedure call request service can read these header information from the memory, which can save the processing and attention of the HTTP header, maintain the uniformity of the header processing between services, and reduce the processing time of the request response at the same time, thereby solving the technical problem in the related technology that when parsing the request data packet, the processing time for the HTTP header information is long, which easily causes the return time of the request response to be long.

[0042] The present application is described in detail below in conjunction with the above-mentioned implementation steps.

[0043] Step S102: receiving a data call request, wherein the data call request at least carries a message header.

[0044] The data call request may be sent by the client, and the data call request may include: verification information, message header, data content, etc. The request processing server receives the data call request initiated by the client, quickly parses the request, returns the corresponding data information to the client, and provides corresponding services to the client. The content called by the data call request includes but is not limited to: pictures, videos, texts, word files, tables, etc.

[0045] Step S104: Use a pre-configured header interceptor to read header information in the message header.

[0046] Optionally, the information type contained in the header information mentioned in this embodiment includes at least one of the following: authentication information, domain address, client information and language type.

[0047] In this embodiment, for the new structure of the defined message header, the value corresponding to the name defined in HeadersFilter that needs to be checked is stored. The value serves as the necessary information that the client needs to send to the server. This information needs to be identified in many services. For example, authentication information will be verified in specific logic, client information will generate corresponding data for different client platforms (Windows / Mac / iOS / Android / Web, etc.) when calculating results, and language type information will process internationalization logic when returning text.

[0048] As an optional implementation of this embodiment, the step of using a pre-configured header interceptor to read the header information in the message header includes: obtaining multiple information identifiers of the message header; using the header interceptor to match the target information in the message header based on each information identifier to obtain the header information.

[0049] For example, add a header interceptor HttpHeadersInterceptor to the gRPC message processing chain. It is a gRPC server interceptor used to read gRPC Metadata data. When reading Metadata, read the required header information (including Cookies, User-Agent, and all other data that can be written in the HTTP header) by matching the header name identified by HeadersFilter.

[0050] Optionally, after using a pre-configured header interceptor to read the header information in the message header, it also includes: analyzing whether each information data in the header information conforms to the preset information format according to the preset information template; if the information data in the header information conforms to the preset information format, confirming that the information verification is passed.

[0051] In this embodiment, after receiving a request (for example, receiving a gRPC-style processing request), the message header can be first converted into metadata, and then the request parameters can be converted into a gRPC request structure. The header information in the message header can be read through a header interceptor, and then the header information is returned to the memory. Subsequent gRPC requests can directly call the header information of the message header through the memory without parsing, loading, and processing the request structure, thereby improving the request processing speed.

[0052] Step S106, caching the read header information in the memory, wherein the header information cached in the memory is read by the remote procedure call service request.

[0053] In this embodiment, a new structure can be added based on the original gRPC protobuf definition. HeadersFilter defines the Metadata name of the content that needs to be checked, and checks whether the name exists in the class HttpHeadersInterceptor (io.grpc.ServerInterceptor) (the check logic can be customized). The new structure Headers stores the values ​​corresponding to the names defined in HeadersFilter that need to be checked (for example, cookies in Metadata need to be checked and extracted), and is processed in the class HttpHeadersInterceptor (io.grpc.ServerInterceptor).

[0054] Through the above embodiment, a header interceptor HttpHeadersInterceptor can be added to the gRPC message processing chain. It is a gRPC server interceptor used to read the metadata of gRPC (the metadata is information about this call during a remote call, in the form of key-value, where the key is a string type and the value is a group of strings. The metadata is transparent to gRPC itself, and it enables the client and server to provide each other with information about this call. Just like the RequestHeader and ResponseHeader of an http request, the life cycle of the httpheader is an http request, and the life cycle of the metadata is an RPC call.). The header information is cached in memory, and subsequent gRPC services can read the header information from the memory, which can save the processing and attention of the HTTP header and maintain the uniformity of header processing between services (all services using this solution obtain header data according to the same logic).

[0055] The present application is described below in conjunction with another optional embodiment.

[0056] Embodiment 2

[0057] The information extraction device provided in this embodiment can be applied to a request processing server. The various implementation units included in the device correspond to the various implementation steps in the above-mentioned embodiment 1.

[0058] Figure 2 is a schematic diagram of an optional information extraction device according to an embodiment of the present invention. Figure 2 As shown, the information extraction device may include: a receiving unit 21, a reading unit 23, and a cache unit 25, wherein:

[0059] The receiving unit 21 is used to receive a data call request, wherein the data call request at least carries a message header;

[0060] The reading unit 23 is used to read the header information in the message header using a pre-configured header interceptor;

[0061] The cache unit 25 is used to cache the read header information into the memory, wherein the header information cached in the memory is read by the remote procedure call service request.

[0062] The above-mentioned information extraction device can receive a data call request through a receiving unit 21, wherein the data call request carries at least a message header, and reads the header information in the message header through a pre-configured header interceptor through a reading unit 23, and caches the read header information in a memory through a cache unit 25, wherein the header information cached in the memory is read by a remote procedure call service request. In this embodiment, a header interceptor is added to the message processing chain of the request message, and the header information in the message header is read through the header interceptor. The subsequent remote procedure call request service can read these header information from the memory, which can save processing and attention to the HTTP header, maintain the uniformity of header processing between services, and reduce the processing time of the request response, thereby solving the technical problem in the related technology that when parsing the request data packet, the processing time for the HTTP header information is long, which easily causes a long return time for the request response.

[0063] Optionally, the reading unit includes: a first acquisition module, used to acquire multiple information identifiers of the message header; and a matching module, used to use a header interceptor to match target information in the message header based on each information identifier to obtain header information.

[0064] Optionally, the information extraction device also includes: an analysis unit, which is used to analyze whether each information data in the header information conforms to a preset information format according to a preset information template after reading the header information in the message header using a pre-configured header interceptor; and a confirmation unit, which is used to confirm that the information verification has passed when the information data in the header information conforms to the preset information format.

[0065] Optionally, a header interceptor is set in the message processing chain of the request processing server.

[0066] Optionally, the type of the header interceptor is component.

[0067] Optionally, the information type included in the header information includes at least one of the following: authentication information, domain address, client information and language type.

[0068] The above-mentioned information extraction device may also include a processor and a memory. The above-mentioned receiving unit 21, reading unit 23, cache unit 25, etc. are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions.

[0069] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the pre-configured header interceptor is used to read the header information in the message header by adjusting the kernel parameters, and the read header information is cached in the memory.

[0070] The above-mentioned memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one storage chip.

[0071] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any one of the above-mentioned information extraction methods by executing the executable instructions.

[0072] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium including a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned information extraction methods.

[0073] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program having the following method steps: receiving a data call request, wherein the data call request carries at least a message header; using a pre-configured header interceptor to read header information in the message header; caching the read header information in a memory, wherein the header information cached in the memory is read by a remote procedure call service request.

[0074] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0075] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0076] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0077] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0078] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0079] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.

[0080] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. An information extraction method, characterized in that: Applicable to request processing servers, including: Receiving a data call request, wherein the data call request carries at least a message header; Using a pre-configured header interceptor to read the header information in the message header includes: obtaining multiple information identifiers of the message header; using the header interceptor to match the target information in the message header based on each of the information identifiers to obtain the header information, wherein the information type contained in the header information includes at least one of the following: authentication information, domain address, client information and language type; The read header information is cached in a memory, wherein the header information cached in the memory is read by a remote procedure call service request.

2. The method according to claim 1, characterized in that After the pre-configured header interceptor is used to read the header information in the message header, the method further includes: According to the preset information template, analyzing whether each information data in the header information conforms to the preset information format; When the information data in the header information conforms to the preset information format, it is confirmed that the information verification has passed.

3. The method according to any one of claims 1 to 2, characterized in that: The header interceptor is arranged in the message processing chain of the request processing server.

4. The method according to any one of claims 1 to 2, characterized in that: The type of the header interceptor is component.

5. An information extraction device, characterized in that: Applicable to request processing servers, including: A receiving unit, configured to receive a data call request, wherein the data call request at least carries a message header; A reading unit, used to read the header information in the message header by using a pre-configured header interceptor, the reading unit comprising: a first acquisition module, used to acquire multiple information identifiers of the message header; a matching module, used to match the target information in the message header based on each of the information identifiers by using the header interceptor to obtain the header information, wherein the information type contained in the header information includes at least one of the following: authentication information, domain address, client information and language type; A cache unit is used to cache the read header information into a memory, wherein the header information cached in the memory is read by a remote procedure call service request.

6. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the information extraction method according to any one of claims 1 to 4 by executing the executable instructions.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the information extraction method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Method and system for intercepting webpage data

    CN104320378A

  • Session data sharing system and method

    CN104580226A

  • Gray level release method, gateway interceptor and computer readable storage medium

    CN106998369A

  • Service tracking method and device and computer readable storage medium

    CN109992465A

  • Network optimization method and device, computer equipment and storage medium

    CN110493030A