[go: up one dir, main page]

CN111131074A - Data processing method, device, system, server and readable storage medium - Google Patents

Data processing method, device, system, server and readable storage medium Download PDF

Info

Publication number
CN111131074A
CN111131074A CN201811284562.8A CN201811284562A CN111131074A CN 111131074 A CN111131074 A CN 111131074A CN 201811284562 A CN201811284562 A CN 201811284562A CN 111131074 A CN111131074 A CN 111131074A
Authority
CN
China
Prior art keywords
internet traffic
traffic data
server
memory queue
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.)
Granted
Application number
CN201811284562.8A
Other languages
Chinese (zh)
Other versions
CN111131074B (en
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.)
China Mobile Communications Group Co Ltd
China Mobile Hangzhou Information Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Hangzhou Information 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 China Mobile Communications Group Co Ltd, China Mobile Hangzhou Information Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN201811284562.8A priority Critical patent/CN111131074B/en
Publication of CN111131074A publication Critical patent/CN111131074A/en
Application granted granted Critical
Publication of CN111131074B publication Critical patent/CN111131074B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明公开了一种数据处理方法、装置、系统、服务器及可读存储介质,该方法包括:接收上网流量数据包,获取发送所述上网流量数据包的网关路由器的标识信息;根据预先初始化的每个内存队列及所述标识信息,确定所述标识信息对应的目标内存队列;将所述上网流量数据包存入所述目标内存队列,并采用所述目标内存队列对应的单线程处理所述上网流量数据包。本发明中服务器将接收到的上网流量数据包存入对应的目标内存队列中,并采用目标内存队列对应的单线程处理该上网流量数据,避免了多线程处理数据的时效性无法保证,保证了发往下游业务系统的数据包的有序性,从而保证了下游业务系统能够准确分析出用户上网行为。

Figure 201811284562

The invention discloses a data processing method, device, system, server and readable storage medium. The method includes: receiving Internet traffic data packets, obtaining identification information of a gateway router sending the Internet traffic data packets; For each memory queue and the identification information, determine the target memory queue corresponding to the identification information; store the Internet traffic data packets in the target memory queue, and use the single thread corresponding to the target memory queue to process the Internet traffic data packets. In the present invention, the server stores the received Internet traffic data packets in the corresponding target memory queue, and uses the single thread corresponding to the target memory queue to process the Internet traffic data, thereby avoiding the inability to guarantee the timeliness of multi-threaded processing data, and ensuring The orderliness of the data packets sent to the downstream business system ensures that the downstream business system can accurately analyze the user's online behavior.

Figure 201811284562

Description

一种数据处理方法、装置、系统、服务器及可读存储介质A data processing method, device, system, server and readable storage medium

技术领域technical field

本发明涉及网络技术领域,尤其涉及一种数据处理方法、装置、系统、服务器及可读存储介质。The present invention relates to the field of network technologies, and in particular, to a data processing method, device, system, server and readable storage medium.

背景技术Background technique

用户终端通过WiFi与网关路由器连接,期间产生的上网流量数据的数据包会通过网关上的插件以UDP的形式发往远程服务器的UDP SERVER上,即网关路由器实时通过UDP的形式上报用户终端的上网流量数据的数据包,数据包的内容是二层数据包前面加上pcap包格式的头,通过UDP SERVER接收处理,UDP SERVER将数据包进行处理发往下游业务系统,下游业务系统可以根据用户完整有序的上网流量数据,准确分析出一个用户完整的上网行为。The user terminal is connected to the gateway router through WiFi, and the data packets of Internet traffic data generated during this period will be sent to the UDP SERVER of the remote server in the form of UDP through the plug-in on the gateway, that is, the gateway router will report the Internet access of the user terminal in the form of UDP in real time. The data packet of the traffic data, the content of the data packet is the header of the layer 2 data packet plus the pcap packet format, which is received and processed by the UDP SERVER, and the UDP SERVER processes the data packet and sends it to the downstream business system. Orderly Internet traffic data can accurately analyze a user's complete Internet behavior.

UDP SERVER通常会通过异步的形式对数据包进行处理,即通常会采用UDP SERVER中的多线程进行处理,如图1所示的数据传输架构中仅存在一个UDP SERVER,客户端1、客户端2及客户端M可以分别理解为网关路由器1,网关路由器2及网关路由器M,客户端1、客户端2及客户端M分别将用户终端的上网流量数据即数据包发送给对应的UDP SERVER,UDPSERVER将数据存入本地的内存队列,内存队列解耦,然后启动一个线程池,通过后台多线程包括线程1、线程2及线程N采用异步非阻塞的方式从内存队列中取出数据进行业务处理,然后将数据包发往下游业务系统。UDP SERVER usually processes data packets in an asynchronous form, that is, it usually uses multi-threading in UDP SERVER for processing. There is only one UDP SERVER in the data transmission architecture shown in Figure 1, client 1 and client 2. And client M can be understood as gateway router 1, gateway router 2 and gateway router M respectively, client 1, client 2 and client M respectively send the Internet traffic data of the user terminal, that is, data packets to the corresponding UDP SERVER, UDP SERVER The data is stored in the local memory queue, the memory queue is decoupled, and then a thread pool is started. Through the background multi-threads including thread 1, thread 2 and thread N, the data is taken out of the memory queue for business processing in an asynchronous and non-blocking manner, and then Send data packets to downstream business systems.

采用图1所示的数据传输架构,同一网关路由器的上网流量数据会被该一个UDPSERVER中的多个线程并发处理,但是由于多线程在处理数据包时处理完成的前后顺序无法保证,因此可能导致发送给下游业务系统的上网流量数据为乱序。并且在图1的基础上增加多个UDP SERVER,即如果UDP SERVER为集群部署,则同一网关路由器的上网流量数据可能会被转发到多台UDP SERVER中,而多台UDP SERVER中的多个线程的并发处理更加无法保证数据的时序性。Using the data transmission architecture shown in Figure 1, the Internet traffic data of the same gateway router will be processed concurrently by multiple threads in the same UDPSERVER. The Internet traffic data sent to the downstream business system is out of order. And add multiple UDP SERVERs on the basis of Figure 1, that is, if the UDP SERVER is deployed in a cluster, the Internet traffic data of the same gateway router may be forwarded to multiple UDP SERVERs, and multiple threads in multiple UDP SERVERs The concurrent processing of the data cannot guarantee the timing of the data.

综上所述,现有技术中多个发送方并发地发送数据,能够保证UDP SERVER中多个线程并发地从同一个内存队列中取数据,可以保证多个线程取数据的时序性,但是由于在高并发下,多个线程会并发地抢占该队列中的数据,每个数据包只能被处理一次,由于每个线程处理的时效性无法保证,有可能先拿到数据的线程,后处理完成,这就导致发往下游业务系统的数据出现了乱序,下游业务系统无法通过乱序的数据包分析出正确的用户上网行为,甚至有可能造成分析错误。To sum up, in the prior art, multiple senders send data concurrently, which can ensure that multiple threads in the UDP SERVER concurrently fetch data from the same memory queue, and can ensure the timing of multiple threads fetching data, but due to Under high concurrency, multiple threads will concurrently preempt the data in the queue, and each data packet can only be processed once. Since the timeliness of each thread's processing cannot be guaranteed, it is possible that the thread that gets the data first will process it later. After completion, the data sent to the downstream service system is out of order, and the downstream service system cannot analyze the correct user online behavior through the out-of-order data packets, and may even cause analysis errors.

发明内容SUMMARY OF THE INVENTION

本发明提供了一种数据处理方法、装置、系统、服务器及可读存储介质,用以解决现有技术中多线程处理数据的时效性无法保证,导致下游业务系统无法正确分析出用户上网行为的问题。The present invention provides a data processing method, device, system, server and readable storage medium, which are used to solve the problem that the timeliness of multi-threaded data processing in the prior art cannot be guaranteed, resulting in that the downstream business system cannot correctly analyze the user's online behavior. question.

本发明提供了一种数据处理方法,应用于服务器,该方法包括:The present invention provides a data processing method, which is applied to a server, and the method includes:

接收上网流量数据包,获取发送所述上网流量数据包的网关路由器的标识信息;Receive Internet traffic data packets, and obtain identification information of the gateway router that sends the Internet traffic data packets;

根据预先初始化的每个内存队列及所述标识信息,确定所述标识信息对应的目标内存队列;According to each pre-initialized memory queue and the identification information, determine the target memory queue corresponding to the identification information;

将所述上网流量数据包存入所述目标内存队列,并采用所述目标内存队列对应的单线程处理所述上网流量数据包。The Internet traffic data packets are stored in the target memory queue, and a single thread corresponding to the target memory queue is used to process the Internet traffic data packets.

进一步地,所述网关路由器的标识信息包括媒体访问控制MAC地址和/或互联网协议IP地址。Further, the identification information of the gateway router includes a media access control MAC address and/or an internet protocol IP address.

进一步地,如果所述网关路由器的标识信息包括MAC地址,所述根据预先初始化的每个内存队列及所述标识信息,确定所述标识信息对应的目标内存队列包括:Further, if the identification information of the gateway router includes a MAC address, determining the target memory queue corresponding to the identification information according to each pre-initialized memory queue and the identification information includes:

确定预先初始化的内存队列的数量,及每个内存队列的序号;Determine the number of pre-initialized memory queues, and the sequence number of each memory queue;

将所述MAC地址进行哈希处理,得到所述MAC地址的哈希值;performing hash processing on the MAC address to obtain a hash value of the MAC address;

根据所述内存队列的数量及所述MAC地址的哈希值,确定所述MAC地址对应的目标内存队列的序号。The sequence number of the target memory queue corresponding to the MAC address is determined according to the number of the memory queues and the hash value of the MAC address.

进一步地,所述根据所述内存队列的数量及所述MAC地址的哈希值,确定所述MAC地址对应的目标内存队列的序号包括:Further, determining the sequence number of the target memory queue corresponding to the MAC address according to the number of the memory queues and the hash value of the MAC address includes:

将所述MAC地址的哈希值对所述内存队列的数量取模,根据所述取模的结果确定所述MAC地址对应的目标内存队列的序号。The hash value of the MAC address is modulo the number of the memory queues, and the sequence number of the target memory queue corresponding to the MAC address is determined according to the result of the modulo.

进一步地,所述接收上网流量数据包包括:Further, the receiving Internet traffic data packets includes:

接收负载均衡服务器发送的上网流量数据包,其中所述上网流量数据包为所述负载均衡服务器根据获取到的发送所述上网流量数据包的网关路由器的出口IP地址,确定所述出口IP地址对应的服务器后发送给所述服务器的。Receive the Internet traffic data packet sent by the load balancing server, wherein the Internet traffic data packet is determined by the load balancing server according to the obtained egress IP address of the gateway router that sends the Internet traffic data packet. The egress IP address corresponds to sent to the server after the server.

进一步地,所述采用所述目标内存队列对应的单线程处理所述上网流量数据包后,所述方法还包括:Further, after the single thread corresponding to the target memory queue is used to process the Internet traffic data packets, the method further includes:

采用所述目标内存队列对应的单线程,将处理后的所述上网流量数据包发送给对应的下游设备。Using the single thread corresponding to the target memory queue, the processed Internet traffic data packets are sent to the corresponding downstream devices.

本发明提供了一种数据处理装置,应用于服务器,该装置包括:The present invention provides a data processing device applied to a server, the device comprising:

获取模块,用于接收上网流量数据包,获取发送所述上网流量数据包的网关路由器的标识信息;an acquisition module, used for receiving Internet traffic data packets, and acquiring the identification information of the gateway router that sends the Internet traffic data packets;

确定模块,用于根据预先初始化的每个内存队列及所述标识信息,确定所述标识信息对应的目标内存队列;a determining module, configured to determine the target memory queue corresponding to the identification information according to each pre-initialized memory queue and the identification information;

处理模块,用于将所述上网流量数据包存入所述目标内存队列,并采用所述目标内存队列对应的单线程处理所述上网流量数据包。A processing module, configured to store the Internet traffic data packets in the target memory queue, and use a single thread corresponding to the target memory queue to process the Internet traffic data packets.

本发明提供了一种服务器,包括存储器、处理器和收发机;The present invention provides a server, including a memory, a processor and a transceiver;

所述处理器,用于读取所述存储器中的程序,执行下列过程:控制所述收发机接收上网流量数据包,获取发送所述上网流量数据包的网关路由器的标识信息;根据预先初始化的每个内存队列及所述标识信息,确定所述标识信息对应的目标内存队列;将所述上网流量数据包存入所述目标内存队列,并采用所述目标内存队列对应的单线程处理所述上网流量数据包。The processor is configured to read the program in the memory, and execute the following processes: controlling the transceiver to receive Internet traffic data packets, and acquiring the identification information of the gateway router that sends the Internet traffic data packets; For each memory queue and the identification information, determine the target memory queue corresponding to the identification information; store the Internet traffic data packets in the target memory queue, and use the single thread corresponding to the target memory queue to process the Internet traffic data packets.

进一步地,所述处理器,具体用于如果所述网关路由器的标识信息包括MAC地址,确定预先初始化的内存队列的数量,及每个内存队列的序号;将所述MAC地址进行哈希处理,得到所述MAC地址的哈希值;根据所述内存队列的数量及所述MAC地址的哈希值,确定所述MAC地址对应的目标内存队列的序号。Further, the processor is specifically configured to determine the number of pre-initialized memory queues and the sequence number of each memory queue if the identification information of the gateway router includes a MAC address; perform hash processing on the MAC address, Obtain the hash value of the MAC address; determine the sequence number of the target memory queue corresponding to the MAC address according to the number of the memory queues and the hash value of the MAC address.

进一步地,所述处理器,具体用于将所述MAC地址的哈希值对所述内存队列的数量取模,根据所述取模的结果确定所述MAC地址对应的目标内存队列的序号。Further, the processor is specifically configured to take the hash value of the MAC address modulo the number of the memory queues, and determine the sequence number of the target memory queue corresponding to the MAC address according to the result of the modulo.

进一步地,所述处理器,具体用于控制所述收发机接收负载均衡服务器发送的上网流量数据包,其中所述上网流量数据包为所述负载均衡服务器根据获取到的发送所述上网流量数据包的网关路由器的出口IP地址,确定所述出口IP地址对应的服务器后发送给所述服务器的。Further, the processor is specifically configured to control the transceiver to receive the Internet traffic data packet sent by the load balancing server, wherein the Internet traffic data packet is the Internet traffic data sent by the load balancing server according to the obtained data. The egress IP address of the gateway router of the packet is sent to the server after determining the server corresponding to the egress IP address.

进一步地,所述处理器,还用于采用所述目标内存队列对应的单线程处理所述上网流量数据包后,采用所述目标内存队列对应的单线程,将处理后的所述上网流量数据包发送给对应的下游设备。Further, the processor is further configured to use the single thread corresponding to the target memory queue to process the Internet traffic data packets by using the single thread corresponding to the target memory queue, and use the single thread corresponding to the target memory queue to process the Internet traffic data after processing. The packet is sent to the corresponding downstream device.

本发明提供了一种服务器,包括:处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;The invention provides a server, comprising: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;

所述存储器中存储有计算机程序,当所述程序被所述处理器执行时,使得所述处理器执行上述任一项求所述方法的步骤。A computer program is stored in the memory, and when the program is executed by the processor, the processor causes the processor to perform any one of the above steps of the method.

本发明提供了一种计算机可读存储介质,其存储有可由服务器执行的计算机程序,当所述程序在所述服务器上运行时,使得所述服务器执行上述任一项所述方法的步骤。The present invention provides a computer-readable storage medium, which stores a computer program executable by a server, and when the program runs on the server, causes the server to perform the steps of any one of the above-mentioned methods.

本发明提供了一种数据处理系统,所述数据处理系统包括网关路由器及服务器;其中,The present invention provides a data processing system, the data processing system includes a gateway router and a server; wherein,

所述网关路由器,用于向服务器发送上网流量数据包;The gateway router is used to send Internet traffic data packets to the server;

所述服务器,用于接收上网流量数据包,获取发送所述上网流量数据包的网关路由器的标识信息;根据预先初始化的每个内存队列及所述标识信息,确定所述标识信息对应的目标内存队列;将所述上网流量数据包存入所述目标内存队列,并采用所述目标内存队列对应的单线程处理所述上网流量数据包。The server is used to receive the Internet traffic data packets, and obtain the identification information of the gateway router that sends the Internet traffic data packets; according to each pre-initialized memory queue and the identification information, determine the target memory corresponding to the identification information queue; store the Internet traffic data packets in the target memory queue, and use the single thread corresponding to the target memory queue to process the Internet traffic data packets.

进一步地,所述服务器,具体用于如果所述网关路由器的标识信息包括MAC地址,确定预先初始化的内存队列的数量,及每个内存队列的序号;将所述MAC地址进行哈希处理,得到所述MAC地址的哈希值;根据所述内存队列的数量及所述MAC地址的哈希值,确定所述MAC地址对应的目标内存队列的序号。Further, the server is specifically configured to determine the number of pre-initialized memory queues and the serial number of each memory queue if the identification information of the gateway router includes a MAC address; perform hash processing on the MAC address to obtain The hash value of the MAC address; the serial number of the target memory queue corresponding to the MAC address is determined according to the number of the memory queues and the hash value of the MAC address.

进一步地,所述服务器,具体用于将所述MAC地址的哈希值对所述内存队列的数量取模,根据所述取模的结果确定所述MAC地址对应的目标内存队列的序号。Further, the server is specifically configured to take the hash value of the MAC address modulo the number of the memory queues, and determine the sequence number of the target memory queue corresponding to the MAC address according to the result of the modulo.

进一步地,所述系统还包括:Further, the system also includes:

负载均衡服务器,用于接收所述网关路由器发送的上网流量数据包;根据获取到的发送所述上网流量数据包的网关路由器的出口IP地址,确定所述出口IP地址对应的所述服务器,并将所述上网流量数据包发送给所述服务器的;a load balancing server, configured to receive the Internet traffic data packets sent by the gateway router; according to the obtained egress IP address of the gateway router that sends the Internet traffic data packets, determine the server corresponding to the egress IP address, and sending the Internet traffic data packet to the server;

所述服务器,具体用于接收所述负载均衡服务器发送的上网流量数据包。The server is specifically configured to receive Internet traffic data packets sent by the load balancing server.

进一步地,所述系统还包括:下游设备;其中,Further, the system further includes: downstream equipment; wherein,

所述服务器,还用于采用所述目标内存队列对应的单线程处理所述上网流量数据包后,采用所述目标内存队列对应的单线程,将处理后的所述上网流量数据包发送给对应的下游设备。The server is further configured to use the single thread corresponding to the target memory queue to process the Internet traffic data packets, and use the single thread corresponding to the target memory queue to send the processed Internet traffic data packets to the corresponding downstream equipment.

本发明提供了一种数据处理方法、装置、系统、服务器及可读存储介质,该方法包括:接收上网流量数据包,获取发送所述上网流量数据包的网关路由器的标识信息;根据预先初始化的每个内存队列及所述标识信息,确定所述标识信息对应的目标内存队列;将所述上网流量数据包存入所述目标内存队列,并采用所述目标内存队列对应的单线程处理所述上网流量数据包。本发明中服务器将接收到的上网流量数据包存入对应的目标内存队列中,并采用目标内存队列对应的单线程处理该上网流量数据,避免了多线程处理数据的时效性无法保证,保证了发往下游业务系统的数据包的有序性,从而保证了下游业务系统能够准确分析出用户上网行为。The present invention provides a data processing method, device, system, server and readable storage medium. The method includes: receiving Internet traffic data packets, obtaining identification information of a gateway router sending the Internet traffic data packets; For each memory queue and the identification information, determine the target memory queue corresponding to the identification information; store the Internet traffic data packets in the target memory queue, and use the single thread corresponding to the target memory queue to process the Internet traffic data packets. In the present invention, the server stores the received Internet traffic data packets in the corresponding target memory queue, and uses the single thread corresponding to the target memory queue to process the Internet traffic data, thereby avoiding the inability to guarantee the timeliness of multi-threaded data processing and ensuring The orderliness of the data packets sent to the downstream business system ensures that the downstream business system can accurately analyze the user's online behavior.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained according to these drawings without creative efforts.

图1为现有技术提供的一种数据处理架构的示意图;1 is a schematic diagram of a data processing architecture provided by the prior art;

图2为本发明实施例1提供的一种数据处理过程的示意图;2 is a schematic diagram of a data processing process according to Embodiment 1 of the present invention;

图3为本发明实施例1提供的数据处理架构的示意图;3 is a schematic diagram of a data processing architecture provided in Embodiment 1 of the present invention;

图4为本发明实施例5提供的数据处理架构的示意图;4 is a schematic diagram of a data processing architecture provided in Embodiment 5 of the present invention;

图5为本发明实施例6提供的一种服务器的结构示意图;5 is a schematic structural diagram of a server according to Embodiment 6 of the present invention;

图6为本发明实施例6提供的一种服务器的结构示意图;6 is a schematic structural diagram of a server according to Embodiment 6 of the present invention;

图7为本发明实施例6提供的一种服务器的结构示意图;7 is a schematic structural diagram of a server according to Embodiment 6 of the present invention;

图8为本发明实施例7提供的一种服务器的结构示意图;8 is a schematic structural diagram of a server according to Embodiment 7 of the present invention;

图9为本发明实施例8提供的一种服务器的结构示意图;9 is a schematic structural diagram of a server according to Embodiment 8 of the present invention;

图10为本发明实施例提供的一种数据处理装置示意图。FIG. 10 is a schematic diagram of a data processing apparatus according to an embodiment of the present invention.

具体实施方式Detailed ways

为了保证数据处理的时效性,从而保证下游业务系统能够准确分析出用户上网行为,本发明实施例提供了一种数据处理方法、装置、系统、服务器及可读存储介质。In order to ensure the timeliness of data processing, so that the downstream business system can accurately analyze the user's online behavior, the embodiments of the present invention provide a data processing method, device, system, server and readable storage medium.

为了使本发明的目的、技术方案和优点更加清楚,下面将结合附图本发明作进一步地详细描述,显然,所描述的实施例仅仅是本发明的一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a 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 those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

实施例1:Example 1:

图2为本发明实施例提供的一种数据处理过程的示意图,该过程包括以下步骤:2 is a schematic diagram of a data processing process provided by an embodiment of the present invention, and the process includes the following steps:

S201:接收上网流量数据包,获取发送所述上网流量数据包的网关路由器的标识信息。S201: Receive an Internet traffic data packet, and obtain identification information of a gateway router that sends the Internet traffic data packet.

本发明实施例提供的数据处理方法应用于服务器,具体该服务器为UDP SERVER,该UDP SERVER可以为物理服务器或虚拟服务器。The data processing method provided by the embodiment of the present invention is applied to a server. Specifically, the server is a UDP SERVER, and the UDP SERVER may be a physical server or a virtual server.

该服务器可以接收上网流量数据包,服务器接收到的上网流量数据包为网关路由器上报的终端的上网流量数据包,通常同一网关路由器按照终端发送的顺序上报上网流量数据包,即同一网关路由器上报的上网流量数据包能够保证有序性。The server can receive Internet traffic data packets. The Internet traffic data packets received by the server are the Internet traffic data packets of the terminal reported by the gateway router. Usually, the same gateway router reports the Internet traffic data packets in the order sent by the terminal, that is, the same gateway router reports the Internet traffic data packets. Internet traffic data packets can ensure orderliness.

由于网关路由器向服务器上报终端的上网流量数据包,因此服务器在获取发送上网流量数据包的网关路由器的标识信息时,可以在接收到的上网流量数据包中查找到发送该上网流量数据包的标识信息,该上网流量数据包的标识信息可以为上网流量数据包中的某个或某些特征字段。Since the gateway router reports the terminal's Internet traffic data packets to the server, when the server obtains the identification information of the gateway router that sends the Internet traffic data packets, it can find the identification of the Internet traffic data packets sent in the received Internet traffic data packets. information, the identification information of the Internet traffic data packet may be one or some characteristic fields in the Internet traffic data packet.

所述网关路由器的标识信息包括MAC(Media Access Control,媒体访问控制)地址和/或IP(Internet Protocol,互联网协议)地址。该网关路由器的标识信息可以唯一标识一个网关路由器。The identification information of the gateway router includes a MAC (Media Access Control, media access control) address and/or an IP (Internet Protocol, Internet Protocol) address. The identification information of the gateway router can uniquely identify a gateway router.

S202:根据预先初始化的每个内存队列及所述标识信息,确定所述标识信息对应的目标内存队列。S202: Determine a target memory queue corresponding to the identification information according to each pre-initialized memory queue and the identification information.

服务器获取发送上网流量数据包的网关路由器的标识信息后,可以根据预先初始化的每个内存队列及获取到的该标识信息,确定该标识信息对应的目标内存队列。After the server obtains the identification information of the gateway router that sends the Internet traffic data packets, it can determine the target memory queue corresponding to the identification information according to each pre-initialized memory queue and the obtained identification information.

服务器中预先初始化了多个内存队列,如预先初始化的内存队列的数量为N,该服务器预先初始化内存队列时可以是在服务器硬件允许的范围内初始化。Multiple memory queues are pre-initialized in the server. For example, the number of pre-initialized memory queues is N. When the server pre-initializes the memory queues, it may be initialized within the range allowed by the server hardware.

服务器根据预先初始化的每个内存队列及该网关路由器的标识信息,确定该标识信息对应的目标内存队列,可以是服务器中预先保存有每个内存队列及每个网关路由器的标识信息的对应关系,从而确定该标识信息对应的目标内存队列,可以是根据预先保存的算法fun(特征字段,N),fun代表某种算法,入参为特征字段和队列数N,该特征字段可以理解为网关路由器的标识信息,从而确定该标识信息对应的目标内存队列等。The server determines the target memory queue corresponding to the identification information according to the pre-initialized identification information of each memory queue and the gateway router. To determine the target memory queue corresponding to the identification information, it can be based on a pre-saved algorithm fun(feature field, N), where fun represents a certain algorithm, and the input parameters are the feature field and the number of queues N, and the feature field can be understood as the gateway router. identification information, so as to determine the target memory queue corresponding to the identification information, etc.

S203:将所述上网流量数据包存入所述目标内存队列,并采用所述目标内存队列对应的单线程处理所述上网流量数据包。S203: Store the Internet traffic data packets in the target memory queue, and use a single thread corresponding to the target memory queue to process the Internet traffic data packets.

服务器在预先初始化内存队列时,还可以在硬件允许的范围内初始化一个线程池,其中线程池中的每个线程与内存队列一一对应,即每个内存队列均存在其对应的单线程,因此线程池的大小与内存队列的数量一致,例如当预先初始化的内存队列的数量为N时,线程池的大小也为N,由于线程池的初始化比较依赖于服务器的硬件资源,因此可以先在硬件允许的范围内初始化一个大小N的线程池,然后再初始化与线程池大小相同的N个内存队列。When the server pre-initializes the memory queue, it can also initialize a thread pool within the range allowed by the hardware, in which each thread in the thread pool corresponds to the memory queue one-to-one, that is, each memory queue has its corresponding single thread, so The size of the thread pool is the same as the number of memory queues. For example, when the number of pre-initialized memory queues is N, the size of the thread pool is also N. Since the initialization of the thread pool is relatively dependent on the hardware resources of the server, it can be done in the hardware first. Initialize a thread pool of size N within the allowed range, and then initialize N memory queues of the same size as the thread pool.

为了保证数据包被处理的顺序和接收数据包的顺序保持一致有序,可以寻找数据包中的某个或某些特征字段,利用该字段通过某种算法将数据平均分布到多个内存队列中,让单个线程同步阻塞的处理,防止多个线程处理具有同样特征字段的数据包,使得原先的单一内存队列多个线程抢占式的处理方式出现的数据包乱序问题得到解决,满足同样特征的数据包严格有序,最终解决了由于数据包乱序导致流量分析异常的问题。因此将上网流量数据包存入确定的该目标内存队列,采用该目标内存队列对应的单线程处理该上网流量数据包。In order to ensure that the order in which the data packets are processed is consistent with the order in which the data packets are received, you can find one or some characteristic fields in the data packets, and use this field to distribute the data evenly into multiple memory queues through an algorithm. , allowing a single thread to synchronously block the processing, preventing multiple threads from processing data packets with the same characteristic fields, and solving the problem of out-of-order data packets in the original single memory queue multi-thread preemptive processing method, satisfying the same characteristics. The data packets are strictly ordered, which finally solves the problem of abnormal traffic analysis caused by out-of-order data packets. Therefore, the Internet traffic data packets are stored in the determined target memory queue, and the single thread corresponding to the target memory queue is used to process the Internet traffic data packets.

图3为本发明实施例提供的数据处理架构的示意图,该数据处理架构中存在一个服务器UDP SERVER,客户端1、客户端2及客户端M可以分别理解为网关路由器1,网关路由器2及网关路由器M,客户端1、客户端2及客户端M分别将用户终端的上网流量数据即数据包发送给该UDP SERVER,UDP SERVER接收到上网流量数据包后,根据预先保存的fun(特征字段,N)规则,计算上网流量数据包的队列号,并将上网流量数据包存入对应的目标内存队列,如果存入内存队列,则采用该内存队列对应的单线程1处理该上网流量数据包,如果存入内存队列2,则采用该内存队列2对应的单线程2处理该上网流量数据包,如果存入内存队列3,则采用该内存队列N对应的单线程N处理该上网流量数据包。此时同一网关路由器的上网流量数据会被该一个UDP SERVER中对应内存队列的单线程处理,单线程在处理数据包时的顺序与接收数据包的顺序一致,因此可以保证发送给下游业务系统的上网流量数据包具有有序性。3 is a schematic diagram of a data processing architecture provided by an embodiment of the present invention. There is a server UDP SERVER in the data processing architecture, and client 1, client 2 and client M can be respectively understood as gateway router 1, gateway router 2 and gateway Router M, client 1, client 2 and client M respectively send the Internet traffic data of the user terminal, that is, data packets, to the UDP SERVER. After the UDP SERVER receives the Internet traffic data packets, according to the pre-saved fun(feature field, N) rule, calculate the queue number of the Internet traffic data packet, and store the Internet traffic data packet into the corresponding target memory queue, if stored in the memory queue, use the single thread 1 corresponding to the memory queue to process the Internet traffic data packet, If it is stored in the memory queue 2, the single thread 2 corresponding to the memory queue 2 is used to process the Internet traffic data packet; if it is stored in the memory queue 3, the single thread N corresponding to the memory queue N is used to process the Internet traffic data packet. At this time, the Internet traffic data of the same gateway router will be processed by the single thread corresponding to the memory queue in the one UDP SERVER. The sequence of processing the data packets by the single thread is the same as the sequence of receiving the data packets, so the data sent to the downstream business system can be guaranteed. Internet traffic data packets are ordered.

