Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unusual prob (jsp exec time less than servlet exec time)

 
Srinivas Varukala
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
PLZ MAIL ME THE SOLUTION AT vnevas@yahoo.com
Hey I am facing a prob which looks unusual ...i need it to b solved asap...the problem:-
We have a small program on server that receives a request with some
parameters from a client brower, and then inserts the parameter values
into the database.
Now, there are 2 instances of this program: one written in JSP and another
in Servlet.
To find the processing time, we send 5 requests (one after another) to
the server. Then, we found that Servlet took only 0-1 second per request,
while JSP took 6-8 seconds per request.
Now, we want to know the performance if there are many requests at the
same time. So, we have 5 different machines (just open 5 telnet
windoes; however, each will be on different servers. e.g. cash,
dilbert, isis, etc) sending 5 requests to the server. Then, we found that
Servlet still took only 0-1 second per request, while JSP took 27 - 40
seconds per requests.
So, we want to know WHY this happen, that servlet is faster than JSP?
Namely, with the same program specification, why JSP take more time than
Servlet on a single request as well as multiple requests. (especially the
latter one). And how can we improve the performance so that JSP can run
faster.
Thanks
Srinu
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great question Srinivas. And your first post too. I am curious to find out why this is happening to you especially since once the JSP page is loaded into your web server it becomes a Servlet and should react the same way as you actual Servlet.
Could there be anything in your JSP that isn't in your Servlet. Like maybe a different Database driver. Or can you decouple you database calls and Business logic into a help class that both your Servlet and JSP can use, then that way you can remove this issue from your consideration since both would use that same class and it runs as it runs.
You know this is the process of elimination to find the bottleneck.
Those are just vague suggestions, as I don't have any specific answer for you, but I am sure someone else with more experience will help.
Welcome to JavaRanch.
Mark
 
Andy Bowes
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suggest that you have a look at the Java source code for the servlet that your container will create for your JSP file.
I don't know which server you are using but for Tomcat this will appear under the 'work' directory.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic