This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
PLZ MAIL ME THE SOLUTION AT firstname.lastname@example.org 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
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
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.
Andy Bowes<br />SCJP, SCWCD<br />I like deadlines, I love the whoosing noise they make as they go flying past - Douglas Adams