How to test a UDP server limit? - udp

A server listening on a UDP port, many clients can connect to it, there are many groups of clients connected to it. In a group one client is sending message and the server needs to route the message to the rest in the group. Like this many groups could be running simultaneously. How can we test what is the maximum number of connections the server can handle without inducing a visible lag in the response time ?

Firstly, let me desrcibe your network topology again. There is a server and many clients, clients are divided into several groups. A client sends a message to the server, and then the server sends something to the other clients in that group.
If the topology is like what I describe above, is the connections limitation you want to reach about how many clients the server can send to at the same time? Or do you want to know how many clients can send to server at the same time?
The way to test these two different circumstances may be using multi-thread or go routine if you can write by go. But they need to set different judge to give out the limitation.

Related

Gemfire cache pre-heat completion

I would like to have one server and a few clients. The Server will be my own Java application that uses CacheFactory. I will be reading all my static data from a database and populating the cache even before it is requested by any client. While the cache is getting populated in the server, it would also be spreading among all clients that are connected to the server. Once the cache population is complete, I would like to give a green signal to all clients to start requesting data. Is there something I need to do so that the server sends an event to the clients or the clients generate an event signallig the completion of cache pre-heating?
Thanks,
Yash
One way to accomplish this would be to create a region on the server and the client (say /server-ready) for notification only. The client will register interest for all keys in this region. The client will also register a CacheListener for this region.
When the server is done loading data, you can put an entry in the server-ready region. The event will be sent to the client and afterCreate() method on the CacheListener will be invoked, which could serve as a notification to your clients that the server is done populating data.

ActiveMQ broker - limit connections per client

I am trying to find an option in ActiveMQ (5.13) that would allow me to configure the broker with a maximum number of amqp connections from one client. The target is to prevent one malicious or malfunctioning client to consume all the connections available on the broker preventing other clients to connect.
I am aware of the possibility to set maximumConnections on the transportConnector, but, as long as I understand correctly, this is a global limit on all the connections so it would not help in this case.
Is my understanding of the maximumConnections correct?
Is there a way to configure maxConnections per client on the broker?
No, there is no such property for a per client limit in ActiveMQ. You'd first need to narrow down what you define as a single client as that can be defined differently by different people. IP Address might not work as there can be several different applications coming from a single address depending on network topology or application co-location within a single box etc.

How to limit concurrent connection per user and same routing key in RabbitMQ?

I would like to know if there is a way in RabbitMQ to restrict from the server side to the users to be able to connect with the same credentials and routing key only once at a time.
I mean: Limit concurrent connection per user and same routing key,No shared connections.
If the user is connected with X credentials and listening on route y.z and try to connect in another machine with same info, then the server should deny the connection.
And i would like to apply this restrictions from the server, to avoid hacks in the client side.
Is there a way to do this or something similar?
Thank you very much!
There are no out of the box solutions for that, AFIK.
You can create exclusive queue named something like queue_name.user_name, bind it as you wish to desired exchanges and then consume from this queue. It will guaranties that one and only one consumer at a time can be connected to it.

Maximum Payload and Validity of a UDP Server

I have Created A UDP Server-Client application. There is only single thread at Server's side which continuously executes recvfrom().
If I run 3 Clients Simultaneously from 3 different machines, and send some data, the Server is able to read the data from each of the client.
But how can I test the reliability of this application?
How would I know how many Maximum number of Clients can this Server handle at a time?
Also what is the maximum Payload?
But how can I test the reliability of this application?
Run as many clients as you can. The more clients you can run and send data, the better. Try to run many clients of different machines, and on each machine try to run as many clients as you can, and keep sending data automatically.
Make the clients send data in a loop, without waiting for input, and put a delay between each call to send. A few seconds of delay is fine, then you can lower the delay later and see how your server is handling it.
How would I know how many Maximum number of Clients can this Server handle at a time?
You can't. You are using a UDP server, and UDP is connectionless. Clients do not need to connect to the server to send data, they just send it. Usually it is limited by available resources (memory, etc.) on your server.
Also what is the maximum Payload?
The maximum payload of what? A UDP message? You can read more about the UDP packet structure.

multiple UDP ports

I have situation where I have to handle multiple live UDP streams in the server.
I have two options (as I think)
Single Socket :
1) Listen at single port on the server and receive the data from all clients on the same port and create threads for each client to process the data till the client stop sending.
Here only one port is used to receive the data and number of threads used to process the data.
Multiple Sockets :
2) Client will request open port from the server to send the data and the application will send the open port to the client and opens a new thread listening at the port to receive and process the data.Here for each client will have unique port to send the data.
I already implemented a way to know which packet is coming from which client in UDP.
I have 1000+ clients and 60KB data per second I am receiving.
Is there any performance issues using the above methods
or Is here any efficient way to handle this type of task in C ?
Thanks,
Raghu
With that many clients, having one thread per client is very inefficient since lots and lots of context switches must be performed.
Also, the number of ports you can open per IP is limited (port is a 16 bit number).
Therefore "Single Socket" will be far more efficient. But you can also use "Multipe Sokets" with just a single thread using the asynchronous API. If you can identify the client using the package's payload, then there is no need to have a port per client.