本发明实施例中服务器将接收到的上网流量数据包存入对应的目标内存队列中,并采用目标内存队列对应的单线程处理该上网流量数据,避免了多线程处理数据的时效性无法保证,保证了发往下游业务系统的数据包的有序性,从而保证了下游业务系统能够准确分析出用户上网行为。In the embodiment of the present invention, the server stores the received Internet traffic data packets in the corresponding target memory queue, and uses the single thread corresponding to the target memory queue to process the Internet traffic data, which avoids that the timeliness of multi-threaded processing data cannot be guaranteed. The order of the data packets sent to the downstream business system is ensured, thereby ensuring that the downstream business system can accurately analyze the user's online behavior.

实施例2:Example 2:

在上述实施例的基础上,本发明实施例中,所述采用所述目标内存队列对应的单线程处理所述上网流量数据包后,所述方法还包括:On the basis of the above embodiment, in the embodiment of the present invention, after the single thread corresponding to the target memory queue is used to process the Internet traffic data packet, the method further includes:

采用所述目标内存队列对应的单线程,将处理后的所述上网流量数据包发送给对应的下游设备。Using the single thread corresponding to the target memory queue, the processed Internet traffic data packets are sent to the corresponding downstream devices.

为了保证下游业务系统能够准确分析出用户完整的上网行为,服务器采用目标内存队列对应的单线程处理上网流量数据包后,采用目标内存队列对应的单线程,将处理后的上网流量数据包发送给下游设备,由于单线程发送处理后的上网流量数据包的顺序,与单线程接收并处理上网流量数据包的顺序一致,因此可以保证下游设备接收到的数据的时间顺序是有序的,因此可以准确分析出用户完整的上网行为。In order to ensure that the downstream business system can accurately analyze the complete Internet behavior of users, the server uses the single thread corresponding to the target memory queue to process the Internet traffic data packets, and uses the single thread corresponding to the target memory queue to send the processed Internet traffic data packets to The downstream device, because the sequence of sending the processed Internet traffic data packets by a single thread is consistent with the sequence in which the single thread receives and processes Internet traffic data packets, so it can ensure that the time sequence of the data received by the downstream device is in order, so it can be Accurately analyze the complete online behavior of users.

该下游设备为安装有下游业务系统的下游设备,具体地,该下游设备可以为消息中间件。The downstream device is a downstream device installed with a downstream service system, and specifically, the downstream device may be a message middleware.

实施例3:Example 3:

为了保证同一网关路由器发送的上网流量数据包能够严格有序地存入对应的内存队列,在上述各实施例的基础上,本发明实施例中,如果所述网关路由器的标识信息包括MAC地址,所述根据预先初始化的每个内存队列及所述标识信息,确定所述标识信息对应的目标内存队列包括:In order to ensure that the Internet traffic data packets sent by the same gateway router can be stored in the corresponding memory queue in a strict and orderly manner, on the basis of the above embodiments, in this embodiment of the present invention, if the identification information of the gateway router includes a MAC address, The determining of the target memory queue corresponding to the identification information according to each pre-initialized memory queue and the identification information includes:

确定预先初始化的内存队列的数量,及每个内存队列的序号;Determine the number of pre-initialized memory queues, and the sequence number of each memory queue;

将所述MAC地址进行哈希处理,得到所述MAC地址的哈希值;performing hash processing on the MAC address to obtain a hash value of the MAC address;

根据所述内存队列的数量及所述MAC地址的哈希值,确定所述MAC地址对应的目标内存队列的序号。The sequence number of the target memory queue corresponding to the MAC address is determined according to the number of the memory queues and the hash value of the MAC address.

如果服务器根据预先保存的算法fun(特征字段,N)确定该标识信息对应的目标内存队列,则为了保证上网流量数据包能够有序存入对应的内存队列,服务器可以根据网关路由器的MAC地址及每个内存队列的序号来实现目标内存队列的确定。If the server determines the target memory queue corresponding to the identification information according to the pre-stored algorithm fun (feature field, N), in order to ensure that the Internet traffic data packets can be stored in the corresponding memory queue in an orderly manner, the server can use the gateway router's MAC address and The sequence number of each memory queue to achieve the determination of the target memory queue.

因为服务器预先初始化有内存队列,因此服务器可以确定预先初始化的内存队列的数量,并且确定每个内存队列的序号。该每个内存队列的序号可以为预先初始化时确定的,每个内存队列的序号可以为按照顺序如1-N的序号,可以为人为设置的其他序号等。Because the server has pre-initialized memory queues, the server can determine the number of pre-initialized memory queues and determine the sequence number of each memory queue. The serial number of each memory queue may be determined in advance, and the serial number of each memory queue may be a serial number in a sequence such as 1-N, or other serial numbers set manually.

为了保证同一网关路由器的上网流量数据包存入同一个内存队列中,服务器可以将网关路由器的MAC地址进行哈希处理,得到该MAC地址的哈希值,该MAC地址的哈希值具有唯一性。In order to ensure that the Internet traffic data packets of the same gateway router are stored in the same memory queue, the server can hash the MAC address of the gateway router to obtain the hash value of the MAC address. The hash value of the MAC address is unique .

将包括MAC地址在内的信息进行哈希处理的过程可以通过现有技术实现,在本发明实施例中不做赘述。The process of hashing the information including the MAC address can be implemented by the prior art, and details are not described in this embodiment of the present invention.

服务器确定MAC地址的哈希值,可以根据内存队列的数量及所述MAC地址的哈希值,确定MAC地址对应的目标内存队列的序号,具体可以是根据MAC地址的哈希值与内存队列的数量的取模结果,确定MAC地址对应的目标内存队列的序号,可以是根据MAC地址的哈希值与内存队列的数量的取余结果,确定MAC地址对应的目标内存队列的序号等。The server determines the hash value of the MAC address, and can determine the sequence number of the target memory queue corresponding to the MAC address according to the number of memory queues and the hash value of the MAC address, which can be specifically based on the hash value of the MAC address and the memory queue. The result of taking the modulo of the number to determine the serial number of the target memory queue corresponding to the MAC address may be based on the result of taking the remainder of the hash value of the MAC address and the number of memory queues to determine the serial number of the target memory queue corresponding to the MAC address, etc.

服务器在确定MAC地址对应的目标内存对应的序号后,将接收到的上网流量数据包存入到确定的序号对应的目标内存队列中。After determining the sequence number corresponding to the target memory corresponding to the MAC address, the server stores the received Internet traffic data packets in the target memory queue corresponding to the determined sequence number.

实施例4:Example 4:

在上述各实施例的基础上,本发明实施例中,所述根据所述内存队列的数量及所述MAC地址的哈希值,确定所述MAC地址对应的目标内存队列的序号包括:On the basis of the foregoing embodiments, in this embodiment of the present invention, determining the sequence number of the target memory queue corresponding to the MAC address according to the number of the memory queues and the hash value of the MAC address includes:

将所述MAC地址的哈希值对所述内存队列的数量取模,根据所述取模的结果确定所述MAC地址对应的目标内存队列的序号。The hash value of the MAC address is modulo the number of the memory queues, and the sequence number of the target memory queue corresponding to the MAC address is determined according to the result of the modulo.

为了进一步保证单线程处理数据的顺序和收包的顺序一致有序,服务器可以通过MAC地址的哈希值对内存队列的数量取模使得同一网关路由器的上网流量数据包存入同一内存队列中,每个内存队列只有一个单线程在处理,从而保证对于同一网关路由器来说,就是同步阻塞的方式在处理数据,那么就能实现数据被处理的顺序与被接收的顺序保持一致有序。In order to further ensure that the order of single-threaded processing of data and the order of receiving packets are consistent and orderly, the server can use the hash value of the MAC address to modulo the number of memory queues so that the Internet traffic data packets of the same gateway router are stored in the same memory queue. Each memory queue is processed by only one single thread, thus ensuring that for the same gateway router, the data is processed in a synchronous blocking manner, so that the order in which the data is processed is consistent with the order in which it is received.

因此服务器根据内存队列的数量及MAC地址的哈希值,确定MAC地址对应的目标内存队列的序号时,服务器将MAC地址的哈希值对内存队列的数量取模,根据取模的结果确定MAC地址对应的目标内存队列的序号,具体地,如果内存队列的序号是按照顺序排列的,服务器可以直接将MAC地址的哈希值对内存队列的数量取模的结果,作为MAC地址对应的目标内存队列的序号,如果内存队列的序号是人为设置的不具有规律性,服务器根据MAC地址的哈希值对内存队列的数量取模的结果,及预先保存的不同取模结果与内存队列的序号的对应关系,确定取模的结果对应的目标内存队列的序号等。Therefore, when the server determines the serial number of the target memory queue corresponding to the MAC address according to the number of memory queues and the hash value of the MAC address, the server modulizes the hash value of the MAC address to the number of memory queues, and determines the MAC address according to the result of the modulo. The serial number of the target memory queue corresponding to the address. Specifically, if the serial numbers of the memory queues are arranged in order, the server can directly use the hash value of the MAC address modulo the number of memory queues as the target memory corresponding to the MAC address. The serial number of the queue. If the serial number of the memory queue is artificially set without regularity, the server modulo the number of the memory queue according to the hash value of the MAC address, and the difference between the pre-saved modulo results and the serial number of the memory queue. Correspondence, determine the sequence number of the target memory queue corresponding to the result of the modulo, etc.

由于本发明实施例中根据MAC地址的哈希值对内存队列的数量取模的结果,确定MAC地址对应的目标内存队列的序号,从而能够保证单线程处理数量的顺序和接收数据的顺序一致,从而保证下游业务系统能够准确分析出用户上网行为。Because in the embodiment of the present invention, the sequence number of the target memory queue corresponding to the MAC address is determined according to the result of taking the modulo of the number of memory queues based on the hash value of the MAC address, so that the order of the number of single-threaded processing can be guaranteed to be consistent with the order of received data. This ensures that the downstream business system can accurately analyze the user's online behavior.

实施例5:Example 5:

在上述各实施例的基础上,本发明实施例中,所述接收上网流量数据包包括:On the basis of the foregoing embodiments, in this embodiment of the present invention, the receiving Internet traffic data packets includes:

接收负载均衡服务器发送的上网流量数据包,其中所述上网流量数据包为所述负载均衡服务器根据获取到的发送所述上网流量数据包的网关路由器的出口IP地址,确定所述出口IP地址对应的服务器后发送给所述服务器的。Receive the Internet traffic data packet sent by the load balancing server, wherein the Internet traffic data packet is determined by the load balancing server according to the obtained egress IP address of the gateway router that sends the Internet traffic data packet. The egress IP address corresponds to sent to the server after the server.

