Thanks for the comments thus far. I am getting hammered on this so any insight that anyone can provide is appreciated.
FYI, the application I am working on is an insurance application with policies from 1 to 500 lines. The application has a maximum of 200 users at any given point in time.
After executing more tests, here is what I have observed:
1. If I increase the interval between individual thread creation, the individual thread elapsed times become respectable. However, the total elapsed time from the start of the first thread to the end of the last thread (to complete) appears to increase slightly.
For example, with an interval of 1000 milliseconds:
Instance 0002 Elapsed Time with XML = 0:04:812
Instance 0001 Elapsed Time with XML = 0:06:343
Instance 0003 Elapsed Time with XML = 0:04:282
Instance 0005 Elapsed Time with XML = 0:02:219
Instance 0004 Elapsed Time with XML = 0:04:171
Total elapsed time = 0:10:156
Average access time = 2.031
With an interval of 2000 milliseconds:
Instance 0001 Elapsed Time with XML = 0:04:532
Instance 0002 Elapsed Time with XML = 0:03:359
Instance 0003 Elapsed Time with XML = 0:02:485
Instance 0004 Elapsed Time with XML = 0:03:687
Instance 0005 Elapsed Time with XML = 0:02:156
Total elapsed time = 0:11:766
Average access time = 2.353
The individual thread elapsed times start to approach the times I have observed if I run each individual test on the same thread.
It would seem to me that providing some "spacing" between thread creation allows the test instances an opportunity to at least partially execute, thus requiring fewer timeslices.
2. The original test policies, for the times listed in the original post and for 1. above, represent some of our largest. However, these policies represent only 1/2 of 1 percent of all policies. I modified my original test such that it will query all policies and select one at random for each thread instance.
I have found that, using this test scenario (on my development machine), I get a good sampling of both large and small policies and can decrease the thread interval to as little as 300 milliseconds without any performance degradation. Using this thread interval, the test can handily process 200 policies per minute. Individual thread elapsed times generally range from 0.250 to 3.000 seconds. I would expect a web server to do better.
This has become a major issue because an outside company is performing load tests of our web application. The tests are being performed using the largest policies with a relatively small interval between page requests. The times are (I would agree) outrageous with response times of 30 seconds or more.
First of all, I believe the test is unrealistic because the test disproportionately accesses large policies at frequencies much higher than normal usage. Second, I believe the test results obtained would indicate that we require more web servers rather than a problem exists with the application if, in fact, the application were to experience this level of usage. Third, the test is being conducted on a single web server whereas our production environment has dual web servers. Fourth, I asked our support people today if our production users were reporting any significant performance issues. The answer was no.
The outside company has pointed a finger squarely at my code. However, the test in the original post and the tests performed in 1. and 2. above perform the same functions as the "bottleneck" method in the web application that invokes my code. I agree that my code takes a relatively long time to execute but it performs a significant chunk of the application's tasks. And, as I indicated above, I can achieve a throughput of 200 transactions per minute on my development machine so I fail to understand how the web application is experiencing this bottleneck.
Personally, I'm not sure there is actually a problem except under a large load. I think the problem has more to do with the relatively large transactions and relatively short thread creation intervals than any code bottleneck.
However, our managers are "concerned" so now we are now pushing ahead with initiatives to: 1) Upgrade to the latest
Tomcat version, 2) Upgrade to the the latest JVM, 3) Test different JVM parameter configurations, 4) Create a test environment using a 64-bit server, 5) Use multiple JVMs on a server, etc. Will any or all of these provide any significant performance improvement?
I'm not concerned that the load tests point a finger at my code. I am just trying to understand how my code can perform so well under load during tests on my development machine but perform miserably under load tests of the web application. I would expect it to perform better on the web server. Are there any significant differences between my development (Eclipse) JVM and the web server JVM that I should be aware of?
I would appreciate any comment. Thanks.