David’s Thesis Blog


HttpTest.java
September 10, 2008, 2:08 pm
Filed under: Uncategorized

Have just finished the http GET implementation as requested by Dr Shiping from our last meeting. Some notes.

Currently the test class will as per usual run x threads each thread running for x amount of time generating clients. Each client will randomly extract a url from a list, parse the url with the java url class to extract the protocol (currently only supports http) the host and the port, if there is no port the default port of 80 will be used, and the filename to GET. The client will then connect to the host, sent the GET request and output the results to a file (this is optional). Finally resultlog is called and with a data report.

Some notes

  • Modified randomline class used in yahootest to be used with httptest, randomline can pretty much be used for implementation that may be random data, especially useful for an implementation of a POST test imo.
  • Found a neat use for the postrun() function as a place to increment a count++. This was used to serve as a way to output the files without conflicting filenames. Currently the filename for each output is host name + thread ID + counter.
  • Google blocks it and seems to lock you ip out for a few seconds.
  • Will publish code after, it is a bit more polished.

Meanwhile i will run the class on this blog to boost my hit counter.

Output example from the console –

BUILD SUCCESSFUL
Total time: 16 seconds
C:\PerfTester>ant test
Buildfile: build.xml

test:
     [java] test config fileName = C:\PerfTester\test.prop
     [java] Tester.init(C:\PerfTester\test.prop) called
     [java] — listing properties —
     [java] testName=Http
     [java] testWarmup=5
     [java] testCooldown=5
     [java] testClassName=HttpTester
     [java] testThreadNmuber=2
     [java] testRuntime=10000
     [java] Tester.run() called
     [java] testThreadNmuber = 2
     [java] To instance a test driver
     [java] HttpTester starting…
     [java] HttpTester starting…
     [java] Host: www.google.com Port: 80
     [java] Host: www.google.com Port: 80
     [java] Host: www.google.com Port: 80
     [java] Host: www.yahoo.com Port: 80
     [java] Host: www.java.com Port: 80
     [java] Host: www.google.com Port: 80
     [java] Host: www.usyd.edu.au Port: 80
     [java] Host: www.usyd.edu.au Port: 80
     [java] Host: www.yahoo.com Port: 80
     [java] Host: www.google.com Port: 80
     [java] Host: www.google.com Port: 80
     [java] Host: www.usyd.edu.au Port: 80
     [java] Host: www.usyd.edu.au Port: 80
     [java] Host: www.yahoo.com Port: 80
     [java] Host: www.java.com Port: 80
     [java] Host: www.google.com Port: 80
     [java] Host: www.java.com Port: 80
     [java] Host: www.google.com Port: 80
     [java] Host: www.java.com Port: 80
     [java] Host: www.usyd.edu.au Port: 80
     [java] Host: www.google.com Port: 80
     [java] Host: www.usyd.edu.au Port: 80
     [java] Host: www.usyd.edu.au Port: 80
     [java] Host: www.usyd.edu.au Port: 80
     [java] Host: www.google.com Port: 80
     [java] Host: www.yahoo.com Port: 80
     [java] Host: www.yahoo.com Port: 80
     [java] Host: www.google.com Port: 80
     [java] Host: www.yahoo.com Port: 80
     [java] Host: www.java.com Port: 80
     [java] Host: www.google.com Port: 80
     [java] Host: www.google.com Port: 80
     [java] Host: www.yahoo.com Port: 80
     [java] Host: www.yahoo.com Port: 80
     [java] Thread-0 : exited
     [java] Thread-1 : exited
     [java]
     [java] Tester.report() called
     [java] testName = Http
     [java] minValue = 78
     [java] aveValue = 619
     [java] maxValue = 4591
     [java] 80  1
     [java] 100 5
     [java] 340 1
     [java] 360 9
     [java] 380 2
     [java] 400 3
     [java] 480 1
     [java] 520 3
     [java] 540 3
     [java] 4520        1
     [java] 4600        1

BUILD SUCCESSFUL
Total time: 11 seconds
C:\PerfTester>

Advertisements

Leave a Comment so far
Leave a comment



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s



%d bloggers like this: