Note that there are some explanatory texts on larger screens.

plurals
  1. POLoad Testing Java Web Application - find TPS / Avg transaction response time
    primarykey
    data
    text
    <p>I would like to build my own load testing tool in Java with the goal of being able to load test a web application I am building throughout the development cycle. The web application will be receiving server to server HTTP Post requests and I would like to find its starting transaction per second (TPS) capacity along with the avgerage response time.</p> <p>The Post request and response messages will be in XML (I dont' think that's really applicable though :) ).</p> <p>I have written a very simple Java app to send transactions and count how many transactions it was able to send in one second (1000 ms) however I don't think this is the best way to load test. Really what I want is to send any number of transactions at exactly the same time - i.e. 10, 50, 100 etc.</p> <p>Any help would be appreciated!</p> <p>Oh and here is my current test app code:</p> <pre><code> Thread[] t = new Thread[1]; for (int a = 0; a &lt; t.length; a++) { t[a] = new Thread(new MessageLoop()); } startTime = System.currentTimeMillis(); System.out.println(startTime); for (int a = 0; a &lt; t.length; a++) { t[a].start(); } while ((System.currentTimeMillis() - startTime) &lt; 1000 ) { } if ((System.currentTimeMillis() - startTime) &gt; 1000 ) { for (int a = 0; a &lt; t.length; a++) { t[a].interrupt(); } } long endTime = System.currentTimeMillis(); System.out.println(endTime); System.out.println("Total time: " + (endTime - startTime)); System.out.println("Total transactions: " + count); private static class MessageLoop implements Runnable { public void run() { try { //Test Number of transactions while ((System.currentTimeMillis() - startTime) &lt; 1000 ) { // SEND TRANSACTION HERE count++; } } catch (Exception e) { } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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