Solved

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

Posted on 2006-07-20
4
361 Views
Last Modified: 2013-12-03
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
Comment
Question by:ly_uwo
  • 2
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
anumalas earned 500 total points
ID: 17151796
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
 

Author Comment

by:ly_uwo
ID: 17153475
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
 
LVL 3

Expert Comment

by:anumalas
ID: 17156585
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
 

Author Comment

by:ly_uwo
ID: 17158517
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In  today’s increasingly digital world, managed service providers (MSPs) fight for their customers’ attention, looking for ways to make them stay and purchase more services. One way to encourage that behavior is to develop a dependable brand of prod…
Use of TCL script on Cisco devices:  - create file and merge it with running configuration to apply configuration changes
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now