CN116192799A - Data processing method and device, electronic equipment and storage medium - Google Patents

Data processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116192799A
CN116192799A CN202211595836.1A CN202211595836A CN116192799A CN 116192799 A CN116192799 A CN 116192799A CN 202211595836 A CN202211595836 A CN 202211595836A CN 116192799 A CN116192799 A CN 116192799A
Authority
CN
China
Prior art keywords
data packet
processing
request
data
packet
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
Application number
CN202211595836.1A
Other languages
Chinese (zh)
Inventor
乔现朋
常力元
佟欣哲
陈奇
郑直
宋悦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianyi Safety Technology Co Ltd
Original Assignee
Tianyi Safety Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Tianyi Safety Technology Co Ltd filed Critical Tianyi Safety Technology Co Ltd
Priority to CN202211595836.1A priority Critical patent/CN116192799A/en
Publication of CN116192799A publication Critical patent/CN116192799A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0823Configuration setting characterised by the purposes of a change of settings, e.g. optimising configuration for enhancing reliability

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a data processing method, a data processing device, electronic equipment and a storage medium, and relates to the technical field of computers. The method is applied to DNS, the DNS is configured with N packet receiving threads and M processing threads, the N and M are integers greater than 0, and the method comprises the following steps: receiving an access request from a client device; wherein the access request comprises at least one data packet to be processed; each data packet is sent to the N packet receiving threads for analysis, and access information corresponding to each data packet is obtained through analysis; and according to the access information corresponding to each data packet, shunting each data packet into the M processing threads for caching so as to improve the efficiency of data processing.

Description

