Solved

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

Posted on 2006-07-20
4
362 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many Password Managers (PM) out there to choose from. PM's can help with your password habits and routines, but they should not be a crutch you rely on too heavily. I also have an article for company/enterprise PM's.
We need a new way to communicate time sensitive or critical info.   The best part of my role at xMatters is visiting our clients all over the world to learn about how they operate their businesses, share insights that xMatters has gleaned across…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
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…

867 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

21 Experts available now in Live!

Get 1:1 Help Now