Home > Software engineering >  Udp receives take up a lot of CPU, special card system operation
Udp receives take up a lot of CPU, special card system operation

Time:10-21

Multiple clients on a server receives the public give udp data, about 20 m/s, the development language is c # and a single CPU accounted for 100%, also achieves 10% CPU system interrupt, machine operation special CARDS, but in this machine using multithreading turn udp data to another server network, network receives the server without any problem, CPU consumption up to 2%, almost no system outage, do you have experience this is what problem, thank you very much
Both servers are all on the vmware virtual machine virtual, considering the load balancing, udp receives used windows2012 r2 nic, pattern is switches independent + dynamic, but only one network card in the receiving data, another card without data reception, doesn't seem to be any effect
Please expert help, really appreciate

CodePudding user response:

See through the network, two machines received packets per second in 4000, about 2 m bytes per second, the only difference is that one receives the public more client data, a receiving another machine in the Intranet multi-threaded data, but udp is a connectionless, and this should never mind
Is another possible public network and Intranet mtu, public need to shard on set pieces, but look at the number of bytes, estimates that a package is around 1 k, it should not impact on this

CodePudding user response:

Estimation is program structure or data processing has a problem, should first determine which threads, which part of the code lead to high CPU,

CodePudding user response:

The program itself, this traffic is something for common configuration of the machine

CodePudding user response:

The structure of the program is, a thread, received later in the queue, another starting forward several threads, tried to stop forwarding, receive only on the queue are not
Program structure roughly
While (listenFlg)
{
Byte [] buffer=udpReceiveClient. The Receive (ref ipEndPoint);
The queue. The Enqueue (buffer);
}

CodePudding user response:

The key is the same processing it in the Intranet server: forwarding, after received without any problem

CodePudding user response:

In C/C + + write a similar application test, and see if it is the C # library or call

CodePudding user response:

reference 1st floor window123123 response:
view through the network, two machines received packets per second in 4000, about 2 m bytes per second, the only difference is that one receives the public more client data, a receiving another machine in the Intranet multi-threaded data, but udp is a connectionless, and this should be fine
Is another possible public network and Intranet mtu is different, the public need to shard group piece, but look at the number of bytes, estimates that a package is around 1 k, it should not be the impact

First check, if there is a worker thread running on empty,
No business processing
No sleep in the loop

CodePudding user response:


If data receiving thread is an infinite loop, without sleep to release the CPU,,,,

CodePudding user response:

refer to 7th floor xian_wwq response:
Quote: refer to 1st floor window123123 response:

See through the network, two machines received packets per second in 4000, about 2 m bytes per second, the only difference is that one receives the public more client data, a receiving another machine in the Intranet multi-threaded data, but udp is a connectionless, and this should never mind
Is another possible public network and Intranet mtu is different, the public need to shard group piece, but look at the number of bytes, estimates that a package is around 1 k, it should not be the impact

First check, if there is a worker thread running on empty,
No business processing
In a loop without sleep


Have business processing should also be appropriate to release the CPU, or is likely to be 100%

CodePudding user response:

C #? Add a sleep (1)
  • Related