UDP load testing: how do you simulate many UDP clients?

I am developing a tool to test the load on a UDP server (using C # /. NET 4.0, running on NT 6.x , although this is less relevant). The server speaks to tens of thousands of clients, where the connection between each client is very low and infrequent. All messages follow a request-response template, where one of the parties initiates communication with the other side, which then responds. When the server needs to send something to the client, it looks at the last known endpoint (IP + port) of the client and sends a UDP packet and listens on the response on one known port, which is used to receive messages from all clients. When the client initiates the connection, it already knows the endpoint of the server and simply sends a packet from the ephemeral port and waits for a response on the same port. The same ephemeral port is used for the life of the client.

The design of the load testing tool is quite simple; emulate the behavior, state and decision-making of each client to a low but sufficient complexity. Since communication with each client occurs only occasionally (every few seconds), and the amount of processing required for each message is very minimal, the best approach I can come up with is to use one thread with one socket to perform all communication for a large number of simulated clients which, most likely, still will not leave the stream fully occupied and saturated. Unfortunately, I had two problems with this approach, related to the fact that each client sends and receives from its port:

  • A socket allows sending a UDP packet only from an ephemeral port allocated by the system, or from a specific port to which the socket is bound.
  • A socket will only accept UDP packets from the port to which it is bound.

One socket per client

These two restrictions seem to mean that I have to create a socket for each client, since the UDP packet must come from a specific port and a response will be sent to that port. Thus, the first possible solution is to do just that, create a socket for the simulated client. Let's say we simulate 30,000 customers on one machine:

  • Does 30,000 sockets even make it possible? Is this the best practice? Is this a performer? Will Windows even allow you to associate 30,000 sockets with 30,000 different ports?
  • 30 000 , - ? , , - ? 30 000 , ?
  • ? ?

, , , -:

?

, ? ? ? , .

+3
1

, > 30 000 Windows, MAXUSERPORT (. ).

- -, "", " ".

, Vista (. ), -, , , UDP, , "" , .

: http://www.serverframework.com/asynchronousevents/2010/12/one-million-tcp-connections.html

, , , ++ socket server framework. UDP, , , , (. ).

+4

Source: https://habr.com/ru/post/1792163/


All Articles