Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A "Client - Server" performance issue

I have a "Queuing Theory" problem where following are to be done:

  • Develop a CLIENT to send continuous packets of fixed size to SERVER at fixed rate
  • SERVER has to queue these packets and SORT them before handling these packets
  • Then we need to prove (for some packet size 'n' bytes and rate 'r' MBps) the theoretical observation that sorting(n log n / CPU_FREQ) happens faster than queuing (n / r), and thus the QUEUE should not build up at all.

However, I find that Queue is always building up (running on two systems - client and server PCs/Laptops),

Note: When I run the processes on the same system, then Queue doesnt build and most of the time, it is down close to 1 - 20 packets.

Need someone to check/review my code.

Code is pasted here:

  1. Client (Single Class):

    • Main: http://pastebin.com/embed_iframe.php?i=YEfQGXFZ
  2. Server (Multiple Class files Package: serverClasses:

    • Main: http://pastebin.com/embed_iframe.php?i=BgZzfiTQ
    • Sorting: http://pastebin.com/embed_iframe.php?i=mPh8zgqC
    • ServerThreadPerClient: http://pastebin.com/embed_iframe.php?i=ZpTqpHnX
    • GlobalStatistics: http://pastebin.com/embed_iframe.php?i=Q2DJLvaV
  3. Sample Graph for "QUEUE_LEN Vs. #PACKETS" for 10MBps and 10000 Byte sized packets for a duration of 30 - 35 secs

enter image description here

like image 642
Aditya369 Avatar asked Oct 24 '11 16:10

Aditya369


People also ask

How can clients improve server performance?

Switch to Externalizable and write the minimal data required to capture object state for wire transfer. 2) Compress the data that is sent from server to client. Beyond object state in (1), you should also reduce the data blobs ("files") that you are moving around the net.

What are the disadvantages of client server?

Disadvantages of Client Server Computing If all the clients simultaneously request data from the server, it may get overloaded. This may lead to congestion in the network. If the server fails for any reason, then none of the requests of the clients can be fulfilled. This leads of failure of the client server network.

What affects server performance?

The following factors can affect server performance: CPU usage. Disk I/O relating to database, before-image, and after-image I/O. Record locking.

What is Optimizer in client server?

Gurobi Remote Services allow you to offload optimization computations from one or more client programs onto a cluster of servers. We provide a number of different configuration options.


1 Answers

On the client it looks to me that the timeinterval is always going to be 0. Was that the intension? You say seconds in the code but you are missing the * 1000.

timeInterval = 1 / ( noOfPacketsToBeSent );

And then you call Thread.sleep((long) timeinterval). Since sleep() takes long then this will at most sleep 1ms and usually (I suspect) sleep 0ms. Sleep only has a millisecond resolution. If you want nanoseconds resolution then you'll have to do something like:

   TimeUnit timeUnit = TimeUnit.NANOSECONDS;
   ...
   timeUnit.sleep(50);  

I suspect that your CPU is limiting your runs when both the client and the server are on the same box. When they are on different boxes then things back up because the client is in effect flooding the server because of the improper sleep times.

That's my best guess at least.

like image 152
Gray Avatar answered Oct 13 '22 19:10

Gray