Data processing method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a data processing method, a data processing device, an electronic device, and a storage medium.
Background
The domain name server (Domain Name Server, DNS) is a server that converts a domain name (domain name) and an IP address (IP address) corresponding thereto. The DNS maintains a table of domain names (IP addresses) and corresponding IP addresses (domain names) to resolve domain names of messages. The method is used as a distributed database for mapping the domain name and the IP address with each other, so that people can access the Internet more conveniently. The DNS cache is a common scheme for accelerating the resolution of a website and improving the throughput of DNS requests, and the system stores the IP address after normally accessing the IP address, and directly extracts and displays the local DNS cache when revisiting.
Currently, the mainstream open source DNS software includes bind, ubound, DNS manufacturers, etc., and the following two modes are generally adopted in the cache processing mechanism:
firstly, cache global sharing is adopted, and data is protected in a cache mode through read-write locks in the multithreading access process, and a large number of locks are consumed in the cache mode, so that the data processing efficiency is reduced.
Secondly, a chainless table mechanism of a Hash table is used for carrying out cache protection on data, the mode reduces the consumption of locks, but the same cache table is shared in the multithreading access process, under a non-uniform memory access architecture (Non Uniform Memory Access, NUMA), a scene that a cache result is accessed across a CPU exists, the efficiency of memory access is reduced, the data processing efficiency is also reduced, and further the performance of a cache system is influenced.
Therefore, how to improve the data processing efficiency is a problem to be solved.
Disclosure of Invention
The application provides a data processing method, a device, equipment and a storage medium, which are used for improving the efficiency of data processing.
In a first aspect, a data processing method is provided, and is applied to a DNS, where the DNS is configured with N packet receiving threads and M processing threads, where N and M are integers greater than 0, and the method includes:
Receiving an access request of a client device; wherein the access request carries at least one data packet to be processed; each data packet is sent to the N packet receiving threads for analysis, and access information corresponding to each data packet is obtained through analysis; shunting each data packet into the M processing threads according to the access information corresponding to each data packet; after each data packet is shunted to the M processing threads, the M processing threads perform cache processing on the data packets managed by the M processing threads.
In one possible implementation manner, the access information includes a request domain name and a request type of the data packet; and according to the access information corresponding to each data packet, shunting each data packet into the M processing threads, including:
calculating hash values corresponding to the data packets according to the request domain names and the request types corresponding to the data packets; and shunting the data packets corresponding to the same hash value into the same processing thread.
In one possible implementation manner, the caching, by the M processing threads, the data packets that are respectively managed by the M processing threads includes:
When the first data packet is determined to be of a request data packet type, determining whether a first request domain name of the first data packet is recorded in a lock-free cache table of a first processing thread; the first data packet is a data packet managed by the first processing thread; if yes, generating a response data packet, and sending the response data packet to the client device; if not, generating a forwarding session request, and sending the forwarding session request to the next DNS; the forwarding session request is used for requesting to acquire a response data packet of the first data packet.
In one possible implementation manner, the caching, by the M processing threads, the data packets that are respectively managed by the M processing threads includes:
when the first data packet is determined to be of a response data packet type, determining whether to inquire session information corresponding to the session identifier according to the session identifier in the first data packet; the first data packet is a data packet managed by the first processing thread; if not, deleting the first data packet; if yes, deleting the session information, adding the first request domain name of the first data packet to the lock-free cache table of the first processing thread, and returning an access request response to the client device.
In one possible implementation manner, the M processing threads include P lock-free ring queues for buffering the data packets and access information corresponding to each data packet, where P is an integer equal to M.
In a second aspect, there is provided a data processing apparatus applied to a DNS configured with N packet-receiving threads and M processing threads, the N and M being integers greater than 0, the apparatus comprising:
the receiving module is used for receiving an access request from the client device; wherein the access request carries at least one data packet to be processed; the analysis module is used for sending each data packet to the N packet receiving threads for analysis, and analyzing to obtain access information corresponding to each data packet; the distribution module is used for distributing each data packet to the M processing threads according to the access information corresponding to each data packet; and the processing module is used for caching the data packets managed by the M processing threads after the data packets are shunted to the M processing threads.
In one possible implementation manner, the access information includes a request domain name and a request type of the data packet; the processing module is specifically configured to:
Calculating hash values corresponding to the data packets according to the request domain names and the request types corresponding to the data packets; and shunting the data packets corresponding to the same hash value into the same processing thread.
In one possible implementation manner, the processing module is specifically configured to:
when the first data packet is determined to be of a request data packet type, determining whether a first request domain name of the first data packet is recorded in a lock-free cache table of a first processing thread; the first data packet is a data packet managed by the first processing thread; if yes, generating a response data packet, and sending the response data packet to the client device; if not, generating a forwarding session request, and sending the forwarding session request to the next DNS; the forwarding session request is used for requesting to acquire a response data packet of the first data packet.
In one possible implementation manner, the processing module is specifically configured to:
when the first data packet is determined to be of a response data packet type, determining whether to inquire session information corresponding to the session identifier according to the session identifier in the first data packet; the first data packet is a data packet managed by the first processing thread; if not, deleting the first data packet; if yes, deleting the session information, adding the first request domain name of the first data packet to the lock-free cache table of the first processing thread, and returning an access request response to the client device.
In one possible implementation manner, the M processing threads include P lock-free ring queues for buffering the data packets and access information corresponding to each data packet, where P is an integer equal to M.
In a third aspect, there is provided an electronic device comprising:
a memory for storing a computer program; a processor for implementing the method steps of any one of the first aspects when executing a computer program stored on the memory.
In a fourth aspect, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method steps of any of the first aspects.
In the embodiment of the application, the configuration of the domain name server is to configure the packet receiving thread and the processing thread separately, so that the processing performance of the domain name server can be improved; when the access request from the client device is received, each data packet is sent to a plurality of configured receiving threads for analysis, so that access information corresponding to each data packet is obtained through analysis, the plurality of data packets can be analyzed simultaneously, the analysis speed of the data packets is accelerated, and each data packet is shunted into a plurality of processing threads for caching according to the access information corresponding to each data packet, so that the plurality of data packets can be processed by the plurality of processing threads at the same time in a targeted manner, the mutual influence is avoided, the data processing efficiency is further accelerated, the access speed is improved, and the user experience is met.
The technical effects of each of the second to fourth aspects and the technical effects that may be achieved by each aspect are referred to above for the technical effects that may be achieved by the first aspect or each possible aspect in the first aspect, and the detailed description is not repeated here.
Drawings
Fig. 1 is a schematic diagram of an application scenario applicable to an embodiment of the present application;
fig. 2 is a schematic structural diagram of a domain name server according to an embodiment of the present application;
FIG. 3 is a flowchart of a data processing method according to an embodiment of the present application;
FIG. 4 is an exemplary diagram of a lock-free cache table according to an embodiment of the present application;
fig. 5 is a flowchart of a buffering process for a data packet according to an embodiment of the present application;
FIG. 6 is a schematic diagram of a data processing apparatus according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the present application will be described in further detail with reference to the accompanying drawings. The specific method of operation in the method embodiment may also be applied to the device embodiment or the system embodiment. It should be noted that "a plurality of" is understood as "at least two" in the description of the present application. "and/or", describes an association relationship of an association object, and indicates that there may be three relationships, for example, a and/or B, and may indicate: a exists alone, A and B exist together, and B exists alone. A is connected with B, and can be represented as follows: both cases of direct connection of A and B and connection of A and B through C. In addition, in the description of the present application, the words "first," "second," and the like are used merely for distinguishing between the descriptions and not be construed as indicating or implying a relative importance or order.
In order to better understand the embodiments of the present application, technical terms related to the embodiments of the present application will be first described below.
(1) The data plane development suite (Data Plane Development Kit, DPDK) is mainly operated based on a Linux system, is used for a function library and a driving set for rapid data packet processing, and can greatly improve data processing performance and throughput and improve the working efficiency of a data plane application program. DPDK uses polling (polling) rather than interrupts to process packets. When receiving the data packet, the network card driver reloaded by the DPDK does not inform the CPU through interruption, but directly stores the data packet into the memory, and delivers the application layer software to directly process the data packet through an interface provided by the DPDK, so that a large amount of CPU interruption time and memory copying time are saved.
(2) A Hash table (also called a Hash table) is a data structure that is directly accessed according to a Key value (Key value). That is, it accesses the record by mapping the key value to a location in the table to speed up the lookup. This mapping function is called a hash function and the array in which the records are stored is called a hash table.
(3) NUMA technology allows numerous servers to behave as a single system while retaining the advantage of a small system for programming and management, a memory designed for a multiprocessor computer, with memory access time dependent on memory location relative to the processor. Under NUMA, a processor accesses its own local memory faster than non-local memory (memory located on another processor, or shared between processors). The non-uniform memory access architecture is characterized by: the shared memory is physically distributed, and the set of all of these memories is the global address space. The processor accesses these memories differently, and obviously accesses local memory faster than global shared memory or remote access to external memory. Additionally, memory in NUMA can be hierarchical: local memory, group shared memory, global shared memory.
(4) DNS cache servers refer to a technique for storing network content that needs to be frequently accessed in a system that is closer to a user and has a faster access speed, so as to increase the access speed of the content. The cache server is a server that stores frequently accessed content.
(5) The recursive server functions as: when a client initiates a network surfing request, after various caches of the local machine are queried, a corresponding analysis record is not obtained, and a query request is initiated to a local domain name server; the local domain name server can firstly inquire the local cache of the local domain name server, if the result is directly returned to the client, if the result is not available, the client can be replaced to inquire the root domain name server, the top domain name server, the second domain name server and the like in a first-level recursion mode, finally the authoritative server corresponding to the domain name is found, the result is obtained and returned to the client, and meanwhile the record is stored in the local cache. When the client initiates the query request again within the TTL value, the local domain name server directly sends the result to the client without initiating the global query again.
(6) Session: in computers, and in particular in network applications, referred to as "session control," is a technique used to maintain an association between a client and a server. The Session object stores attributes and configuration information required for a particular user Session.
The following description is made for some simple descriptions of application scenarios applicable to the technical solutions of the embodiments of the present application, and it should be noted that the application scenarios described below are only used for illustrating the embodiments of the present application and are not limiting. In specific implementation, the technical scheme provided by the embodiment of the application can be flexibly applied according to actual needs.
Fig. 1 is a schematic diagram of an application scenario applicable to the embodiment of the present application. As shown, the scenario mainly includes a client device 10, a local domain name server (local DNS) 11, a recursive domain name server (recursive DNS) 12; wherein, the recursive DNS 12 is composed of a plurality of levels of servers such as a root domain name server, a top level domain name server, a second level domain name server, a authority domain name server, and the like; information interaction between the client device 10 and the local DNS11 may be performed through a communication network, and information interaction between the local DNS11 and the recursive DNS 12 may be performed through a communication network, where a communication manner adopted by the communication network may include: wireless communication and wired communication.
By way of example, the client device 10 may access the network with the local DNS11 through cellular mobile communication technology, which may include fifth generation mobile communication (5th Generation Mobile Networks,5G) technology.
By way of example, the client device 10 may access the network to communicate with the local DNS 11 via a short-range wireless communication means, which may include wireless fidelity (Wireless Fidelity, wi-Fi) technology.
Client device 10 is a device that may provide voice and/or data connectivity to a user, comprising: a handheld terminal device with a wireless connection function, a vehicle-mounted terminal device, and the like. For example, client devices 10 include, but are not limited to: a mobile phone, a tablet computer, a notebook computer, a palm computer, a mobile internet device (Mobile Internet Device, MID), a wearable device, a Virtual Reality (VR) device, an augmented Reality (Augmented Reality, AR) device, a wireless terminal device in industrial control, a wireless terminal device in unmanned driving, a wireless terminal device in smart grid, a wireless terminal device in transportation safety, a wireless terminal device in smart city, a wireless terminal device in smart home, or the like.
The client device 10 may send an access request to the local DNS 11.
The local DNS 11 may be configured to receive an access request from the client device 10, and perform corresponding processing according to the access request. For example, when the client device 10 queries the local DNS 11 for a domain name resolution, if the local DNS 11 first searches the cache and the domain name resolution is not queried, the client device goes to the first-level query from the server in the recursive DNS 12 and obtains the resolution information of the domain name.
Fig. 2 is a schematic structural diagram of a domain name server according to an embodiment of the present application. As shown, the structure mainly comprises a packet receiving thread (1, 2, …, N), a lock-ring-free queue (1, 2, …, P) and a processing thread (1, 2, …, M). One processing thread corresponds to one lock-ring-free queue (dpdk ring), and one packet receiving thread can be respectively connected with the P lock-ring-free queues. The domain name server may specifically refer to the local DNS 11 in fig. 1, and the lock-free queue may be in the form of a database.
Taking the packet receiving thread 1 as an example, the packet receiving thread 1 may include a packet receiving sub-module, an parsing sub-module and a shunting sub-module.
The packet receiving sub-module is operable to receive an access request from a client device (e.g., client device 10 of fig. 1) carrying a data packet.
The analysis sub-module can be used for analyzing the data packet received by the packet receiving sub-module.
The splitting sub-module can be used for splitting the data packet analyzed by the analyzing sub-module into one of the connected P non-ring-shaped queues for caching.
Illustratively, taking processing thread 1 as an example, processing thread 1 may include: the system comprises an acquisition sub-module, a cache processing sub-module and a forwarding sub-module.
The obtaining sub-module may be configured to obtain a data packet from the lock-free ring queue 1, and then send the data packet to the buffering sub-module.
After the buffer processing sub-module receives the data packet sent by the acquisition sub-module, whether the buffer data (buffer information) requested by the data packet can be directly acquired from the local DNS can be determined according to the processing logic of the processing thread, the lock-free buffer table of the processing thread 1 and the like, if so, a response data packet is directly generated and sent to the client device based on the network card, and if not, the data packet is sent to the forwarding sub-module.
After receiving the data packet, the forwarding sub-module can inquire and acquire the cache data requested by the data packet from the recursion server, and then forward the data packet to the client device based on the network card after obtaining the response data packet.
The number of the packet receiving threads and the processing threads configured by the domain name server can be flexibly configured according to the DNS traffic, so that the domain name server is guaranteed to have good performance.
It should be noted that the domain name server shown above is only an example, and the structure of the domain name server may be further improved, expanded, etc. according to actual needs, and the embodiments of the present application are not limited herein.
In order to further explain the technical solutions provided in the embodiments of the present application, the following details are described with reference to the accompanying drawings and the detailed description. Although the embodiments of the present application provide the method operational steps as shown in the following embodiments or figures, more or fewer operational steps may be included in the method, either on a routine or non-inventive basis. In steps where there is logically no necessary causal relationship, the execution order of the steps is not limited to the execution order provided by the embodiments of the present application. The method may be performed sequentially or and in accordance with the method shown in the embodiments or drawings when the actual process or apparatus is performed.
Fig. 3 is a flowchart of a data processing method according to an embodiment of the present application. The method is applied to a domain name server (such as the domain name server shown in fig. 2) for improving the efficiency of data processing, and as shown in fig. 3, the flow comprises the following steps:
301: an access request is received from a client device.
The client device may in particular be the client device 10 shown in fig. 1, and the access request may comprise at least one data packet to be processed.
In this step, a specific interaction process may be: the client device can send an access request to a domain name server (such as the domain name server shown in fig. 2) in real time, the access request can carry a plurality of data packets to be processed, and after the domain name server receives the access request, the domain name server can reasonably arrange a packet receiving sub-module in each packet receiving thread to carry out packet receiving processing on each data packet according to the respective maximum capacity, idle state and other conditions of each packet receiving thread, so that the packet receiving speed of the data packet is increased, and the subsequent efficiency of data processing is improved.
For example, assuming that there are 4 independent packet receiving threads and 3 data packets to be processed, if the packet receiving sub-module of the packet receiving thread 1 is executing at this time and is in a non-idle state, the allocation of the 3 data packets to be processed according to the capacity configured by the remaining packet receiving threads 2, 3, and 4 may include the following situations:
case 1: when the capacity of the 3 packet receiving threads is consistent, 3 data packets to be processed can be uniformly distributed.
Case 2: when the capacity of the 3 packet receiving threads is not consistent, the 3 data packets to be processed can be arranged in the packet receiving thread with the maximum capacity, or the 3 data packets to be processed can be arranged in two packet receiving threads in the packet receiving threads 2, 3 and 4.
In some embodiments, the client device may send the access request to the domain name server in a polling manner according to the set time, and the packet receiving thread in the domain name server may receive the access request from the client device according to a polling mechanism, thereby improving the capability of the I/O interface of the network card to receive the data packet.
302: and sending each data packet to N wrapping threads for analysis, and analyzing to obtain access information corresponding to each data packet.
The parsing sub-module in the N packet receiving threads (such as the parsing sub-module shown in fig. 2) may be used for parsing, and specifically may be: after receiving the data packets from the client device, the packet receiving sub-modules of the packet receiving threads send the data packets obtained by the packet receiving sub-modules to the analysis sub-modules to analyze, and the analysis sub-modules analyze the data packets simultaneously, so that the analysis speed is increased, and the subsequent data processing efficiency is improved.
Illustratively, the access information may include: the request domain name, request type, and may also include the packet type (e.g., request packet, reply packet), packet name, packet identification, source address of the client device, etc.
303: and according to the access information corresponding to each data packet, shunting each data packet into M processing threads.
Illustratively, the packets may be split by: according to the corresponding request domain name (DNS qname) and request type (DNS qtype) of each data packet, calculating the corresponding hash value of each data packet; and shunting the data packets corresponding to the same hash value into the same processing thread.
For example, assuming that when hash values are calculated for the data packet 1, the data packet 2, and the data packet 3 respectively, the hash values of the data packet 1 and the data packet 2 are the same, and the hash values of the data packet 3 are different, the data packet 1 and the data packet 2 may be shunted into the same processing thread (for example, the processing thread 1 shown in fig. 2), and the data packet 3 may be shunted into other processing threads, so that multiple access requests with the same request domain name and request type may be shunted into the same processing thread, or the data packet with the same access request may be shunted into the same processing thread, so that multiple processing threads are prevented from performing multiple processing on the repeated data packet, and the efficiency of data processing is improved.
In some embodiments, when each data packet is split, if each processing thread is in a working state, the data packet managed by each processing thread can be cached in a corresponding lock-free ring-shaped queue (as shown in fig. 2), so that each processing thread can circularly read the data packet in the corresponding lock-free ring-shaped queue according to a time interval, thereby avoiding subsequent processing conflict of the data packet.
304: after each data packet is shunted to M processing threads, the M processing threads perform cache processing on the data packets managed by the M processing threads.
For example, the buffering of the data packets managed by the M processing threads, taking the data packet 1 managed by the processing thread 1 as an example, may include the following several examples:
example 1, for packet 1 is request packet type: when the first data packet (data packet 1) is determined to be of a request data packet type, determining whether a first request domain name of the first data packet is recorded in a lock-free cache table of a first processing thread (processing thread 1), wherein the first data packet is a data packet managed by the first processing thread; if yes, the local DNS is indicated to cache the cache information corresponding to the first data packet, a response data packet can be generated, and the response data packet is sent to the client device; if not, the local DNS does not cache the cache information corresponding to the first data packet, and may generate a forwarding session request, and send the forwarding session request to the next DNS (e.g. a root domain name server in the recursive server shown in fig. 2) for requesting to obtain the response data packet of the first data packet from the next DNS.
In some embodiments, it may be determined whether a first request domain name for the first data packet is recorded in a lock-free cache table of the first processing thread based on a request type of the first data packet.
In other embodiments, it may be determined whether the first request domain name of the first data packet is recorded in the lock-free cache table of the first processing thread based on the request domain name of the first data packet.
In another embodiment, it may be determined whether the first request domain name of the first data packet is recorded in the lock-free cache table of the first processing thread according to the request domain name and the request type of the first data packet.
Illustratively, the lock-free cache table (LRU hash) consists essentially of two components, as shown in fig. 4, including: hashmap, lru_list; the hashmap can be designed by adopting a conventional zipper type, so that conflicts among hash values are avoided, the hashmap is mainly composed of a plurality of keys and nodes, and one key characterizes one request domain name and one request type; the lru _list may be designed with a double-strand table structure, and when new data is inserted, two operations are performed, inserting hashmap into the newly created node, and inserting the newly created node into the end of lru _list. By adopting the lock-free cache table with the structure, the consumption of locks can be reduced, and each processing thread can maintain the respective lock-free cache table without mutual influence, so that the processing performance of the domain name server is improved.
Example 2, reply packet type for packet 1: when the first data packet (data packet 1) is determined to be of a response data packet type, determining whether to inquire session information corresponding to the session identifier according to the session identifier in the first data packet, if not, deleting the first data packet if the first data packet is a malicious data packet with aggressiveness; if yes, deleting the session information, adding the first request domain name of the first data packet into the lock-free cache table of the first processing thread, and returning an access request response to the client device, so that the subsequent access result is obtained by directly inquiring the lock-free cache table, and the access efficiency is improved.
In the embodiment of the application, the configuration of the domain name server is to configure the packet receiving thread and the processing thread separately, so that the processing performance of the domain name server can be improved; when the access request from the client device is received, each data packet is sent to a plurality of configured receiving threads for analysis, so that access information corresponding to each data packet is obtained through analysis, the plurality of data packets can be analyzed simultaneously, the analysis speed of the data packets is accelerated, and each data packet is shunted into a plurality of processing threads for caching according to the access information corresponding to each data packet, so that the plurality of data packets can be processed by the plurality of processing threads at the same time in a targeted manner, the mutual influence is avoided, the data processing efficiency is further accelerated, the access speed is improved, and the user experience is met.
With respect to the above examples 1 and 2, fig. 5 illustrates a flowchart of a buffering process for a data packet according to an embodiment of the present application. Taking the example of processing thread 1 and data packet 1, as shown in the figure, the method may comprise the following steps:
501: processing thread 1 retrieves packet 1 from the lock free queue 1.
502: after the processing thread acquires the data packet 1, judging the data packet type of the data packet 1, if the data packet 1 is the request data packet type, going to 503, and if the data packet 1 is the response data packet type, going to 507.
503: according to the request domain name of the data packet 1, inquiring whether the request domain name of the data packet 1 is recorded in a lock-free cache table in the processing thread 1, if so, switching to 504, and if not, switching to 505.
504: and generating a response data packet and transmitting the response data packet to the client device.
In this step, the response packet may be encapsulated according to the cache information of the packet 1 queried in the local DNS and the local IP address.
505: a forwarding session request is generated and sent to the next DNS and forwarded 506.
For example, the processing thread 1 obtains the response data packet of the data packet 1 in a recursive query manner through the forwarding session request, and may store session information generated in this process into the local DNS, so that the session information may be used directly later.
506: after the buffer information of the data packet 1 is obtained from the next DNS according to the forwarding session request, a response data packet (forwarding data packet) may be encapsulated according to the buffer information and the IP address corresponding to the next DNS, and forwarded to the client device.
507: and determining whether the session information corresponding to the session identifier is queried according to the session identifier in the data packet 1, if so, turning to 508, and if not, turning to 509.
508: deleting the session information, adding the request domain name of the data packet 1 to the lock-free cache table of the processing thread 1, and returning an access request response to the client device.
The return request response carries a response packet of packet 1.
509: and deleting the first data packet.
Based on the same technical concept, the embodiment of the application also provides a data processing device, which can realize the flow of the data processing method in the embodiment of the application.
Fig. 6 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present application. Applied to DNS, DNS is configured with N packet receiving threads and M processing threads, N and M being integers greater than 0, as shown, the apparatus includes: a receiving module 601, a parsing module 602, a shunting module 603 and a processing module 604.
A receiving module 601, configured to receive an access request from a client device; wherein the access request carries at least one data packet to be processed.
And the parsing module 602 is configured to send each data packet to the N wrapping threads for parsing, so as to parse and obtain access information corresponding to each data packet.
And the splitting module 603 is configured to split each data packet into the M processing threads according to the access information corresponding to each data packet.
And the processing module 604 is configured to perform cache processing on the data packets managed by the M processing threads after the data packets are shunted to the M processing threads.
Optionally, the access information includes a request domain name and a request type of the data packet; the processing module 604 is specifically configured to:
calculating hash values corresponding to the data packets according to the request domain names and the request types corresponding to the data packets; and shunting the data packets corresponding to the same hash value into the same processing thread.
Optionally, the processing module 604 is specifically configured to:
when the first data packet is determined to be of a request data packet type, determining whether a first request domain name of the first data packet is recorded in a lock-free cache table of a first processing thread; the first data packet is a data packet managed by the first processing thread; if yes, generating a response data packet, and sending the response data packet to the client device; if not, generating a forwarding session request, and sending the forwarding session request to the next DNS; the forwarding session request is used for requesting to acquire a response data packet of the first data packet.
Optionally, the processing module 604 is specifically configured to:
when the first data packet is determined to be of a response data packet type, determining whether to inquire session information corresponding to the session identifier according to the session identifier in the first data packet; the first data packet is a data packet managed by the first processing thread; if not, deleting the first data packet; if yes, deleting the session information, adding the first request domain name of the first data packet to the lock-free cache table of the first processing thread, and returning an access request response to the client device.
It should be noted that, the above device provided in the embodiment of the present application can implement all the method steps in the embodiment of the data processing method, and can achieve the same technical effects, and the same parts and beneficial effects as those in the embodiment of the present application are not described in detail herein.
Based on the same technical concept, the embodiment of the application also provides electronic equipment, and the electronic equipment can realize the functions of the data processing device.
Fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
At least one processor 701, and a memory 702 connected to the at least one processor 701, in this embodiment of the present application, a specific connection medium between the processor 701 and the memory 702 is not limited, and in fig. 7, the processor 701 and the memory 702 are connected by a bus 700 as an example. Bus 700 is shown in bold lines in fig. 7, and the manner in which the other components are connected is illustrated schematically and not by way of limitation. The bus 700 may be divided into an address bus, a data bus, a control bus, etc., and is represented by only one thick line in fig. 7 for convenience of representation, but does not represent only one bus or one type of bus. Alternatively, the processor 701 may be referred to as a controller, and the names are not limited.
In the embodiment of the present application, the memory 702 stores instructions executable by the at least one processor 701, and the at least one processor 701 may perform a data processing method as described above by executing the instructions stored in the memory 702. The processor 701 may implement the functions of the various modules in the apparatus shown in fig. 6.
The processor 701 is a control center of the apparatus, and may connect various parts of the entire control device using various interfaces and lines, and by executing or executing instructions stored in the memory 702 and invoking data stored in the memory 702, various functions of the apparatus and processing data, thereby performing overall monitoring of the apparatus.
In one possible design, processor 701 may include one or more processing units, and processor 701 may integrate an application processor and a modem processor, wherein the application processor primarily processes operating systems, user interfaces, application programs, and the like, and the modem processor primarily processes wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 701. In some embodiments, processor 701 and memory 702 may be implemented on the same chip, or they may be implemented separately on separate chips in some embodiments.
The processor 701 may be a general purpose processor such as a Central Processing Unit (CPU), digital signal processor, application specific integrated circuit, field programmable gate array or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, which may implement or perform the methods, steps, and logic blocks disclosed in embodiments of the present application. The general purpose processor may be a microprocessor or any conventional processor or the like. The steps of a data processing method disclosed in connection with the embodiments of the present application may be directly embodied as a hardware processor executing, or may be executed by a combination of hardware and software modules in the processor.
The memory 702 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The Memory 702 may include at least one type of storage medium, and may include, for example, flash Memory, hard disk, multimedia card, card Memory, random access Memory (Random Access Memory, RAM), static random access Memory (Static Random Access Memory, SRAM), programmable Read-Only Memory (Programmable Read Only Memory, PROM), read-Only Memory (ROM), charged erasable programmable Read-Only Memory (Electrically Erasable Programmable Read-Only Memory), magnetic Memory, magnetic disk, optical disk, and the like. Memory 702 is any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to such. The memory 702 in the embodiments of the present application may also be circuitry or any other device capable of implementing a memory function for storing program instructions and/or data.
By programming the processor 701, the code corresponding to one of the data processing methods described in the foregoing embodiments may be solidified into a chip, so that the chip can execute one of the data processing methods of the embodiment shown in fig. 3 at runtime. How to design and program the processor 701 is a technology well known to those skilled in the art, and will not be described in detail herein.
It should be noted that, the above power-on electronic device provided in the embodiment of the present application can implement all the method steps implemented in the embodiment of the method, and can achieve the same technical effects, and specific details of the same parts and beneficial effects as those of the embodiment of the method in the embodiment are not described herein.
The present application also provides a computer-readable storage medium storing computer-executable instructions for causing a computer to perform a data processing method of the above embodiments.
Embodiments of the present application also provide a computer program product which, when invoked by a computer, causes the computer to perform one of the data processing methods of the above embodiments.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various modifications and variations can be made in the present application without departing from the spirit or scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims and the equivalents thereof, the present application is intended to cover such modifications and variations.

Claims (12)

1. A data processing method applied to a domain name server DNS, the DNS configured with N packet receiving threads and M processing threads, where N and M are integers greater than 0, the method comprising:
receiving an access request of a client device; wherein the access request carries at least one data packet to be processed;
each data packet is sent to the N packet receiving threads for analysis, and access information corresponding to each data packet is obtained through analysis;
Shunting each data packet into the M processing threads according to the access information corresponding to each data packet;
after each data packet is shunted to the M processing threads, the M processing threads perform cache processing on the data packets managed by the M processing threads.
2. The method of claim 1, wherein the access information comprises a request domain name, a request type of a data packet;
and according to the access information corresponding to each data packet, shunting each data packet into the M processing threads, including:
calculating hash values corresponding to the data packets according to the request domain names and the request types corresponding to the data packets;
and shunting the data packets corresponding to the same hash value into the same processing thread.
3. The method of claim 1, wherein the caching of the respective governed data packets by the M processing threads comprises:
when the first data packet is determined to be of a request data packet type, determining whether a first request domain name of the first data packet is recorded in a lock-free cache table of a first processing thread; the first data packet is a data packet managed by the first processing thread;
If yes, generating a response data packet, and sending the response data packet to the client device;
if not, generating a forwarding session request, and sending the forwarding session request to the next DNS; the forwarding session request is used for requesting to acquire a response data packet of the first data packet.
4. The method of claim 1, wherein the caching of the respective governed data packets by the M processing threads comprises:
when the first data packet is determined to be of a response data packet type, determining whether to inquire session information corresponding to the session identifier according to the session identifier in the first data packet; the first data packet is a data packet managed by the first processing thread;
if not, deleting the first data packet;
if yes, deleting the session information, adding the first request domain name of the first data packet to the lock-free cache table of the first processing thread, and returning an access request response to the client device.
5. The method of any of claims 1-4, wherein the M processing threads include P non-circular queues for buffering the respective data packets and access information corresponding to the respective data packets, and P is an integer equal to M.
6. A data processing apparatus for use with a domain name server DNS, the DNS configured with N packet receiving threads and M processing threads, the N and M being integers greater than 0, the apparatus comprising:
the receiving module is used for receiving an access request from the client device; wherein the access request carries at least one data packet to be processed;
the analysis module is used for sending each data packet to the N packet receiving threads for analysis, and analyzing to obtain access information corresponding to each data packet;
the distribution module is used for distributing each data packet to the M processing threads according to the access information corresponding to each data packet;
and the processing module is used for caching the data packets managed by the M processing threads after the data packets are shunted to the M processing threads.
7. The apparatus of claim 6, wherein the access information comprises a request domain name, a request type of a data packet;
the processing module is specifically configured to:
calculating hash values corresponding to the data packets according to the request domain names and the request types corresponding to the data packets;
And shunting the data packets corresponding to the same hash value into the same processing thread.
8. The apparatus of claim 6, wherein the processing module is specifically configured to:
when the first data packet is determined to be of a request data packet type, determining whether a first request domain name of the first data packet is recorded in a lock-free cache table of a first processing thread; the first data packet is a data packet managed by the first processing thread;
if yes, generating a response data packet, and sending the response data packet to the client device;
if not, generating a forwarding session request, and sending the forwarding session request to the next DNS; the forwarding session request is used for requesting to acquire a response data packet of the first data packet.
9. The apparatus of claim 6, wherein the processing module is specifically configured to:
when the first data packet is determined to be of a response data packet type, determining whether to inquire session information corresponding to the session identifier according to the session identifier in the first data packet; the first data packet is a data packet managed by the first processing thread;
If not, deleting the first data packet;
if yes, deleting the session information, adding the first request domain name of the first data packet to the lock-free cache table of the first processing thread, and returning an access request response to the client device.
10. The apparatus of any of claims 6-9, wherein the M processing threads include P non-circular queues for buffering the respective data packets and access information corresponding to the respective data packets, where P is an integer equal to M.
11. An electronic device, comprising:
a memory for storing a computer program;
a processor for carrying out the method steps of any one of claims 1-5 when executing a computer program stored on said memory.
12. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored therein a computer program which, when executed by a processor, implements the method steps of any of claims 1-5.
CN202211595836.1A 2022-12-12 2022-12-12 Data processing method and device, electronic equipment and storage medium Pending CN116192799A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211595836.1A CN116192799A (en) 2022-12-12 2022-12-12 Data processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211595836.1A CN116192799A (en) 2022-12-12 2022-12-12 Data processing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116192799A true CN116192799A (en) 2023-05-30

Family

ID=86437320

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211595836.1A Pending CN116192799A (en) 2022-12-12 2022-12-12 Data processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116192799A (en)

Similar Documents

Publication Publication Date Title
US20200220840A1 (en) Method, server and system for resolving domain name
US10795826B2 (en) Translation lookaside buffer management method and multi-core processor
WO2015180648A1 (en) Resource allocation method and device
US20160070475A1 (en) Memory Management Method, Apparatus, and System
US20170153909A1 (en) Methods and Devices for Acquiring Data Using Virtual Machine and Host Machine
US8275947B2 (en) Mechanism to prevent illegal access to task address space by unauthorized tasks
CN114153754B (en) Data transmission method and device for computing cluster and storage medium
US9483523B2 (en) Information processing apparatus, distributed processing system, and distributed processing method
CN115964319A (en) Data processing method for remote direct memory access and related product
US20090199191A1 (en) Notification to Task of Completion of GSM Operations by Initiator Node
WO2023056797A1 (en) Blockchain-based data processing method, apparatus, and device, and storage medium
EP2568386A1 (en) Method for accessing cache and fictitious cache agent
CN114510321A (en) Resource scheduling method, related device and medium
EP3249539B1 (en) Method and device for accessing data visitor directory in multi-core system
WO2014190700A1 (en) Method of memory access, buffer scheduler and memory module
CN113157609A (en) Storage system, data processing method, data processing device, electronic device, and storage medium
CN109254858B (en) Data sharing method, device and equipment of active window and storage medium
US11914540B2 (en) On-chip integrated circuit, data processing device, and data processing method
CN116192799A (en) Data processing method and device, electronic equipment and storage medium
JP6607044B2 (en) Server device, distributed file system, distributed file system control method, and program
CN114637969A (en) Target object authentication method and device
CN115809222A (en) Log processing method, device and equipment and computer storage medium
CN112835873A (en) Power grid regulation and control heterogeneous system service access method, system, equipment and medium
CN117453380B (en) Cluster container group scheduling method, system and computer equipment
CN117749762A (en) DNS access request processing method, device, 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