0

I am practicing socket programming in C language. I have two codes - server and client (based on TCP) on two different laptops. The server forks a new process for every new request. For simulating multiple simultaneous clients, I have used pthreads library in my client program. I have a lots of files at the server, each of fixed size (2 MB).

I am calculating two things at the client - throughput and response time. Throughput is the average no. of files downloaded per second. And response time is the average time taken to download a file.

I want to see that at what no. of simultaneous users (threads), the throughput gets saturated. But I am facing problem in analyzing that since the network speed is varying largely.

Can someone suggest a way to analyse that? May be some factor other than throughput and response time which does not depend on network speed, because I need to find the number N (simultaneous users) for which the server is at maximum load.

If network bandwidth control is necessary, than is there some simple way to control the maximum upload speed at server. I am using Ubuntu 18.04. The max limit may be imposed on the whole system only (for simplicity) since there is no other foreground process running parallely. For example, my upload speed varies from 3-5 MBps, can it be restricted to some lower value like 2 MBps.

Or should I restrict the download speed at client rather than server's upload speed so it is constant and always less than that of upload speed at server, since the analysis is done by client program.

  • Good measurement requires having control over everything except what you're trying to test. If the network conditions vary, you won't be able to make accurate measurements of anything that depends on it. – Blrfl Apr 24 at 22:29
  • Is that true if you were to use the loopback address? Sometimes there's nothing like 127.0.0.1 or ::1 to isolate network effects from architectural design. It does require client and server to be on the same machine though. – Berin Loritsch Apr 24 at 22:44
  • Also, how are you defining saturation? Are you sure you don't have other types of saturation effecting your tests like CPU, memory, process limits, etc.? – Berin Loritsch Apr 24 at 22:45
  • I don't think any other thing than network speed is bottle-necking the throughput. The CPU, memory use was almost negligible at the server. Even the receive buffer at the client is allowed to be overwritten by flooded packets, because that is not my concern here. – Akshdeep Singh Apr 24 at 22:52
  • Talking about loopback address, I want to avoid that because I think since the client and server are on same machine, increasing number of users will increase processing of both the programs simultaneously, thus the server will not have same number of available resources. And it is preferable that bottleneck is by network bandwidth only. – Akshdeep Singh Apr 24 at 22:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.