Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Thanks for Peter Lawrey's advice and we used TCPDump to proved that the data are flushed to our server a few seconds after they establish the connection. That's why the server program captured the large delay.</p> <p>But then, we perform some load test with the same Server program by having 4000 testing GPS devices pushing data to it every 5mins, each data is around 300bytes.</p> <p>We tried to modify the server code by introducing Threadpool to handle the TCP data retrieval and hope that would give us better performance.</p> <p>We have turned on TCPDump, and found that this time the time deviation was found between the TCPDump timestamp and the "START..." timestamp captured in the Java program. The deviation was around several seconds to less than 20 seconds...</p> <p>Any suggestion on how to troubleshoot the issue? </p> <p>Initialization of Threadpool:</p> <pre><code>blockingQueueForRetriveTCPMsg = new LinkedBlockingQueue&lt;Runnable&gt;(50); threadPoolExecutorForRetriveTCPMsg = new ThreadPoolExecutor( 50,1200, 0, TimeUnit.SECONDS, blockingQueueForRetriveTCPMsg, new ThreadPoolExecutor.CallerRunsPolicy()); </code></pre> <p>ServerSocket.accept() :</p> <pre><code>ServerSocket serverSocket = new ServerSocket(13811); serverSocket.setReceiveBufferSize(receiveBufferSize); Socket incomingSocket = serverSocket.accept(); RetrieveTcpMessage retrieveTcpMessage = new RetrieveTcpMessage(incomingSocket); Thread retrieveTcpMessageThread = new Thread(retrieveTcpMessage); threadPoolExecutorForRetriveTCPMsg.execute(retrieveTcpMessageThread); </code></pre> <p>Inside RetrieveTcpMessage.run(), simuilar to before:</p> <pre><code>InputStream stream = incomingSocket.getInputStream(); byte[] buffer = new byte[1000]; StringBuffer sb = new StringBuffer(); System.out.println("START getting message from TCP stream: " + dateFormat.format(Calendar.getInstance().getTime())); while (stream.read(buffer) &gt; 0) { sb.append(new String(buffer)); System.out.println(sb.toString()); } System.out.println("[incomingMessage]: " + incomingMessage); System.out.println("FINISHED getting message from TCP stream: " + dateFormat.format(Calendar.getInstance().getTime())); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload