[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 383
  • Last Modified:

How the tomcat web application manage client threads, and database connections

Hi,

Currently I am looking at one web application project written by a consultant. The project has the kind of structure of Tomcat+JSP+Servlet+ JDBC transaction +Sql Server DB. I am not very familiar with web application server. I just wonder, how can the application handle multiple clients viewing the jsp pages, and multiple connections to the database? The resources are limited so must have controlls somewhere. Are both of that controlled by tomcat? Or tomcat controlls clients, and jdbc controlls database connection? From the project, I can't tell. Can anyone give me some hints? Thanks.
0
ly_uwo
Asked:
ly_uwo
  • 2
  • 2
1 Solution
 
anumalasCommented:
Hi

All the configuration settings are under web.xml configuration file of your project contains servlet information, tag lib information etc.,

For each and evey client request Tomcat webcontainer will create one thread(not instance) .

jdbc calls will be controlled by the Connection pool (which contain data sources) So Tomcat only controls the database connection also.   JDBC is a stanadard abstraction to manage database data.
JDBC and JNDI related configurations  setting are under $CATALINA_HOME/conf/server.xml.

Please refer your server.xml 's <context> </context> to know about JNDI configuration.

For further details refer

http://tomcat.apache.org/tomcat-4.1-doc/jndi-datasource-examples-howto.html

http://www.onjava.com/pub/a/onjava/2001/04/19/tomcat.html?page=1

Hope this will help :)
0
 
ly_uwoAuthor Commented:
Thank you, very instructive. My understanding is:

By configuring the client connections and database connections in the server.xml, the threads accessing web pages and databases are both got contolled. Thus there is no need to add a thread pool component for the project to manage the connections.

Is that true? Thanks a lot.
0
 
anumalasCommented:
HI

Its true. but what im trying to say is that  treads will be managed by a web container.

if you want to perform and manage well your web application try to improve your access prospectives like

if you want to improve your search crieteria develop index mechanism from A-Z

if you want to pre available your application specify <load-on-startup>1</load-on-startup> in  web.xml
 to make your jsp's available preior.

but ThreadPool is not a constraint on behalf of web-application

im again giving an option to you to go thru web application architecture and cntrolling  and to know more about tomcat

please go thru above specified first link

Dont confuse  hope you will get good understanding with in soon :)

have a great day
0
 
ly_uwoAuthor Commented:
what do you mean by "but ThreadPool is not a constraint on behalf of web-application "? Is that meaning I can add thread pool to the application to provide extra thread control? Thanks.

I will also go over your first link.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now