• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP error

 
R Sugan
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using more database connection in my jsp coding so the cpu percentage will be automatically
increased(100%) and my server also very slow response.I need one global database connection in jsp
page and get the connection in my code.How can i solve this problem?Please assist me to solve this problem.



Regards,
Suganya
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using a global DB connection is a big no-no, as you will run into concurrency issues. Use a database connection pool instead (like Apache DBCP), and obtain a connection from it. This should be done in a servlet or a backing bean, not in a JSP (never put JDBC code into a JSP).

Where does the slowness come from - the servlet container or the DB server? Are both running on the same machine? How many concurrent request is the app handling when load becomes an issue? Have the queries and indexes been performance tuned?
 
R Sugan
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf Dittmer,
Thanks for your reply.Please give me any sample code.That is very helpful to solve this problem.



Regards,
Suganya.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you looking for in particular that isn't covered by the numerous examples on the DBCP site (which I assume you have checked out)?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It'll be pretty important to identify where the slowdown is occurring--pegging at 100% during a single request to a single JSP should raise a warning flag that something is most likely horribly wrong.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!