如果UDP SERVER为集群部署,负载均衡器按照round-robin算法,将网关路由器的数据包平均轮询转发到UDP SERVER中,因此在集群部署UDP SERVER时仍然会存在少量的数据包乱序的问题,为了从根本上解决此问题,还需要对负载均衡服务器进行改造。If the UDP SERVER is deployed in a cluster, the load balancer forwards the data packets of the gateway router to the UDP SERVER according to the round-robin algorithm, so there will still be a small number of out-of-order data packets when the UDP SERVER is deployed in the cluster. In order to fundamentally solve this problem, the load balancing server needs to be transformed.

负载均衡服务器可以部署在网关路由器及服务器之间,网关路由器发送给服务器的上网流量数据包被负载均衡服务器先接收到,负载均衡服务器可以按照每个网关路由器的出口IP地址进行负载均衡,同一出口IP地址对应的上网流量数据包只会被转发到对应固定的服务器中进行处理,避免了同一网关路由器的上网流量数据包被多台服务器处理的情况发生。The load balancing server can be deployed between the gateway router and the server. The Internet traffic data packets sent by the gateway router to the server are first received by the load balancing server. The load balancing server can perform load balancing according to the egress IP address of each gateway router. The Internet traffic data packets corresponding to the IP addresses will only be forwarded to the corresponding fixed server for processing, which avoids the situation that the Internet traffic data packets of the same gateway router are processed by multiple servers.

负载均衡服务器接收到网关路由器发送给服务器的上网流量数据包后,获取该网关路由器的出口IP地址,根据预先保存的出口IP地址与服务器的对应关系,确定该网关路由器的出口IP地址对应的服务器,然后将接收到的该上网流量数据包转发给该网关路由器的出口IP地址对应的服务器。After receiving the Internet traffic data packets sent by the gateway router to the server, the load balancing server obtains the egress IP address of the gateway router, and determines the server corresponding to the egress IP address of the gateway router according to the pre-stored correspondence between the egress IP address and the server. , and then forward the received Internet traffic data packets to the server corresponding to the egress IP address of the gateway router.

图4为本发明实施例提供的数据处理架构的示意图,为在图3基础上改进的数据处理架构进行改进,该数据处理架构中存在多个服务器UDP SERVER构成的服务器集群,以及负载均衡器即负载均衡服务器,客户端1、客户端2及客户端M并发将用户终端的上网流量数据即数据包发送给负载均衡服务器,以负载均衡服务器接收到客户端1即网关路由器1发送的上网流量数据包为例,负载均衡服务器解析客户端1的出口IP地址,并根据预先保存的出口IP地址与服务器的对应关系,将上网流量数据包转发给客户端1的出口IP地址对应的服务器,能够保证同一个出口IP地址的上网流量数据包转发到同一服务器UDP SERVER,同一个客户端发送的数据包不会出现在两台或者多台UDP SERVER上。服务器的数据处理过程与图3相似,服务器解析上网流量数据包,获取相应的特征字段fdata,该特征字段fdata为客户端的标识信息如MAC地址,根据queueNum=fun(fdata,N)计算出内存队列的序号,N为线程数或者队列数,将上网流量数据包存入对应序号的目标内存队列中,目标内存队列对应的单线程从目标内存队列中pop数据进行后处理,单线程将处理后的数据传输至下游业务系统。FIG. 4 is a schematic diagram of a data processing architecture provided by an embodiment of the present invention, which is an improvement for the data processing architecture improved on the basis of FIG. 3. In the data processing architecture, there is a server cluster composed of multiple servers UDP SERVERs, and a load balancer is The load balancing server, client 1, client 2 and client M concurrently send the Internet traffic data of the user terminal, that is, data packets, to the load balancing server, and the load balancing server receives the Internet traffic data sent by client 1, that is, gateway router 1. Packet as an example, the load balancing server parses the egress IP address of client 1, and forwards the Internet traffic data packets to the server corresponding to the egress IP address of client 1 according to the pre-stored correspondence between the egress IP address and the server, ensuring that The Internet traffic data packets of the same egress IP address are forwarded to the same server UDP SERVER, and the data packets sent by the same client will not appear on two or more UDP SERVERs. The data processing process of the server is similar to Figure 3. The server parses the Internet traffic data packets and obtains the corresponding characteristic field fdata. The characteristic field fdata is the identification information of the client such as the MAC address, and the memory queue is calculated according to queueNum=fun(fdata, N). The sequence number, N is the number of threads or queues, the Internet traffic data packets are stored in the target memory queue corresponding to the sequence number, the single thread corresponding to the target memory queue pops the data from the target memory queue for post-processing, and the single thread will process the processed Data is transmitted to downstream business systems.

现在的数据包乱序问题,在针对TCP的情况下,通过TCP协议中的sequence number序列号去重组数据包达到有序;在针对UDP的情况下,大多是通过在UDP数据包体中增加自定义字段用于标明数据序列,服务端根据该序列字段去排序;本方法则是针对多客户端高并发发送数据包的前提下,第一层通过改进负载均衡器的负载算法,将同一客户端的数据包只转发到同一台SERVER,再通过数据包中自有的某些特征字段,依据某种算法,将同一客户端的包通过服务端侧唯一的单线程同步阻塞的处理,并不会造成多线程抢占式的数据包乱序问题,不改变原有的数据包格式,整体架构依然是异步非阻塞的高性能处理方式。For the current problem of out-of-order data packets, in the case of TCP, the sequence number sequence number in the TCP protocol is used to reorganize the data packets to achieve order; in the case of UDP, most of them are added in the UDP data packet body. The definition field is used to indicate the data sequence, and the server sorts it according to the sequence field; this method is aimed at the premise that multiple clients send data packets concurrently, the first layer improves the load algorithm of the load balancer, and the same client The data packet is only forwarded to the same server, and then through some characteristic fields in the data packet, according to a certain algorithm, the packet of the same client is processed through the unique single-threaded synchronous blocking process on the server side, which will not cause many problems. The problem of out-of-order data packets caused by thread preemption does not change the original data packet format, and the overall architecture is still an asynchronous non-blocking high-performance processing method.

由于本发明实施例中负载均衡服务器根据网关路由器的出口IP地址确定对应的服务器,然后将上网流量数据包发送给该对应的服务器,避免了同一网关路由器的上网流量数据包被多台服务器处理的情况发生。Since the load balancing server in the embodiment of the present invention determines the corresponding server according to the egress IP address of the gateway router, and then sends the Internet traffic data packet to the corresponding server, it avoids the Internet traffic data packet of the same gateway router being processed by multiple servers. situation happens.

实施例6:Example 6:

在上述各实施例的基础上,图5为本发明实施例提供的一种数据处理系统的结构示意图,所述数据处理系统包括:网关路由器501和服务器502;其中,On the basis of the foregoing embodiments, FIG. 5 is a schematic structural diagram of a data processing system provided by an embodiment of the present invention, where the data processing system includes: a gateway router 501 and a server 502; wherein,

所述网关路由器501,用于向服务器502发送上网流量数据包;The gateway router 501 is used to send Internet traffic data packets to the server 502;

所述服务器502,用于接收上网流量数据包,获取发送所述上网流量数据包的网关路由器501的标识信息;根据预先初始化的每个内存队列及所述标识信息,确定所述标识信息对应的目标内存队列;将所述上网流量数据包存入所述目标内存队列,并采用所述目标内存队列对应的单线程处理所述上网流量数据包。The server 502 is configured to receive the Internet traffic data packets, and obtain the identification information of the gateway router 501 that sends the Internet traffic data packets; according to each pre-initialized memory queue and the identification information, determine the corresponding identification information. A target memory queue; the Internet traffic data packets are stored in the target memory queue, and a single thread corresponding to the target memory queue is used to process the Internet traffic data packets.

所述服务器502,具体用于如果所述网关路由器501的标识信息包括MAC地址,确定预先初始化的内存队列的数量,及每个内存队列的序号;将所述MAC地址进行哈希处理,得到所述MAC地址的哈希值;根据所述内存队列的数量及所述MAC地址的哈希值,确定所述MAC地址对应的目标内存队列的序号。The server 502 is specifically configured to determine the number of pre-initialized memory queues and the serial number of each memory queue if the identification information of the gateway router 501 includes a MAC address; perform hash processing on the MAC address to obtain the The hash value of the MAC address; according to the number of the memory queues and the hash value of the MAC address, the sequence number of the target memory queue corresponding to the MAC address is determined.

所述服务器502,具体用于将所述MAC地址的哈希值对所述内存队列的数量取模,根据所述取模的结果确定所述MAC地址对应的目标内存队列的序号。The server 502 is specifically configured to take the hash value of the MAC address modulo the number of the memory queues, and determine the sequence number of the target memory queue corresponding to the MAC address according to the result of the modulo.

如图6所示,所述系统还包括:As shown in Figure 6, the system further includes:

负载均衡服务器603,用于接收所述网关路由器501发送的上网流量数据包;根据获取到的发送所述上网流量数据包的网关路由器501的出口IP地址,确定所述出口IP地址对应的所述服务器502,并将所述上网流量数据包发送给所述服务器502的;The load balancing server 603 is configured to receive the Internet traffic data packet sent by the gateway router 501; server 502, and send the Internet traffic data packet to the server 502;

所述服务器502,具体用于接收所述负载均衡服务器603发送的上网流量数据包。The server 502 is specifically configured to receive the Internet traffic data packets sent by the load balancing server 603 .

如图7所示,所述系统还包括:下游设备704;其中,As shown in FIG. 7, the system further includes: downstream equipment 704; wherein,

所述服务器502,还用于采用所述目标内存队列对应的单线程处理所述上网流量数据包后,采用所述目标内存队列对应的单线程,将处理后的所述上网流量数据包发送给对应的下游设备704。The server 502 is further configured to use the single thread corresponding to the target memory queue to process the Internet traffic data packets, and then use the single thread corresponding to the target memory queue to send the processed Internet traffic data packets to Corresponding downstream device 704 .

实施例7:Example 7:

在上述各实施例的基础上,本发明实施例还提供了一种服务器800,如图8所示,包括:处理器801、存储器802和收发机803;On the basis of the foregoing embodiments, an embodiment of the present invention further provides a server 800, as shown in FIG. 8, including: a processor 801, a memory 802, and a transceiver 803;

所述处理器801,用于执行读取存储器802中的程序,执行下列过程:The processor 801 is configured to execute the program in the read memory 802, and execute the following processes:

