tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wade Chandler <>
Subject Re: Performace differences when running application in Tomcat and JBuilder
Date Thu, 09 Dec 2004 15:05:49 GMT
Alex Pointer wrote:
> I have a problem to do with the performance of a server process I 
> developed when used in Tomcat, in comparison with running it in JBuilder X
> I have a JAR file that is the server process, that when a method is called 
> from Tomcat takes 35 seconds to run, while the same method called in 
> JBuilder X takes 12.5 seconds
> Why does Tomcat take over twice as long to run the same code as when run 
> from JBuilder X, and is there a way I can make Tomcat run the code faster?
> Any help, explanation would be appreciated
> Details can be found bellow:
> The complexities of the method are:
>         - using a Oracle JDBC Thin driver, it will connect to a remote 
> Oracle database over a 10Mbit connection and run a single SELECT query 
> that will return 85 records. (The SELECT query is always the same)
>         - each record in the resultset will have a object created that 
> represents it (each record has 129 fields).
>         - the record is copied out of the resultset and into the object by 
> using the meta-data provided with the resultset to identify the correct 
> setter method for the correct field for each record.
>         - the resultset is kept open during the entire action and is 
> passed with its cursor set to each object that then populates itself.
>         - after each object is populated the resultset cursor is moved to 
> the next record.
>         - this is done in a single thread (one object after the other), 
> and stored in an array of objects.
>         - the array of objects are then returned by the method.
> The first and last line of the called method are logging the current time.
> To run this method in Tomcat (I have tried versions 4.1.24, 5.0.18, 
> 5.0.28, 5.5.4)
> I write a web application that I deploy as a .war file in the webapps 
> directory.
> I copy the JAR file into the shared\lib folder, because it need to be 
> accessed by more than one web application.
> When a link on the website is clicked it calls the server process. 
> (because I am only looking at the times within the server process any 
> delay caused by the webapp calling the server process is ignored).
> It takes the same amount of time (to within a few milliseconds) every time 
> the link is clicked, so the compilation of any files cannot be causing the 
> problem.
> To run this method in JBuilder X
> I run a main method in a separate project that has the JAR file added into 
> its Included Libraries.
> (I assume running this way is the same as running it directly to the JVM 
> at the command line)
> The code is run automatically.
> Both Tomcat, and JBuilder X are running on the same Windows 2000 machine, 
> and no error or exception is reported during the execution.
> *******************************************************
> This email has originated from Steria Limited, Registration No: 2706218.
> Privileged, confidential and/or copyright information may be contained in this email,
and is only for the use of the intended addressee. To copy, forward, disclose or otherwise
use it in any way if you are not the intended recipient or responsible for delivering to him/her
is prohibited.
> If you receive this email by mistake, please advise the sender immediately, by using
the reply facility in your email software.
> We may monitor the content of emails sent and received via our network for the purposes
of ensuring compliance with policies and procedures.
> This message is subject to and does not create or vary any contractual relationships
between Steria Limited and the recipient.
> Office registered at: Three Cherry Trees Lane, Hemel Hempstead, Hertfordshire, HP2 7AH
> ******************************************************

Well, I don't know anything about your method other than it is code.  Do 
you yield in your code?  Do you sleep for any amount of time in your 
code?  Threading can influence the time it takes to run code.  Also, 
even though you may not yield in your code, it is still being run in 
another thread.  On the JVM there is nothing else happening in your 
process.  Are you timing from the beginning of the method to the end, or 
is your timing in different locations throughout the code?  You really 
need to offer as much information as you can possible think of when you 
start getting into questions like: Why does this code take X amount of 
time when run in this process vs this process?  Give all the details and 
you might get a better answer, but I can certainly tell you threading in 
a process will affect the timing of a section of code.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message