控制所述收发机803接收上网流量数据包,获取发送所述上网流量数据包的网关路由器的标识信息;根据预先初始化的每个内存队列及所述标识信息,确定所述标识信息对应的目标内存队列;将所述上网流量数据包存入所述目标内存队列,并采用所述目标内存队列对应的单线程处理所述上网流量数据包。Control the transceiver 803 to receive Internet traffic data packets, and obtain the identification information of the gateway router that sends the Internet traffic data packets; according to each pre-initialized memory queue and the identification information, determine the target memory corresponding to the identification information queue; store the Internet traffic data packets in the target memory queue, and use the single thread corresponding to the target memory queue to process the Internet traffic data packets.

基于同一发明构思,本发明实施例中还提供了一种服务器,由于上述服务器解决问题的原理与数据处理方法相似,因此上述服务器的实施可以参见方法的实施,重复之处不再赘述。Based on the same inventive concept, an embodiment of the present invention also provides a server. Since the principle of the above server for solving problems is similar to that of the data processing method, the implementation of the above server can refer to the implementation of the method, and the repetition will not be repeated.

在图8中,总线架构可以包括任意数量的互联的总线和桥,具体由处理器801代表的一个或多个处理器和存储器802代表的存储器的各种电路链接在一起。总线架构还可以将诸如外围设备、稳压器和功率管理电路等之类的各种其他电路链接在一起,这些都是本领域所公知的,因此,本文不再对其进行进一步描述。收发机803可以是多个元件,即包括发送机和接收机,提供用于在传输介质上与各种其他装置通信的单元。处理器801负责管理总线架构和通常的处理,存储器802可以存储处理器801在执行操作时所使用的数据。In FIG. 8 , the bus architecture may include any number of interconnected buses and bridges, in particular one or more processors represented by processor 801 and various circuits of memory represented by memory 802 linked together. The bus architecture may also link together various other circuits, such as peripherals, voltage regulators, and power management circuits, which are well known in the art and, therefore, will not be described further herein. Transceiver 803 may be a number of elements, including a transmitter and a receiver, providing a means for communicating with various other devices over a transmission medium. The processor 801 is responsible for managing the bus architecture and general processing, and the memory 802 may store data used by the processor 801 in performing operations.

可选的,处理器801可以是CPU(中央处埋器)、ASIC(Application SpecificIntegrated Circuit,专用集成电路)、FPGA(Field-Programmable Gate Array,现场可编程门阵列)或CPLD(Complex Programmable Logic Device,复杂可编程逻辑器件)。Optionally, the processor 801 may be a CPU (central processor), an ASIC (Application Specific Integrated Circuit, application specific integrated circuit), an FPGA (Field-Programmable Gate Array, field programmable gate array) or a CPLD (Complex Programmable Logic Device, complex programmable logic devices).

所述处理器801,具体用于如果所述网关路由器的标识信息包括MAC地址,确定预先初始化的内存队列的数量,及每个内存队列的序号;将所述MAC地址进行哈希处理,得到所述MAC地址的哈希值;根据所述内存队列的数量及所述MAC地址的哈希值,确定所述MAC地址对应的目标内存队列的序号。The processor 801 is specifically configured to determine the number of pre-initialized memory queues and the serial number of each memory queue if the identification information of the gateway router includes a MAC address; perform hash processing on the MAC address to obtain the The hash value of the MAC address; according to the number of the memory queues and the hash value of the MAC address, the sequence number of the target memory queue corresponding to the MAC address is determined.

所述处理器801,具体用于将所述MAC地址的哈希值对所述内存队列的数量取模,根据所述取模的结果确定所述MAC地址对应的目标内存队列的序号。The processor 801 is specifically configured to take the hash value of the MAC address modulo the number of the memory queues, and determine the sequence number of the target memory queue corresponding to the MAC address according to the result of the modulo.

所述处理器801,具体用于控制所述收发机803接收负载均衡服务器发送的上网流量数据包,其中所述上网流量数据包为所述负载均衡服务器根据获取到的发送所述上网流量数据包的网关路由器的出口IP地址,确定所述出口IP地址对应的服务器后发送给所述服务器的。The processor 801 is specifically configured to control the transceiver 803 to receive the Internet traffic data packet sent by the load balancing server, wherein the Internet traffic data packet is the Internet traffic data packet sent by the load balancing server according to the obtained data packet. The egress IP address of the gateway router is sent to the server after determining the server corresponding to the egress IP address.

所述处理器801,还用于采用所述目标内存队列对应的单线程处理所述上网流量数据包后,采用所述目标内存队列对应的单线程,将处理后的所述上网流量数据包发送给对应的下游设备。The processor 801 is further configured to use the single thread corresponding to the target memory queue to process the Internet traffic data packets, and use the single thread corresponding to the target memory queue to send the processed Internet traffic data packets. to the corresponding downstream device.

在本发明实施例中,服务器将接收到的上网流量数据包存入对应的目标内存队列中,并采用目标内存队列对应的单线程处理该上网流量数据,避免了多线程处理数据的时效性无法保证,保证了发往下游业务系统的数据包的有序性,从而保证了下游业务系统能够准确分析出用户上网行为。In the embodiment of the present invention, the server stores the received Internet traffic data packets in the corresponding target memory queue, and uses the single thread corresponding to the target memory queue to process the Internet traffic data, avoiding the timeliness of multi-threaded processing of data. The guarantee ensures the orderliness of the data packets sent to the downstream business system, thereby ensuring that the downstream business system can accurately analyze the user's online behavior.

实施例8:Example 8:

在上述各实施例的基础上,本发明实施例还提供了一种服务器900,如图9所示,包括:处理器901、通信接口902、存储器903和通信总线904,其中,处理器901,通信接口902,存储器903通过通信总线904完成相互间的通信;On the basis of the foregoing embodiments, an embodiment of the present invention further provides a server 900, as shown in FIG. 9, including: a processor 901, a communication interface 902, a memory 903, and a communication bus 904, wherein the processor 901, The communication interface 902, the memory 903 completes the mutual communication through the communication bus 904;

所述存储器903中存储有计算机程序,当所述程序被所述处理器901执行时,使得所述处理器901执行如下步骤:A computer program is stored in the memory 903, and when the program is executed by the processor 901, the processor 901 is caused to perform the following steps:

接收上网流量数据包,获取发送所述上网流量数据包的网关路由器的标识信息;Receive Internet traffic data packets, and obtain the identification information of the gateway router that sends the Internet traffic data packets;

根据预先初始化的每个内存队列及所述标识信息,确定所述标识信息对应的目标内存队列;According to each pre-initialized memory queue and the identification information, determine the target memory queue corresponding to the identification information;

将所述上网流量数据包存入所述目标内存队列,并采用所述目标内存队列对应的单线程处理所述上网流量数据包。The Internet traffic data packets are stored in the target memory queue, and a single thread corresponding to the target memory queue is used to process the Internet traffic data packets.

上述服务器提到的通信总线可以是外设部件互连标准(Peripheral ComponentInterconnect,PCI)总线或扩展工业标准结构(Extended Industry StandardArchitecture,EISA)总线等。该通信总线可以分为地址总线、数据总线、控制总线等。为便于表示,图中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The communication bus mentioned by the above server may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an Extended Industry Standard Architecture (Extended Industry Standard Architecture, EISA) bus or the like. The communication bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

通信接口902用于上述服务器与其他设备之间的通信。The communication interface 902 is used for communication between the above-mentioned server and other devices.

存储器可以包括随机存取存储器(Random Access Memory,RAM),也可以包括非易失性存储器(Non-Volatile Memory,NVM),例如至少一个磁盘存储器。可选地,存储器还可以是至少一个位于远离前述处理器的存储装置。The memory may include random access memory (Random Access Memory, RAM), and may also include non-volatile memory (Non-Volatile Memory, NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

上述处理器可以是通用处理器,包括中央处理器、网络处理器(NetworkProcessor,NP)等;还可以是数字指令处理器(Digital Signal Processing,DSP)、专用集成电路、现场可编程门陈列或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。The above-mentioned processor may be a general-purpose processor, including a central processing unit, a network processor (Network Processor, NP), etc.; it may also be a digital instruction processor (Digital Signal Processing, DSP), an application-specific integrated circuit, a field programmable gate array, or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

在本发明实施例中,处理器执行存储器上所存放的程序时,实现本发明中服务器将接收到的上网流量数据包存入对应的目标内存队列中,并采用目标内存队列对应的单线程处理该上网流量数据,避免了多线程处理数据的时效性无法保证,保证了发往下游业务系统的数据包的有序性,从而保证了下游业务系统能够准确分析出用户上网行为。In the embodiment of the present invention, when the processor executes the program stored in the memory, the server in the present invention stores the received Internet traffic data packets in the corresponding target memory queue, and adopts the single-threaded processing corresponding to the target memory queue. The Internet traffic data avoids that the timeliness of multi-threaded processing data cannot be guaranteed, and ensures the orderliness of data packets sent to the downstream business system, thereby ensuring that the downstream business system can accurately analyze the user's Internet behavior.

实施例9:Example 9:

在上述各实施例的基础上,本发明实施例还提供了一种计算机存储可读存储介质,所述计算机可读存储介质内存储有可由服务器执行的计算机程序,当所述程序在所述服务器上运行时,使得所述服务器执行时实现如下步骤:On the basis of the foregoing embodiments, embodiments of the present invention further provide a computer storage-readable storage medium, where a computer program executable by a server is stored in the computer-readable storage medium, and when the program is stored in the server When running on the server, the following steps are implemented when the server is executed:

接收上网流量数据包,获取发送所述上网流量数据包的网关路由器的标识信息;Receive Internet traffic data packets, and obtain identification information of the gateway router that sends the Internet traffic data packets;

根据预先初始化的每个内存队列及所述标识信息,确定所述标识信息对应的目标内存队列;According to each pre-initialized memory queue and the identification information, determine the target memory queue corresponding to the identification information;

将所述上网流量数据包存入所述目标内存队列,并采用所述目标内存队列对应的单线程处理所述上网流量数据包。The Internet traffic data packets are stored in the target memory queue, and a single thread corresponding to the target memory queue is used to process the Internet traffic data packets.

上述计算机可读存储介质可以是服务器中的处理器能够存取的任何可用介质或数据存储设备,包括但不限于磁性存储器如软盘、硬盘、磁带、磁光盘(MO)等、光学存储器如CD、DVD、BD、HVD等、以及半导体存储器如ROM、EPROM、EEPROM、非易失性存储器(NANDFLASH)、固态硬盘(SSD)等。The above-mentioned computer-readable storage medium can be any available medium or data storage device that can be accessed by the processor in the server, including but not limited to magnetic storage such as floppy disk, hard disk, magnetic tape, magneto-optical disk (MO), etc., optical storage such as CD, DVD, BD, HVD, etc., as well as semiconductor memories such as ROM, EPROM, EEPROM, non-volatile memory (NANDFLASH), solid state disk (SSD), and the like.

在本发明实施例中提供的计算机可读存储介质内存储有计算机程序,计算机程序被处理器执行时,实现本发明中服务器将接收到的上网流量数据包存入对应的目标内存队列中,并采用目标内存队列对应的单线程处理该上网流量数据,避免了多线程处理数据的时效性无法保证,保证了发往下游业务系统的数据包的有序性,从而保证了下游业务系统能够准确分析出用户上网行为。A computer program is stored in the computer-readable storage medium provided in the embodiment of the present invention, and when the computer program is executed by the processor, the server in the present invention stores the received Internet traffic data packets in the corresponding target memory queue, and implements The single thread corresponding to the target memory queue is used to process the Internet traffic data, which avoids the inability to guarantee the timeliness of multi-threaded data processing, ensures the orderliness of data packets sent to the downstream business system, and ensures that the downstream business system can accurately analyze the data. User online behavior.

图10为本发明实施例提供的一种数据处理装置示意图,应用于服务器,该装置包括:10 is a schematic diagram of a data processing apparatus provided by an embodiment of the present invention, applied to a server, and the apparatus includes:

获取模块1001,用于接收上网流量数据包,获取发送所述上网流量数据包的网关路由器的标识信息;Obtaining module 1001, configured to receive Internet traffic data packets, and obtain identification information of the gateway router that sends the Internet traffic data packets;

确定模块1002,用于根据预先初始化的每个内存队列及所述标识信息,确定所述标识信息对应的目标内存队列;A determination module 1002, configured to determine a target memory queue corresponding to the identification information according to each pre-initialized memory queue and the identification information;

处理模块1003,用于将所述上网流量数据包存入所述目标内存队列,并采用所述目标内存队列对应的单线程处理所述上网流量数据包。The processing module 1003 is configured to store the Internet traffic data packets in the target memory queue, and use a single thread corresponding to the target memory queue to process the Internet traffic data packets.

所述网关路由器的标识信息包括媒体访问控制MAC地址和/或互联网协议IP地址。The identification information of the gateway router includes a media access control MAC address and/or an internet protocol IP address.

如果所述网关路由器的标识信息包括MAC地址,所述确定模块,具体用于确定预先初始化的内存队列的数量,及每个内存队列的序号;将所述MAC地址进行哈希处理,得到所述MAC地址的哈希值;根据所述内存队列的数量及所述MAC地址的哈希值,确定所述MAC地址对应的目标内存队列的序号。If the identification information of the gateway router includes a MAC address, the determining module is specifically configured to determine the number of pre-initialized memory queues and the sequence number of each memory queue; perform hash processing on the MAC address to obtain the Hash value of the MAC address; according to the number of the memory queues and the hash value of the MAC address, determine the sequence number of the target memory queue corresponding to the MAC address.

所述确定模块,具体用于将所述MAC地址的哈希值对所述内存队列的数量取模,根据所述取模的结果确定所述MAC地址对应的目标内存队列的序号。The determining module is specifically configured to take the hash value of the MAC address modulo the number of the memory queues, and determine the sequence number of the target memory queue corresponding to the MAC address according to the result of the modulo.

所述获取模块,具体用于接收负载均衡服务器发送的上网流量数据包,其中所述上网流量数据包为所述负载均衡服务器根据获取到的发送所述上网流量数据包的网关路由器的出口IP地址,确定所述出口IP地址对应的服务器后发送给所述服务器的。The obtaining module is specifically configured to receive the Internet traffic data packet sent by the load balancing server, wherein the Internet traffic data packet is the egress IP address of the gateway router that sends the Internet traffic data packet obtained by the load balancing server , which is sent to the server after determining the server corresponding to the exit IP address.

所述装置还包括:The device also includes:

发送模块,用于采用所述目标内存队列对应的单线程,将处理后的所述上网流量数据包发送给对应的下游设备。The sending module is configured to use the single thread corresponding to the target memory queue to send the processed Internet traffic data packet to the corresponding downstream device.

本发明实施例中服务器将接收到的上网流量数据包存入对应的目标内存队列中,并采用目标内存队列对应的单线程处理该上网流量数据,避免了多线程处理数据的时效性无法保证,保证了发往下游业务系统的数据包的有序性,从而保证了下游业务系统能够准确分析出用户上网行为。In the embodiment of the present invention, the server stores the received Internet traffic data packets in the corresponding target memory queue, and uses the single thread corresponding to the target memory queue to process the Internet traffic data, which avoids that the timeliness of multi-threaded processing data cannot be guaranteed. The order of the data packets sent to the downstream business system is ensured, thereby ensuring that the downstream business system can accurately analyze the user's online behavior.

对于系统/装置实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。For the system/apparatus embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for related parts, please refer to the partial description of the method embodiment.

需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者一个操作与另一个实体或者另一个操作区分开来,而不一定要求或者暗示这些实体或者操作之间存在任何这种实际的关系或者顺序。It should be noted that, in this document, relational terms such as first and second, etc. are only used to distinguish one entity or one operation from another entity or another operation, and do not necessarily require or imply these entities Or there is any such actual relationship or order between operations.

本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。As will be appreciated by those skilled in the art, the embodiments of the present application may be provided as a method, a system, or a 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, etc.) having computer-usable program code embodied therein.

本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. It will be understood that each flow and/or block in 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 the processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing device to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing device produce Means for implementing the functions specified in a flow or flow of a flowchart and/or a block or blocks of a block diagram.

这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory result in an article of manufacture comprising instruction means, the instructions The apparatus implements the functions specified in the flow or flow of the flowcharts and/or the block or blocks of the block diagrams.

这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable data processing device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process such that The instructions provide steps for implementing the functions specified in the flow or blocks of the flowcharts and/or the block or blocks of the block diagrams.

尽管已描述了本申请的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本申请范围的所有变更和修改。While the preferred embodiments of the present application have been described, additional changes and modifications to these embodiments may occur to those skilled in the art once the basic inventive concepts are known. Therefore, the appended claims are intended to be construed to include the preferred embodiment and all changes and modifications that fall within the scope of this application.

显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。It will be apparent to those skilled in the art that various modifications and variations can be made in the present invention without departing from the spirit and scope of the invention. Thus, provided that these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims (19)

1. A data processing method is applied to a server, and the method comprises the following steps:
receiving an internet traffic data packet, and acquiring identification information of a gateway router which sends the internet traffic data packet;
determining a target memory queue corresponding to the identification information according to each pre-initialized memory queue and the identification information;
and storing the internet traffic data packet into the target memory queue, and processing the internet traffic data packet by adopting a single thread corresponding to the target memory queue.
2. The method of claim 1, wherein the identification information of the gateway router comprises a Media Access Control (MAC) address and/or an Internet Protocol (IP) address.
3. The method according to claim 1 or 2, wherein if the identification information of the gateway router includes a MAC address, the determining the target memory queue corresponding to the identification information according to each pre-initialized memory queue and the identification information comprises:
determining the number of pre-initialized memory queues and the serial number of each memory queue;
performing hash processing on the MAC address to obtain a hash value of the MAC address;
and determining the sequence number of the target memory queue corresponding to the MAC address according to the number of the memory queues and the Hash value of the MAC address.
4. The method of claim 3, wherein the determining the sequence number of the target memory queue corresponding to the MAC address according to the number of the memory queues and the hash value of the MAC address comprises:
and performing modulus operation on the number of the memory queues by the hash value of the MAC address, and determining the sequence number of a target memory queue corresponding to the MAC address according to the modulus operation result.
5. The method of claim 1, wherein the receiving the internet traffic packet comprises:
the method comprises the steps of receiving an internet traffic data packet sent by a load balancing server, wherein the internet traffic data packet is sent to the load balancing server after the load balancing server determines a server corresponding to an outlet IP address according to the outlet IP address of a gateway router which sends the internet traffic data packet.
6. The method according to claim 1, wherein after the single thread corresponding to the target memory queue is used to process the internet traffic packet, the method further comprises:
and sending the processed internet traffic data packet to corresponding downstream equipment by adopting a single thread corresponding to the target memory queue.
7. A data processing apparatus, applied to a server, the apparatus comprising:
the gateway router comprises an acquisition module, a transmission module and a processing module, wherein the acquisition module is used for receiving an internet traffic data packet and acquiring identification information of a gateway router which transmits the internet traffic data packet;
the determining module is used for determining a target memory queue corresponding to the identification information according to each pre-initialized memory queue and the identification information;
and the processing module is used for storing the internet traffic data packet into the target memory queue and processing the internet traffic data packet by adopting a single thread corresponding to the target memory queue.
8. A server comprising a memory, a processor, and a transceiver;
the processor is used for reading the program in the memory and executing the following processes: controlling the transceiver to receive an internet traffic data packet and acquiring identification information of a gateway router which sends the internet traffic data packet; determining a target memory queue corresponding to the identification information according to each pre-initialized memory queue and the identification information; and storing the internet traffic data packet into the target memory queue, and processing the internet traffic data packet by adopting a single thread corresponding to the target memory queue.
9. The server according to claim 8, wherein the processor is specifically configured to determine a number of pre-initialized memory queues and a sequence number of each memory queue if the identification information of the gateway router includes a MAC address; performing hash processing on the MAC address to obtain a hash value of the MAC address; and determining the sequence number of the target memory queue corresponding to the MAC address according to the number of the memory queues and the Hash value of the MAC address.
10. The server according to claim 9, wherein the processor is specifically configured to modulo the number of the memory queues by the hash value of the MAC address, and determine a sequence number of a target memory queue corresponding to the MAC address according to a result of the modulo.
11. The server according to claim 8, wherein the processor is specifically configured to control the transceiver to receive an internet traffic data packet sent by a load balancing server, where the internet traffic data packet is sent to the server after the load balancing server determines, according to an obtained exit IP address of a gateway router that sends the internet traffic data packet, a server corresponding to the exit IP address.
12. The server according to claim 8, wherein the processor is further configured to, after processing the internet traffic data packet by using the single thread corresponding to the target memory queue, send the processed internet traffic data packet to a corresponding downstream device by using the single thread corresponding to the target memory queue.
13. A server, comprising: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
the memory has stored therein a computer program which, when executed by the processor, causes the processor to carry out the steps of the method of any of claims 1 to 6.
14. A computer-readable storage medium, in which a computer program executable by a server is stored, which program, when run on the server, causes the server to carry out the steps of the method according to any one of claims 1 to 6.
15. A data processing system, comprising a gateway router and a server; wherein,
the gateway router is used for sending an internet traffic data packet to the server;
the server is used for receiving the internet traffic data packet and acquiring the identification information of the gateway router which sends the internet traffic data packet; determining a target memory queue corresponding to the identification information according to each pre-initialized memory queue and the identification information; and storing the internet traffic data packet into the target memory queue, and processing the internet traffic data packet by adopting a single thread corresponding to the target memory queue.
16. The system of claim 15, wherein the server is specifically configured to determine a number of pre-initialized memory queues and a sequence number of each memory queue if the identification information of the gateway router includes a MAC address; performing hash processing on the MAC address to obtain a hash value of the MAC address; and determining the sequence number of the target memory queue corresponding to the MAC address according to the number of the memory queues and the Hash value of the MAC address.
17. The system according to claim 16, wherein the server is specifically configured to modulo the number of the memory queues by the hash value of the MAC address, and determine a sequence number of a target memory queue corresponding to the MAC address according to a result of the modulo.
18. The system of claim 15, wherein the system further comprises:
the load balancing server is used for receiving the internet traffic data packet sent by the gateway router; determining the server corresponding to the outlet IP address according to the acquired outlet IP address of the gateway router which sends the internet traffic data packet, and sending the internet traffic data packet to the server;
the server is specifically configured to receive an internet traffic data packet sent by the load balancing server.
19. The system of claim 15, wherein the system further comprises: downstream equipment; wherein,
the server is further configured to send the processed internet traffic data packet to a corresponding downstream device by using the single thread corresponding to the target memory queue after processing the internet traffic data packet by using the single thread corresponding to the target memory queue.
CN201811284562.8A 2018-10-31 2018-10-31 Data processing method, device, system, server and readable storage medium Active CN111131074B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811284562.8A CN111131074B (en) 2018-10-31 2018-10-31 Data processing method, device, system, server and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811284562.8A CN111131074B (en) 2018-10-31 2018-10-31 Data processing method, device, system, server and readable storage medium

Publications (2)

Publication Number Publication Date
CN111131074A true CN111131074A (en) 2020-05-08
CN111131074B CN111131074B (en) 2023-04-11

Family

ID=70485287

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811284562.8A Active CN111131074B (en) 2018-10-31 2018-10-31 Data processing method, device, system, server and readable storage medium

Country Status (1)

Country Link
CN (1) CN111131074B (en)

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111880955A (en) * 2020-08-04 2020-11-03 北京立通智联科技有限公司 Message processing method, device, terminal and medium for Internet of things equipment
CN112019398A (en) * 2020-07-16 2020-12-01 中国人民财产保险股份有限公司 Network flow prediction method and device
CN112165430A (en) * 2020-09-24 2021-01-01 北京百度网讯科技有限公司 Data routing method, apparatus, device, and storage medium
CN113055493A (en) * 2021-03-26 2021-06-29 广州虎牙科技有限公司 Data packet processing method, device, system, scheduling device and storage medium
CN113448725A (en) * 2021-05-27 2021-09-28 深圳震有科技股份有限公司 Data pushing method, device, terminal and storage medium
CN113835902A (en) * 2021-09-22 2021-12-24 北京字节跳动网络技术有限公司 Data processing method and device, computer equipment and storage medium
CN113923115A (en) * 2021-10-09 2022-01-11 紫光云技术有限公司 VPC configuration issuing method based on RockMq
CN114024915A (en) * 2021-10-28 2022-02-08 北京锐安科技有限公司 Traffic migration method, device and system, electronic equipment and storage medium
CN114095523A (en) * 2020-07-30 2022-02-25 比亚迪股份有限公司 Communication data processing method, equipment and system in integrated dispatching system
CN114217875A (en) * 2021-12-17 2022-03-22 平安壹钱包电子商务有限公司 Method, device and equipment for processing order and storage medium
CN115563217A (en) * 2022-10-18 2023-01-03 数数信息科技(上海)有限公司 Data processing method, system, device, medium and program product
CN115774756A (en) * 2022-11-21 2023-03-10 海尔优家智能科技(北京)有限公司 Internet of things scene data synchronization method, equipment and storage medium
CN116319997A (en) * 2022-12-28 2023-06-23 视联动力信息技术股份有限公司 A data packet sending method, device, system, equipment and storage medium
CN116405483A (en) * 2023-04-07 2023-07-07 中国工商银行股份有限公司 A medium batch processing method, device and equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101150421A (en) * 2006-09-22 2008-03-26 华为技术有限公司 A distributed content distribution method, edge server and content distribution network
CN101217493A (en) * 2008-01-08 2008-07-09 北京大学 A transmission method of TCP data packet
CN104184832A (en) * 2014-09-10 2014-12-03 北京国双科技有限公司 Data submitting method and device in network application
CN104734993A (en) * 2013-12-24 2015-06-24 杭州华为数字技术有限公司 Data distribution method and distributor
CN105357146A (en) * 2015-10-21 2016-02-24 北京交通大学 Saturation attack defending method, device and system of buffer queue in outlet gateway

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101150421A (en) * 2006-09-22 2008-03-26 华为技术有限公司 A distributed content distribution method, edge server and content distribution network
CN101217493A (en) * 2008-01-08 2008-07-09 北京大学 A transmission method of TCP data packet
CN104734993A (en) * 2013-12-24 2015-06-24 杭州华为数字技术有限公司 Data distribution method and distributor
US20160308771A1 (en) * 2013-12-24 2016-10-20 Huawei Technologies Co., Ltd. Data distribution method and splitter
CN104184832A (en) * 2014-09-10 2014-12-03 北京国双科技有限公司 Data submitting method and device in network application
CN105357146A (en) * 2015-10-21 2016-02-24 北京交通大学 Saturation attack defending method, device and system of buffer queue in outlet gateway

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112019398A (en) * 2020-07-16 2020-12-01 中国人民财产保险股份有限公司 Network flow prediction method and device
CN114095523B (en) * 2020-07-30 2023-03-14 比亚迪股份有限公司 Communication data processing method, device and system in comprehensive scheduling system
CN114095523A (en) * 2020-07-30 2022-02-25 比亚迪股份有限公司 Communication data processing method, equipment and system in integrated dispatching system
CN111880955A (en) * 2020-08-04 2020-11-03 北京立通智联科技有限公司 Message processing method, device, terminal and medium for Internet of things equipment
CN112165430B (en) * 2020-09-24 2024-02-13 阿波罗智联(北京)科技有限公司 Data routing method, device, equipment and storage medium
CN112165430A (en) * 2020-09-24 2021-01-01 北京百度网讯科技有限公司 Data routing method, apparatus, device, and storage medium
CN113055493A (en) * 2021-03-26 2021-06-29 广州虎牙科技有限公司 Data packet processing method, device, system, scheduling device and storage medium
CN113055493B (en) * 2021-03-26 2023-04-07 广州虎牙科技有限公司 Data packet processing method, device, system, scheduling device and storage medium
CN113448725A (en) * 2021-05-27 2021-09-28 深圳震有科技股份有限公司 Data pushing method, device, terminal and storage medium
CN113835902A (en) * 2021-09-22 2021-12-24 北京字节跳动网络技术有限公司 Data processing method and device, computer equipment and storage medium
CN113835902B (en) * 2021-09-22 2023-12-05 抖音视界有限公司 Data processing method, device, computer equipment and storage medium
CN113923115A (en) * 2021-10-09 2022-01-11 紫光云技术有限公司 VPC configuration issuing method based on RockMq
CN113923115B (en) * 2021-10-09 2023-08-25 紫光云技术有限公司 VPC configuration issuing method based on RocketMq
CN114024915A (en) * 2021-10-28 2022-02-08 北京锐安科技有限公司 Traffic migration method, device and system, electronic equipment and storage medium
WO2023071272A1 (en) * 2021-10-28 2023-05-04 北京锐安科技有限公司 Traffic migration method, apparatus and system, and electronic device and storage medium
CN114217875A (en) * 2021-12-17 2022-03-22 平安壹钱包电子商务有限公司 Method, device and equipment for processing order and storage medium
CN115563217A (en) * 2022-10-18 2023-01-03 数数信息科技(上海)有限公司 Data processing method, system, device, medium and program product
CN115774756A (en) * 2022-11-21 2023-03-10 海尔优家智能科技(北京)有限公司 Internet of things scene data synchronization method, equipment and storage medium
CN116319997A (en) * 2022-12-28 2023-06-23 视联动力信息技术股份有限公司 A data packet sending method, device, system, equipment and storage medium
CN116405483A (en) * 2023-04-07 2023-07-07 中国工商银行股份有限公司 A medium batch processing method, device and equipment

Also Published As

Publication number Publication date
CN111131074B (en) 2023-04-11

Similar Documents

Publication Publication Date Title
CN111131074B (en) Data processing method, device, system, server and readable storage medium
US11411825B2 (en) In intelligent autoscale of services
US9888048B1 (en) Supporting millions of parallel light weight data streams in a distributed system
US20220217094A1 (en) System and method for facilitating fine-grain flow control in a network interface controller (nic)
US8830829B2 (en) Parallel processing using multi-core processor
US20180278540A1 (en) Connectionless transport service
US12531806B2 (en) Network interface device with flow control capability
US9639403B2 (en) Receive-side scaling in a computer system using sub-queues assigned to processing cores
US11074205B2 (en) Managing efficient selection of a particular processor thread for handling an interrupt
CN105912275A (en) Method and device for establishing connection in nonvolatile memory system
US20230300063A1 (en) Network interface device-based computations
US20130100803A1 (en) Application based bandwidth control for communication networks
WO2015114473A1 (en) Method and apparatus for locality sensitive hash-based load balancing
CN115242711A (en) Message transmission method and device
CN104967536A (en) Method and device for realizing data consistency in multiple computer rooms
US20170302577A1 (en) Forwarding port assignment for data packet
US12175285B1 (en) Processing unit selection mechanism
US20240089219A1 (en) Packet buffering technologies
US11863457B2 (en) Time-sensitive data delivery in distributed computing systems
US10103992B1 (en) Network traffic load balancing using rotating hash
US11743134B2 (en) Programmable traffic management engine
EP4468675A1 (en) Network interface device-based computations
WO2019119269A1 (en) Network fault detection method and control center device
US20230409511A1 (en) Hardware resource selection
CN111464455A (en) Message output method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant